gitk: Get rid of lookingforhead, use commitinterest instead
Now that we have a general-purpose way of taking some action when a commit ID of interest is encountered, use that for triggering the git diff-index process when we find the currently checked-out head, rather than the special-purpose lookingforhead variable. Also do the commitinterest processing in getcommitlines rather than in showstuff. Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
parent
f56782aef4
commit
3e6b893f33
42
gitk
42
gitk
@ -83,7 +83,7 @@ proc start_rev_list {view} {
|
|||||||
global startmsecs
|
global startmsecs
|
||||||
global commfd leftover tclencoding datemode
|
global commfd leftover tclencoding datemode
|
||||||
global viewargs viewfiles commitidx viewcomplete vnextroot
|
global viewargs viewfiles commitidx viewcomplete vnextroot
|
||||||
global lookingforhead showlocalchanges
|
global showlocalchanges commitinterest mainheadid
|
||||||
|
|
||||||
set startmsecs [clock clicks -milliseconds]
|
set startmsecs [clock clicks -milliseconds]
|
||||||
set commitidx($view) 0
|
set commitidx($view) 0
|
||||||
@ -102,7 +102,9 @@ proc start_rev_list {view} {
|
|||||||
}
|
}
|
||||||
set commfd($view) $fd
|
set commfd($view) $fd
|
||||||
set leftover($view) {}
|
set leftover($view) {}
|
||||||
set lookingforhead $showlocalchanges
|
if {$showlocalchanges} {
|
||||||
|
lappend commitinterest($mainheadid) {dodiffindex}
|
||||||
|
}
|
||||||
fconfigure $fd -blocking 0 -translation lf -eofchar {}
|
fconfigure $fd -blocking 0 -translation lf -eofchar {}
|
||||||
if {$tclencoding != {}} {
|
if {$tclencoding != {}} {
|
||||||
fconfigure $fd -encoding $tclencoding
|
fconfigure $fd -encoding $tclencoding
|
||||||
@ -147,7 +149,7 @@ proc strrep {n} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc getcommitlines {fd view} {
|
proc getcommitlines {fd view} {
|
||||||
global commitlisted
|
global commitlisted commitinterest
|
||||||
global leftover commfd
|
global leftover commfd
|
||||||
global displayorder commitidx viewcomplete commitrow commitdata
|
global displayorder commitidx viewcomplete commitrow commitdata
|
||||||
global parentlist children curview hlview
|
global parentlist children curview hlview
|
||||||
@ -303,6 +305,12 @@ proc getcommitlines {fd view} {
|
|||||||
lappend vdisporder($view) $id
|
lappend vdisporder($view) $id
|
||||||
lappend vcmitlisted($view) $listed
|
lappend vcmitlisted($view) $listed
|
||||||
}
|
}
|
||||||
|
if {[info exists commitinterest($id)]} {
|
||||||
|
foreach script $commitinterest($id) {
|
||||||
|
eval [string map [list "%I" $id] $script]
|
||||||
|
}
|
||||||
|
unset commitinterest($id)
|
||||||
|
}
|
||||||
set gotsome 1
|
set gotsome 1
|
||||||
}
|
}
|
||||||
if {$gotsome} {
|
if {$gotsome} {
|
||||||
@ -2715,7 +2723,7 @@ proc layoutmore {} {
|
|||||||
|
|
||||||
proc showstuff {canshow last} {
|
proc showstuff {canshow last} {
|
||||||
global numcommits commitrow pending_select selectedline curview
|
global numcommits commitrow pending_select selectedline curview
|
||||||
global lookingforhead mainheadid displayorder selectfirst
|
global mainheadid displayorder selectfirst
|
||||||
global lastscrollset commitinterest
|
global lastscrollset commitinterest
|
||||||
|
|
||||||
if {$numcommits == 0} {
|
if {$numcommits == 0} {
|
||||||
@ -2723,15 +2731,6 @@ proc showstuff {canshow last} {
|
|||||||
set phase "incrdraw"
|
set phase "incrdraw"
|
||||||
allcanvs delete all
|
allcanvs delete all
|
||||||
}
|
}
|
||||||
for {set l $numcommits} {$l < $canshow} {incr l} {
|
|
||||||
set id [lindex $displayorder $l]
|
|
||||||
if {[info exists commitinterest($id)]} {
|
|
||||||
foreach script $commitinterest($id) {
|
|
||||||
eval [string map [list "%I" $id] $script]
|
|
||||||
}
|
|
||||||
unset commitinterest($id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set r0 $numcommits
|
set r0 $numcommits
|
||||||
set prev $numcommits
|
set prev $numcommits
|
||||||
set numcommits $canshow
|
set numcommits $canshow
|
||||||
@ -2762,28 +2761,22 @@ proc showstuff {canshow last} {
|
|||||||
set selectfirst 0
|
set selectfirst 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if {$lookingforhead && [info exists commitrow($curview,$mainheadid)]
|
|
||||||
&& ($last || $commitrow($curview,$mainheadid) < $numcommits - 1)} {
|
|
||||||
set lookingforhead 0
|
|
||||||
dodiffindex
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
proc doshowlocalchanges {} {
|
proc doshowlocalchanges {} {
|
||||||
global lookingforhead curview mainheadid phase commitrow
|
global curview mainheadid phase commitrow
|
||||||
|
|
||||||
if {[info exists commitrow($curview,$mainheadid)] &&
|
if {[info exists commitrow($curview,$mainheadid)] &&
|
||||||
($phase eq {} || $commitrow($curview,$mainheadid) < $numcommits - 1)} {
|
($phase eq {} || $commitrow($curview,$mainheadid) < $numcommits - 1)} {
|
||||||
dodiffindex
|
dodiffindex
|
||||||
} elseif {$phase ne {}} {
|
} elseif {$phase ne {}} {
|
||||||
set lookingforhead 1
|
lappend commitinterest($mainheadid) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proc dohidelocalchanges {} {
|
proc dohidelocalchanges {} {
|
||||||
global lookingforhead localfrow localirow lserial
|
global localfrow localirow lserial
|
||||||
|
|
||||||
set lookingforhead 0
|
|
||||||
if {$localfrow >= 0} {
|
if {$localfrow >= 0} {
|
||||||
removerow $localfrow
|
removerow $localfrow
|
||||||
set localfrow -1
|
set localfrow -1
|
||||||
@ -2800,8 +2793,9 @@ proc dohidelocalchanges {} {
|
|||||||
|
|
||||||
# spawn off a process to do git diff-index --cached HEAD
|
# spawn off a process to do git diff-index --cached HEAD
|
||||||
proc dodiffindex {} {
|
proc dodiffindex {} {
|
||||||
global localirow localfrow lserial
|
global localirow localfrow lserial showlocalchanges
|
||||||
|
|
||||||
|
if {!$showlocalchanges} return
|
||||||
incr lserial
|
incr lserial
|
||||||
set localfrow -1
|
set localfrow -1
|
||||||
set localirow -1
|
set localirow -1
|
||||||
@ -6188,7 +6182,6 @@ proc cherrypick {} {
|
|||||||
|
|
||||||
proc resethead {} {
|
proc resethead {} {
|
||||||
global mainheadid mainhead rowmenuid confirm_ok resettype
|
global mainheadid mainhead rowmenuid confirm_ok resettype
|
||||||
global showlocalchanges
|
|
||||||
|
|
||||||
set confirm_ok 0
|
set confirm_ok 0
|
||||||
set w ".confirmreset"
|
set w ".confirmreset"
|
||||||
@ -8249,7 +8242,6 @@ set cmdlineok 0
|
|||||||
set stopped 0
|
set stopped 0
|
||||||
set stuffsaved 0
|
set stuffsaved 0
|
||||||
set patchnum 0
|
set patchnum 0
|
||||||
set lookingforhead 0
|
|
||||||
set localirow -1
|
set localirow -1
|
||||||
set localfrow -1
|
set localfrow -1
|
||||||
set lserial 0
|
set lserial 0
|
||||||
|
Loading…
Reference in New Issue
Block a user