gitk: Make File->Update work properly again
If a view is selected it will now just update that view. Also fixed a few other things - if you switch away from a view while gitk is still reading it in, then switch back, gitk will re-read it from scratch. We now re-read the references when switching views. If something was selected before a view change, and we need to read in the new view, we now select the previously-selected commit when we come across it. Fixed a bug in setting of rowrangelist plus a couple of other minor things. Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
parent
50b44eceed
commit
d94f8cd6ad
59
gitk
59
gitk
@ -22,8 +22,8 @@ proc parse_args {rargs} {
|
|||||||
set parsed_args {}
|
set parsed_args {}
|
||||||
set cmdline_files {}
|
set cmdline_files {}
|
||||||
if {[catch {
|
if {[catch {
|
||||||
set parse_args [concat --default HEAD $rargs]
|
set args [concat --default HEAD $rargs]
|
||||||
set args [split [eval exec git-rev-parse $parse_args] "\n"]
|
set args [split [eval exec git-rev-parse $args] "\n"]
|
||||||
set i 0
|
set i 0
|
||||||
foreach arg $args {
|
foreach arg $args {
|
||||||
if {![regexp {^[0-9a-f]{40}$} $arg]} {
|
if {![regexp {^[0-9a-f]{40}$} $arg]} {
|
||||||
@ -217,17 +217,13 @@ proc readcommit {id} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc updatecommits {} {
|
proc updatecommits {} {
|
||||||
global parsed_args
|
global viewdata curview revtreeargs
|
||||||
|
|
||||||
unselectline
|
set n $curview
|
||||||
stopfindproc
|
set curview -1
|
||||||
foreach v {matchinglines treediffs currentid} {
|
catch {unset viewdata($n)}
|
||||||
global $v
|
parse_args $revtreeargs
|
||||||
catch {unset $v}
|
showview $n
|
||||||
}
|
|
||||||
clear_display
|
|
||||||
readrefs
|
|
||||||
getcommits $parsed_args
|
|
||||||
}
|
}
|
||||||
|
|
||||||
proc parsecommit {id contents listed} {
|
proc parsecommit {id contents listed} {
|
||||||
@ -354,7 +350,7 @@ proc error_popup msg {
|
|||||||
tkwait window $w
|
tkwait window $w
|
||||||
}
|
}
|
||||||
|
|
||||||
proc makewindow {rargs} {
|
proc makewindow {} {
|
||||||
global canv canv2 canv3 linespc charspc ctext cflist textfont
|
global canv canv2 canv3 linespc charspc ctext cflist textfont
|
||||||
global findtype findtypemenu findloc findstring fstring geometry
|
global findtype findtypemenu findloc findstring fstring geometry
|
||||||
global entries sha1entry sha1string sha1but
|
global entries sha1entry sha1string sha1but
|
||||||
@ -817,13 +813,6 @@ proc delview {} {
|
|||||||
showview 0
|
showview 0
|
||||||
}
|
}
|
||||||
|
|
||||||
proc saveview {} {
|
|
||||||
global curview viewdata
|
|
||||||
global displayorder parentlist childlist rowidlist rowoffsets
|
|
||||||
global rowrangelist commitlisted
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
proc showview {n} {
|
proc showview {n} {
|
||||||
global curview viewdata viewfiles
|
global curview viewdata viewfiles
|
||||||
global displayorder parentlist childlist rowidlist rowoffsets
|
global displayorder parentlist childlist rowidlist rowoffsets
|
||||||
@ -832,6 +821,7 @@ proc showview {n} {
|
|||||||
global selectedline currentid canv canvy0
|
global selectedline currentid canv canvy0
|
||||||
global matchinglines treediffs
|
global matchinglines treediffs
|
||||||
global parsed_args
|
global parsed_args
|
||||||
|
global pending_select phase
|
||||||
|
|
||||||
if {$n == $curview} return
|
if {$n == $curview} return
|
||||||
set selid {}
|
set selid {}
|
||||||
@ -850,7 +840,7 @@ proc showview {n} {
|
|||||||
}
|
}
|
||||||
unselectline
|
unselectline
|
||||||
stopfindproc
|
stopfindproc
|
||||||
if {![info exists viewdata($curview)]} {
|
if {$curview >= 0 && $phase eq {} && ![info exists viewdata($curview)]} {
|
||||||
set viewdata($curview) \
|
set viewdata($curview) \
|
||||||
[list $displayorder $parentlist $childlist $rowidlist \
|
[list $displayorder $parentlist $childlist $rowidlist \
|
||||||
$rowoffsets $rowrangelist $commitlisted]
|
$rowoffsets $rowrangelist $commitlisted]
|
||||||
@ -858,6 +848,7 @@ proc showview {n} {
|
|||||||
catch {unset matchinglines}
|
catch {unset matchinglines}
|
||||||
catch {unset treediffs}
|
catch {unset treediffs}
|
||||||
clear_display
|
clear_display
|
||||||
|
readrefs
|
||||||
|
|
||||||
set curview $n
|
set curview $n
|
||||||
.bar.view entryconf 2 -state [expr {$n == 0? "disabled": "normal"}]
|
.bar.view entryconf 2 -state [expr {$n == 0? "disabled": "normal"}]
|
||||||
@ -867,6 +858,7 @@ proc showview {n} {
|
|||||||
if {$viewfiles($n) ne {}} {
|
if {$viewfiles($n) ne {}} {
|
||||||
set args [concat $args "--" $viewfiles($n)]
|
set args [concat $args "--" $viewfiles($n)]
|
||||||
}
|
}
|
||||||
|
set pending_select $selid
|
||||||
getcommits $args
|
getcommits $args
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1036,7 +1028,7 @@ proc initlayout {} {
|
|||||||
set commitlisted {}
|
set commitlisted {}
|
||||||
set parentlist {}
|
set parentlist {}
|
||||||
set childlist {}
|
set childlist {}
|
||||||
set rowrangelist {{}}
|
set rowrangelist {}
|
||||||
catch {unset children}
|
catch {unset children}
|
||||||
set nextcolor 0
|
set nextcolor 0
|
||||||
set rowidlist {{}}
|
set rowidlist {{}}
|
||||||
@ -1099,7 +1091,7 @@ proc layoutmore {} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc showstuff {canshow} {
|
proc showstuff {canshow} {
|
||||||
global numcommits
|
global numcommits commitrow pending_select
|
||||||
global linesegends idrowranges idrangedrawn
|
global linesegends idrowranges idrangedrawn
|
||||||
|
|
||||||
if {$numcommits == 0} {
|
if {$numcommits == 0} {
|
||||||
@ -1113,6 +1105,7 @@ proc showstuff {canshow} {
|
|||||||
set rows [visiblerows]
|
set rows [visiblerows]
|
||||||
set r0 [lindex $rows 0]
|
set r0 [lindex $rows 0]
|
||||||
set r1 [lindex $rows 1]
|
set r1 [lindex $rows 1]
|
||||||
|
set selrow -1
|
||||||
for {set r $row} {$r < $canshow} {incr r} {
|
for {set r $row} {$r < $canshow} {incr r} {
|
||||||
if {[info exists linesegends($r)]} {
|
if {[info exists linesegends($r)]} {
|
||||||
foreach id $linesegends($r) {
|
foreach id $linesegends($r) {
|
||||||
@ -1135,6 +1128,11 @@ proc showstuff {canshow} {
|
|||||||
drawcmitrow $row
|
drawcmitrow $row
|
||||||
incr row
|
incr row
|
||||||
}
|
}
|
||||||
|
if {[info exists pending_select] &&
|
||||||
|
[info exists commitrow($pending_select)] &&
|
||||||
|
$commitrow($pending_select) < $numcommits} {
|
||||||
|
selectline $commitrow($pending_select) 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proc layoutrows {row endrow last} {
|
proc layoutrows {row endrow last} {
|
||||||
@ -1202,10 +1200,12 @@ proc layoutrows {row endrow last} {
|
|||||||
} else {
|
} else {
|
||||||
unset idinlist($id)
|
unset idinlist($id)
|
||||||
}
|
}
|
||||||
|
set ranges {}
|
||||||
if {[info exists idrowranges($id)]} {
|
if {[info exists idrowranges($id)]} {
|
||||||
lappend idrowranges($id) $row
|
lappend idrowranges($id) $row
|
||||||
lappend rowrangelist $idrowranges($id)
|
set ranges $idrowranges($id)
|
||||||
}
|
}
|
||||||
|
lappend rowrangelist $ranges
|
||||||
incr row
|
incr row
|
||||||
set offs [ntimes [llength $idlist] 0]
|
set offs [ntimes [llength $idlist] 0]
|
||||||
set l [llength $newolds]
|
set l [llength $newolds]
|
||||||
@ -1732,8 +1732,8 @@ proc findcrossings {id} {
|
|||||||
foreach {s e} [rowranges $id] {
|
foreach {s e} [rowranges $id] {
|
||||||
if {$e >= $numcommits} {
|
if {$e >= $numcommits} {
|
||||||
set e [expr {$numcommits - 1}]
|
set e [expr {$numcommits - 1}]
|
||||||
if {$e < $s} continue
|
|
||||||
}
|
}
|
||||||
|
if {$e <= $s} continue
|
||||||
set x [lsearch -exact [lindex $rowidlist $e] $id]
|
set x [lsearch -exact [lindex $rowidlist $e] $id]
|
||||||
if {$x < 0} {
|
if {$x < 0} {
|
||||||
puts "findcrossings: oops, no [shortids $id] in row $e"
|
puts "findcrossings: oops, no [shortids $id] in row $e"
|
||||||
@ -2360,7 +2360,7 @@ proc donefilediff {} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proc findcont {id} {
|
proc findcont {} {
|
||||||
global findid treediffs parentlist
|
global findid treediffs parentlist
|
||||||
global ffileline findstartline finddidsel
|
global ffileline findstartline finddidsel
|
||||||
global displayorder numcommits matchinglines findinprogress
|
global displayorder numcommits matchinglines findinprogress
|
||||||
@ -2493,8 +2493,9 @@ proc selectline {l isnew} {
|
|||||||
global canvy0 linespc parentlist childlist
|
global canvy0 linespc parentlist childlist
|
||||||
global cflist currentid sha1entry
|
global cflist currentid sha1entry
|
||||||
global commentend idtags linknum
|
global commentend idtags linknum
|
||||||
global mergemax numcommits
|
global mergemax numcommits pending_select
|
||||||
|
|
||||||
|
catch {unset pending_select}
|
||||||
$canv delete hover
|
$canv delete hover
|
||||||
normalline
|
normalline
|
||||||
if {$l < 0 || $l >= $numcommits} return
|
if {$l < 0 || $l >= $numcommits} return
|
||||||
@ -2784,7 +2785,7 @@ proc getmergediffline {mdf id np} {
|
|||||||
incr nextupdate 100
|
incr nextupdate 100
|
||||||
fileevent $mdf readable {}
|
fileevent $mdf readable {}
|
||||||
update
|
update
|
||||||
fileevent $mdf readable [list getmergediffline $mdf $id]
|
fileevent $mdf readable [list getmergediffline $mdf $id $np]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4027,7 +4028,7 @@ set stopped 0
|
|||||||
set stuffsaved 0
|
set stuffsaved 0
|
||||||
set patchnum 0
|
set patchnum 0
|
||||||
setcoords
|
setcoords
|
||||||
makewindow $revtreeargs
|
makewindow
|
||||||
readrefs
|
readrefs
|
||||||
parse_args $revtreeargs
|
parse_args $revtreeargs
|
||||||
set args $parsed_args
|
set args $parsed_args
|
||||||
|
Loading…
Reference in New Issue
Block a user