{mc "Diff this -> selected" command {diffvssel 0}}
{mc "Diff selected -> this" command {diffvssel 1}}
{mc "Edit this commit" command edit_commit}
+ {mc "Fold this into selected (fixup)" command fixup_commit}
{mc "Make patch" command mkpatch}
{mc "Create tag" command mktag}
{mc "Write commit to file" command writecommit}
if {$id ne $nullid && $id ne $nullid2} {
set menu $rowctxmenu
if {$mainhead ne {}} {
- $menu entryconfigure 8 -label [mc "Reset %s branch to here" $mainhead] -state normal
+ $menu entryconfigure 9 -label [mc "Reset %s branch to here" $mainhead] -state normal
} else {
- $menu entryconfigure 8 -label [mc "Detached head: can't reset" $mainhead] -state disabled
+ $menu entryconfigure 9 -label [mc "Detached head: can't reset" $mainhead] -state disabled
}
+ $menu entryconfigure [mca "Fold this into selected (fixup)"] -state $state
if {[info exists markedid] && $markedid ne $id} {
- $menu entryconfigure 10 -state normal
$menu entryconfigure 11 -state normal
$menu entryconfigure 12 -state normal
+ $menu entryconfigure 13 -state normal
} else {
- $menu entryconfigure 10 -state disabled
$menu entryconfigure 11 -state disabled
$menu entryconfigure 12 -state disabled
+ $menu entryconfigure 13 -state disabled
}
} else {
set menu $fakerowmenu
notbusy edit
}
+proc fixup_commit {} {
+ global rowmenuid selectedline
+ set selectedid [commitonrow $selectedline]
+ set baseid [exec git merge-base $selectedid $rowmenuid]
+
+ if {![rebase_ok $baseid]} return
+
+ set this [string range $rowmenuid 0 6]
+ set selected [string range $selectedid 0 6]
+ nowbusy fixup
+ if {[catch {exec sh -c "GIT_EDITOR=\"sed -i -e '/^pick $selected/a fixup $this' -e '/^pick $this/d'\" git rebase -p -i --no-autosquash $baseid^ 2>&1"} err]} {
+ notbusy fixup
+ error_popup $err
+ exec git rebase --abort
+ return
+ }
+ updatecommits
+ notbusy fixup
+}
proc resethead {} {
global mainhead rowmenuid confirm_ok resettype NS