diff options
author | Paul Mackerras <paulus@samba.org> | 2012-03-23 22:07:27 +1100 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2012-03-23 22:07:27 +1100 |
commit | 6febdede5acdbab192d955d4e0cd810f3fbee27f (patch) | |
tree | e07435d868d5fd0e836bbee0eec04e66c26c4ec4 | |
parent | gitk: Speed up resolution of short SHA1 ids (diff) | |
download | tgif-6febdede5acdbab192d955d4e0cd810f3fbee27f.tar.xz |
gitk: Add menu items for comparing a commit with the marked commit
Sometimes one wants to see the different between two commits that are
a long distance apart in the graph display. This is difficult to do
with the "Diff this -> selected" and "Diff selected -> this" menu
items because the need to maintain the selection means that one can't
use the find facilities or the reference list window to navigate from
one to the other.
This provides an alternative using the mark. Having found one commit,
one marks it with the "Mark this commit" menu item, then navigates to
the other commit and uses the new "Diff this -> marked commit" and/or
"Diff marked commit -> this" menu items.
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rwxr-xr-x | gitk | 38 |
1 files changed, 29 insertions, 9 deletions
@@ -2542,6 +2542,8 @@ proc makewindow {} { {mc "Return to mark" command gotomark} {mc "Find descendant of this and mark" command find_common_desc} {mc "Compare with marked commit" command compare_commits} + {mc "Diff this -> marked commit" command {diffvsmark 0}} + {mc "Diff marked commit -> this" command {diffvsmark 1}} } $rowctxmenu configure -tearoff 0 @@ -2550,6 +2552,8 @@ proc makewindow {} { {mc "Diff this -> selected" command {diffvssel 0}} {mc "Diff selected -> this" command {diffvssel 1}} {mc "Make patch" command mkpatch} + {mc "Diff this -> marked commit" command {diffvsmark 0}} + {mc "Diff marked commit -> this" command {diffvsmark 1}} } $fakerowmenu configure -tearoff 0 @@ -8495,6 +8499,11 @@ proc rowmenu {x y id} { } else { set state normal } + if {[info exists markedid] && $markedid ne $id} { + set mstate normal + } else { + set mstate disabled + } if {$id ne $nullid && $id ne $nullid2} { set menu $rowctxmenu if {$mainhead ne {}} { @@ -8502,21 +8511,17 @@ proc rowmenu {x y id} { } else { $menu entryconfigure 7 -label [mc "Detached head: can't reset" $mainhead] -state disabled } - if {[info exists markedid] && $markedid ne $id} { - $menu entryconfigure 9 -state normal - $menu entryconfigure 10 -state normal - $menu entryconfigure 11 -state normal - } else { - $menu entryconfigure 9 -state disabled - $menu entryconfigure 10 -state disabled - $menu entryconfigure 11 -state disabled - } + $menu entryconfigure 9 -state $mstate + $menu entryconfigure 10 -state $mstate + $menu entryconfigure 11 -state $mstate } else { set menu $fakerowmenu } $menu entryconfigure [mca "Diff this -> selected"] -state $state $menu entryconfigure [mca "Diff selected -> this"] -state $state $menu entryconfigure [mca "Make patch"] -state $state + $menu entryconfigure [mca "Diff this -> marked commit"] -state $mstate + $menu entryconfigure [mca "Diff marked commit -> this"] -state $mstate tk_popup $menu $x $y } @@ -8720,6 +8725,21 @@ proc diffvssel {dirn} { doseldiff $oldid $newid } +proc diffvsmark {dirn} { + global rowmenuid markedid + + if {![info exists markedid]} return + if {$dirn} { + set oldid $markedid + set newid $rowmenuid + } else { + set oldid $rowmenuid + set newid $markedid + } + addtohistory [list doseldiff $oldid $newid] savectextpos + doseldiff $oldid $newid +} + proc doseldiff {oldid newid} { global ctext global commitinfo |