Merge git://git.kernel.org/pub/scm/gitk/gitk

* git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: Avoid handling the Return key twice in Add Branch
  gitk: Show local changes properly when we have a path limit
  gitk: Fix switch statement in parseviewargs
  gitk: Index line[hnd]tag arrays by id rather than row number
This commit is contained in:
Junio C Hamano
2008-11-30 22:59:41 -08:00

View File

@ -155,18 +155,16 @@ proc parseviewargs {n arglist} {
set origargs [lreplace $origargs $i $i] set origargs [lreplace $origargs $i $i]
incr i -1 incr i -1
} }
# These request or affect diff output, which we don't want.
# Some could be used to set our defaults for diff display.
"-[puabwcrRBMC]" - "-[puabwcrRBMC]" -
"--no-renames" - "--full-index" - "--binary" - "--abbrev=*" - "--no-renames" - "--full-index" - "--binary" - "--abbrev=*" -
"--find-copies-harder" - "-l*" - "--ext-diff" - "--no-ext-diff" - "--find-copies-harder" - "-l*" - "--ext-diff" - "--no-ext-diff" -
"--src-prefix=*" - "--dst-prefix=*" - "--no-prefix" - "--src-prefix=*" - "--dst-prefix=*" - "--no-prefix" -
"-O*" - "--text" - "--full-diff" - "--ignore-space-at-eol" - "-O*" - "--text" - "--full-diff" - "--ignore-space-at-eol" -
"--ignore-space-change" - "-U*" - "--unified=*" { "--ignore-space-change" - "-U*" - "--unified=*" {
# These request or affect diff output, which we don't want.
# Some could be used to set our defaults for diff display.
lappend diffargs $arg lappend diffargs $arg
} }
# These cause our parsing of git log's output to fail, or else
# they're options we want to set ourselves, so ignore them.
"--raw" - "--patch-with-raw" - "--patch-with-stat" - "--raw" - "--patch-with-raw" - "--patch-with-stat" -
"--name-only" - "--name-status" - "--color" - "--color-words" - "--name-only" - "--name-status" - "--color" - "--color-words" -
"--log-size" - "--pretty=*" - "--decorate" - "--abbrev-commit" - "--log-size" - "--pretty=*" - "--decorate" - "--abbrev-commit" -
@ -174,27 +172,29 @@ proc parseviewargs {n arglist} {
"--no-color" - "-g" - "--walk-reflogs" - "--no-walk" - "--no-color" - "-g" - "--walk-reflogs" - "--no-walk" -
"--timestamp" - "relative-date" - "--date=*" - "--stdin" - "--timestamp" - "relative-date" - "--date=*" - "--stdin" -
"--objects" - "--objects-edge" - "--reverse" { "--objects" - "--objects-edge" - "--reverse" {
# These cause our parsing of git log's output to fail, or else
# they're options we want to set ourselves, so ignore them.
} }
# These are harmless, and some are even useful
"--stat=*" - "--numstat" - "--shortstat" - "--summary" - "--stat=*" - "--numstat" - "--shortstat" - "--summary" -
"--check" - "--exit-code" - "--quiet" - "--topo-order" - "--check" - "--exit-code" - "--quiet" - "--topo-order" -
"--full-history" - "--dense" - "--sparse" - "--full-history" - "--dense" - "--sparse" -
"--follow" - "--left-right" - "--encoding=*" { "--follow" - "--left-right" - "--encoding=*" {
# These are harmless, and some are even useful
lappend glflags $arg lappend glflags $arg
} }
# These mean that we get a subset of the commits
"--diff-filter=*" - "--no-merges" - "--unpacked" - "--diff-filter=*" - "--no-merges" - "--unpacked" -
"--max-count=*" - "--skip=*" - "--since=*" - "--after=*" - "--max-count=*" - "--skip=*" - "--since=*" - "--after=*" -
"--until=*" - "--before=*" - "--max-age=*" - "--min-age=*" - "--until=*" - "--before=*" - "--max-age=*" - "--min-age=*" -
"--author=*" - "--committer=*" - "--grep=*" - "-[iE]" - "--author=*" - "--committer=*" - "--grep=*" - "-[iE]" -
"--remove-empty" - "--first-parent" - "--cherry-pick" - "--remove-empty" - "--first-parent" - "--cherry-pick" -
"-S*" - "--pickaxe-all" - "--pickaxe-regex" - { "-S*" - "--pickaxe-all" - "--pickaxe-regex" {
# These mean that we get a subset of the commits
set filtered 1 set filtered 1
lappend glflags $arg lappend glflags $arg
} }
"-n" {
# This appears to be the only one that has a value as a # This appears to be the only one that has a value as a
# separate word following it # separate word following it
"-n" {
set filtered 1 set filtered 1
set nextisval 1 set nextisval 1
lappend glflags $arg lappend glflags $arg
@ -211,8 +211,8 @@ proc parseviewargs {n arglist} {
# git rev-parse doesn't understand --merge # git rev-parse doesn't understand --merge
lappend revargs --gitk-symmetric-diff-marker MERGE_HEAD...HEAD lappend revargs --gitk-symmetric-diff-marker MERGE_HEAD...HEAD
} }
# Other flag arguments including -<n>
"-*" { "-*" {
# Other flag arguments including -<n>
if {[string is digit -strict [string range $arg 1 end]]} { if {[string is digit -strict [string range $arg 1 end]]} {
set filtered 1 set filtered 1
} else { } else {
@ -222,8 +222,8 @@ proc parseviewargs {n arglist} {
} }
lappend glflags $arg lappend glflags $arg
} }
# Non-flag arguments specify commits or ranges of commits
default { default {
# Non-flag arguments specify commits or ranges of commits
if {[string match "*...*" $arg]} { if {[string match "*...*" $arg]} {
lappend revargs --gitk-symmetric-diff-marker lappend revargs --gitk-symmetric-diff-marker
} }
@ -309,7 +309,7 @@ proc start_rev_list {view} {
global viewargs viewargscmd viewfiles vfilelimit global viewargs viewargscmd viewfiles vfilelimit
global showlocalchanges global showlocalchanges
global viewactive viewinstances vmergeonly global viewactive viewinstances vmergeonly
global mainheadid global mainheadid viewmainheadid viewmainheadid_orig
global vcanopt vflags vrevs vorigargs global vcanopt vflags vrevs vorigargs
set startmsecs [clock clicks -milliseconds] set startmsecs [clock clicks -milliseconds]
@ -367,8 +367,13 @@ proc start_rev_list {view} {
} }
set i [reg_instance $fd] set i [reg_instance $fd]
set viewinstances($view) [list $i] set viewinstances($view) [list $i]
if {$showlocalchanges && $mainheadid ne {}} { set viewmainheadid($view) $mainheadid
interestedin $mainheadid dodiffindex set viewmainheadid_orig($view) $mainheadid
if {$files ne {} && $mainheadid ne {}} {
get_viewmainhead $view
}
if {$showlocalchanges && $viewmainheadid($view) ne {}} {
interestedin $viewmainheadid($view) dodiffindex
} }
fconfigure $fd -blocking 0 -translation lf -eofchar {} fconfigure $fd -blocking 0 -translation lf -eofchar {}
if {$tclencoding != {}} { if {$tclencoding != {}} {
@ -446,22 +451,26 @@ proc updatecommits {} {
global curview vcanopt vorigargs vfilelimit viewinstances global curview vcanopt vorigargs vfilelimit viewinstances
global viewactive viewcomplete tclencoding global viewactive viewcomplete tclencoding
global startmsecs showneartags showlocalchanges global startmsecs showneartags showlocalchanges
global mainheadid pending_select global mainheadid viewmainheadid viewmainheadid_orig pending_select
global isworktree global isworktree
global varcid vposids vnegids vflags vrevs global varcid vposids vnegids vflags vrevs
set isworktree [expr {[exec git rev-parse --is-inside-work-tree] == "true"}] set isworktree [expr {[exec git rev-parse --is-inside-work-tree] == "true"}]
set oldmainid $mainheadid
rereadrefs rereadrefs
set view $curview
if {$mainheadid ne $viewmainheadid_orig($view)} {
if {$showlocalchanges} { if {$showlocalchanges} {
if {$mainheadid ne $oldmainid} {
dohidelocalchanges dohidelocalchanges
} }
if {[commitinview $mainheadid $curview]} { set viewmainheadid($view) $mainheadid
dodiffindex set viewmainheadid_orig($view) $mainheadid
if {$vfilelimit($view) ne {}} {
get_viewmainhead $view
} }
} }
set view $curview if {$showlocalchanges} {
doshowlocalchanges
}
if {$vcanopt($view)} { if {$vcanopt($view)} {
set oldpos $vposids($view) set oldpos $vposids($view)
set oldneg $vnegids($view) set oldneg $vnegids($view)
@ -4004,31 +4013,31 @@ proc ishighlighted {id} {
return 0 return 0
} }
proc bolden {row font} { proc bolden {id font} {
global canv linehtag selectedline boldrows need_redisplay global canv linehtag currentid boldids need_redisplay
# need_redisplay = 1 means the display is stale and about to be redrawn # need_redisplay = 1 means the display is stale and about to be redrawn
if {$need_redisplay} return if {$need_redisplay} return
lappend boldrows $row lappend boldids $id
$canv itemconf $linehtag($row) -font $font $canv itemconf $linehtag($id) -font $font
if {$row == $selectedline} { if {[info exists currentid] && $id eq $currentid} {
$canv delete secsel $canv delete secsel
set t [eval $canv create rect [$canv bbox $linehtag($row)] \ set t [eval $canv create rect [$canv bbox $linehtag($id)] \
-outline {{}} -tags secsel \ -outline {{}} -tags secsel \
-fill [$canv cget -selectbackground]] -fill [$canv cget -selectbackground]]
$canv lower $t $canv lower $t
} }
} }
proc bolden_name {row font} { proc bolden_name {id font} {
global canv2 linentag selectedline boldnamerows need_redisplay global canv2 linentag currentid boldnameids need_redisplay
if {$need_redisplay} return if {$need_redisplay} return
lappend boldnamerows $row lappend boldnameids $id
$canv2 itemconf $linentag($row) -font $font $canv2 itemconf $linentag($id) -font $font
if {$row == $selectedline} { if {[info exists currentid] && $id eq $currentid} {
$canv2 delete secsel $canv2 delete secsel
set t [eval $canv2 create rect [$canv2 bbox $linentag($row)] \ set t [eval $canv2 create rect [$canv2 bbox $linentag($id)] \
-outline {{}} -tags secsel \ -outline {{}} -tags secsel \
-fill [$canv2 cget -selectbackground]] -fill [$canv2 cget -selectbackground]]
$canv2 lower $t $canv2 lower $t
@ -4036,17 +4045,17 @@ proc bolden_name {row font} {
} }
proc unbolden {} { proc unbolden {} {
global boldrows global boldids
set stillbold {} set stillbold {}
foreach row $boldrows { foreach id $boldids {
if {![ishighlighted [commitonrow $row]]} { if {![ishighlighted $id]} {
bolden $row mainfont bolden $id mainfont
} else { } else {
lappend stillbold $row lappend stillbold $id
} }
} }
set boldrows $stillbold set boldids $stillbold
} }
proc addvhighlight {n} { proc addvhighlight {n} {
@ -4087,7 +4096,7 @@ proc vhighlightmore {} {
set row [rowofcommit $id] set row [rowofcommit $id]
if {$r0 <= $row && $row <= $r1} { if {$r0 <= $row && $row <= $r1} {
if {![highlighted $row]} { if {![highlighted $row]} {
bolden $row mainfontbold bolden $id mainfontbold
} }
set vhighlights($id) 1 set vhighlights($id) 1
} }
@ -4102,7 +4111,7 @@ proc askvhighlight {row id} {
if {[commitinview $id $hlview]} { if {[commitinview $id $hlview]} {
if {[info exists iddrawn($id)] && ![ishighlighted $id]} { if {[info exists iddrawn($id)] && ![ishighlighted $id]} {
bolden $row mainfontbold bolden $id mainfontbold
} }
set vhighlights($id) 1 set vhighlights($id) 1
} else { } else {
@ -4170,15 +4179,15 @@ proc find_change {name ix op} {
} }
proc findcom_change args { proc findcom_change args {
global nhighlights boldnamerows global nhighlights boldnameids
global findpattern findtype findstring gdttype global findpattern findtype findstring gdttype
stopfinding stopfinding
# delete previous highlights, if any # delete previous highlights, if any
foreach row $boldnamerows { foreach id $boldnameids {
bolden_name $row mainfont bolden_name $id mainfont
} }
set boldnamerows {} set boldnameids {}
catch {unset nhighlights} catch {unset nhighlights}
unbolden unbolden
unmarkmatches unmarkmatches
@ -4267,9 +4276,8 @@ proc readfhighlight {} {
set fhl_list [lrange $fhl_list [expr {$i+1}] end] set fhl_list [lrange $fhl_list [expr {$i+1}] end]
if {$line eq {}} continue if {$line eq {}} continue
if {![commitinview $line $curview]} continue if {![commitinview $line $curview]} continue
set row [rowofcommit $line]
if {[info exists iddrawn($line)] && ![ishighlighted $line]} { if {[info exists iddrawn($line)] && ![ishighlighted $line]} {
bolden $row mainfontbold bolden $line mainfontbold
} }
set fhighlights($line) 1 set fhighlights($line) 1
} }
@ -4321,9 +4329,9 @@ proc askfindhighlight {row id} {
} }
if {$isbold && [info exists iddrawn($id)]} { if {$isbold && [info exists iddrawn($id)]} {
if {![ishighlighted $id]} { if {![ishighlighted $id]} {
bolden $row mainfontbold bolden $id mainfontbold
if {$isbold > 1} { if {$isbold > 1} {
bolden_name $row mainfontbold bolden_name $id mainfontbold
} }
} }
if {$markingmatches} { if {$markingmatches} {
@ -4343,15 +4351,15 @@ proc markrowmatches {row id} {
if {$findloc eq [mc "All fields"] || $findloc eq [mc "Headline"]} { if {$findloc eq [mc "All fields"] || $findloc eq [mc "Headline"]} {
set m [findmatches $headline] set m [findmatches $headline]
if {$m ne {}} { if {$m ne {}} {
markmatches $canv $row $headline $linehtag($row) $m \ markmatches $canv $row $headline $linehtag($id) $m \
[$canv itemcget $linehtag($row) -font] $row [$canv itemcget $linehtag($id) -font] $row
} }
} }
if {$findloc eq [mc "All fields"] || $findloc eq [mc "Author"]} { if {$findloc eq [mc "All fields"] || $findloc eq [mc "Author"]} {
set m [findmatches $author] set m [findmatches $author]
if {$m ne {}} { if {$m ne {}} {
markmatches $canv2 $row $author $linentag($row) $m \ markmatches $canv2 $row $author $linentag($id) $m \
[$canv2 itemcget $linentag($row) -font] $row [$canv2 itemcget $linentag($id) -font] $row
} }
} }
} }
@ -4476,7 +4484,7 @@ proc askrelhighlight {row id} {
} }
if {[info exists iddrawn($id)]} { if {[info exists iddrawn($id)]} {
if {$isbold && ![ishighlighted $id]} { if {$isbold && ![ishighlighted $id]} {
bolden $row mainfontbold bolden $id mainfontbold
} }
} }
set rhighlights($id) $isbold set rhighlights($id) $isbold
@ -4644,14 +4652,56 @@ proc layoutmore {} {
drawvisible drawvisible
} }
proc doshowlocalchanges {} { # With path limiting, we mightn't get the actual HEAD commit,
global curview mainheadid # so ask git rev-list what is the first ancestor of HEAD that
# touches a file in the path limit.
proc get_viewmainhead {view} {
global viewmainheadid vfilelimit viewinstances mainheadid
if {$mainheadid eq {}} return catch {
if {[commitinview $mainheadid $curview]} { set rfd [open [concat | git rev-list -1 $mainheadid \
-- $vfilelimit($view)] r]
set j [reg_instance $rfd]
lappend viewinstances($view) $j
fconfigure $rfd -blocking 0
filerun $rfd [list getviewhead $rfd $j $view]
set viewmainheadid($curview) {}
}
}
# git rev-list should give us just 1 line to use as viewmainheadid($view)
proc getviewhead {fd inst view} {
global viewmainheadid commfd curview viewinstances showlocalchanges
set id {}
if {[gets $fd line] < 0} {
if {![eof $fd]} {
return 1
}
} elseif {[string length $line] == 40 && [string is xdigit $line]} {
set id $line
}
set viewmainheadid($view) $id
close $fd
unset commfd($inst)
set i [lsearch -exact $viewinstances($view) $inst]
if {$i >= 0} {
set viewinstances($view) [lreplace $viewinstances($view) $i $i]
}
if {$showlocalchanges && $id ne {} && $view == $curview} {
doshowlocalchanges
}
return 0
}
proc doshowlocalchanges {} {
global curview viewmainheadid
if {$viewmainheadid($curview) eq {}} return
if {[commitinview $viewmainheadid($curview) $curview]} {
dodiffindex dodiffindex
} else { } else {
interestedin $mainheadid dodiffindex interestedin $viewmainheadid($curview) dodiffindex
} }
} }
@ -4669,19 +4719,24 @@ 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 lserial showlocalchanges global lserial showlocalchanges vfilelimit curview
global isworktree global isworktree
if {!$showlocalchanges || !$isworktree} return if {!$showlocalchanges || !$isworktree} return
incr lserial incr lserial
set fd [open "|git diff-index --cached HEAD" r] set cmd "|git diff-index --cached HEAD"
if {$vfilelimit($curview) ne {}} {
set cmd [concat $cmd -- $vfilelimit($curview)]
}
set fd [open $cmd r]
fconfigure $fd -blocking 0 fconfigure $fd -blocking 0
set i [reg_instance $fd] set i [reg_instance $fd]
filerun $fd [list readdiffindex $fd $lserial $i] filerun $fd [list readdiffindex $fd $lserial $i]
} }
proc readdiffindex {fd serial inst} { proc readdiffindex {fd serial inst} {
global mainheadid nullid nullid2 curview commitinfo commitdata lserial global viewmainheadid nullid nullid2 curview commitinfo commitdata lserial
global vfilelimit
set isdiff 1 set isdiff 1
if {[gets $fd line] < 0} { if {[gets $fd line] < 0} {
@ -4698,7 +4753,11 @@ proc readdiffindex {fd serial inst} {
} }
# now see if there are any local changes not checked in to the index # now see if there are any local changes not checked in to the index
set fd [open "|git diff-files" r] set cmd "|git diff-files"
if {$vfilelimit($curview) ne {}} {
set cmd [concat $cmd -- $vfilelimit($curview)]
}
set fd [open $cmd r]
fconfigure $fd -blocking 0 fconfigure $fd -blocking 0
set i [reg_instance $fd] set i [reg_instance $fd]
filerun $fd [list readdifffiles $fd $serial $i] filerun $fd [list readdifffiles $fd $serial $i]
@ -4711,15 +4770,18 @@ proc readdiffindex {fd serial inst} {
if {[commitinview $nullid $curview]} { if {[commitinview $nullid $curview]} {
removefakerow $nullid removefakerow $nullid
} }
insertfakerow $nullid2 $mainheadid insertfakerow $nullid2 $viewmainheadid($curview)
} elseif {!$isdiff && [commitinview $nullid2 $curview]} { } elseif {!$isdiff && [commitinview $nullid2 $curview]} {
if {[commitinview $nullid $curview]} {
removefakerow $nullid
}
removefakerow $nullid2 removefakerow $nullid2
} }
return 0 return 0
} }
proc readdifffiles {fd serial inst} { proc readdifffiles {fd serial inst} {
global mainheadid nullid nullid2 curview global viewmainheadid nullid nullid2 curview
global commitinfo commitdata lserial global commitinfo commitdata lserial
set isdiff 1 set isdiff 1
@ -4744,7 +4806,7 @@ proc readdifffiles {fd serial inst} {
if {[commitinview $nullid2 $curview]} { if {[commitinview $nullid2 $curview]} {
set p $nullid2 set p $nullid2
} else { } else {
set p $mainheadid set p $viewmainheadid($curview)
} }
insertfakerow $nullid $p insertfakerow $nullid $p
} elseif {!$isdiff && [commitinview $nullid $curview]} { } elseif {!$isdiff && [commitinview $nullid $curview]} {
@ -5469,7 +5531,7 @@ proc drawcmittext {id row col} {
global cmitlisted commitinfo rowidlist parentlist global cmitlisted commitinfo rowidlist parentlist
global rowtextx idpos idtags idheads idotherrefs global rowtextx idpos idtags idheads idotherrefs
global linehtag linentag linedtag selectedline global linehtag linentag linedtag selectedline
global canvxmax boldrows boldnamerows fgcolor global canvxmax boldids boldnameids fgcolor
global mainheadid nullid nullid2 circleitem circlecolors ctxbut global mainheadid nullid nullid2 circleitem circlecolors ctxbut
# listed is 0 for boundary, 1 for normal, 2 for negative, 3 for left, 4 for right # listed is 0 for boundary, 1 for normal, 2 for negative, 3 for left, 4 for right
@ -5534,22 +5596,22 @@ proc drawcmittext {id row col} {
set nfont mainfont set nfont mainfont
set isbold [ishighlighted $id] set isbold [ishighlighted $id]
if {$isbold > 0} { if {$isbold > 0} {
lappend boldrows $row lappend boldids $id
set font mainfontbold set font mainfontbold
if {$isbold > 1} { if {$isbold > 1} {
lappend boldnamerows $row lappend boldnameids $id
set nfont mainfontbold set nfont mainfontbold
} }
} }
set linehtag($row) [$canv create text $xt $y -anchor w -fill $fgcolor \ set linehtag($id) [$canv create text $xt $y -anchor w -fill $fgcolor \
-text $headline -font $font -tags text] -text $headline -font $font -tags text]
$canv bind $linehtag($row) $ctxbut "rowmenu %X %Y $id" $canv bind $linehtag($id) $ctxbut "rowmenu %X %Y $id"
set linentag($row) [$canv2 create text 3 $y -anchor w -fill $fgcolor \ set linentag($id) [$canv2 create text 3 $y -anchor w -fill $fgcolor \
-text $name -font $nfont -tags text] -text $name -font $nfont -tags text]
set linedtag($row) [$canv3 create text 3 $y -anchor w -fill $fgcolor \ set linedtag($id) [$canv3 create text 3 $y -anchor w -fill $fgcolor \
-text $date -font mainfont -tags text] -text $date -font mainfont -tags text]
if {$selectedline == $row} { if {$selectedline == $row} {
make_secsel $row make_secsel $id
} }
set xr [expr {$xt + [font measure $font $headline]}] set xr [expr {$xt + [font measure $font $headline]}]
if {$xr > $canvxmax} { if {$xr > $canvxmax} {
@ -5757,7 +5819,7 @@ proc drawvisible {} {
proc clear_display {} { proc clear_display {} {
global iddrawn linesegs need_redisplay nrows_drawn global iddrawn linesegs need_redisplay nrows_drawn
global vhighlights fhighlights nhighlights rhighlights global vhighlights fhighlights nhighlights rhighlights
global linehtag linentag linedtag boldrows boldnamerows global linehtag linentag linedtag boldids boldnameids
allcanvs delete all allcanvs delete all
catch {unset iddrawn} catch {unset iddrawn}
@ -5765,8 +5827,8 @@ proc clear_display {} {
catch {unset linehtag} catch {unset linehtag}
catch {unset linentag} catch {unset linentag}
catch {unset linedtag} catch {unset linedtag}
set boldrows {} set boldids {}
set boldnamerows {} set boldnameids {}
catch {unset vhighlights} catch {unset vhighlights}
catch {unset fhighlights} catch {unset fhighlights}
catch {unset nhighlights} catch {unset nhighlights}
@ -6474,20 +6536,20 @@ proc dispnexttag {} {
} }
} }
proc make_secsel {l} { proc make_secsel {id} {
global linehtag linentag linedtag canv canv2 canv3 global linehtag linentag linedtag canv canv2 canv3
if {![info exists linehtag($l)]} return if {![info exists linehtag($id)]} return
$canv delete secsel $canv delete secsel
set t [eval $canv create rect [$canv bbox $linehtag($l)] -outline {{}} \ set t [eval $canv create rect [$canv bbox $linehtag($id)] -outline {{}} \
-tags secsel -fill [$canv cget -selectbackground]] -tags secsel -fill [$canv cget -selectbackground]]
$canv lower $t $canv lower $t
$canv2 delete secsel $canv2 delete secsel
set t [eval $canv2 create rect [$canv2 bbox $linentag($l)] -outline {{}} \ set t [eval $canv2 create rect [$canv2 bbox $linentag($id)] -outline {{}} \
-tags secsel -fill [$canv2 cget -selectbackground]] -tags secsel -fill [$canv2 cget -selectbackground]]
$canv2 lower $t $canv2 lower $t
$canv3 delete secsel $canv3 delete secsel
set t [eval $canv3 create rect [$canv3 bbox $linedtag($l)] -outline {{}} \ set t [eval $canv3 create rect [$canv3 bbox $linedtag($id)] -outline {{}} \
-tags secsel -fill [$canv3 cget -selectbackground]] -tags secsel -fill [$canv3 cget -selectbackground]]
$canv3 lower $t $canv3 lower $t
} }
@ -6553,7 +6615,7 @@ proc selectline {l isnew {desired_loc {}}} {
drawvisible drawvisible
} }
make_secsel $l make_secsel $id
if {$isnew} { if {$isnew} {
addtohistory [list selbyid $id] addtohistory [list selbyid $id]
@ -8109,16 +8171,16 @@ proc redrawtags {id} {
$canv itemconf $circleitem($row) -fill $ofill $canv itemconf $circleitem($row) -fill $ofill
$canv delete tag.$id $canv delete tag.$id
set xt [eval drawtags $id $idpos($id)] set xt [eval drawtags $id $idpos($id)]
$canv coords $linehtag($row) $xt [lindex $idpos($id) 2] $canv coords $linehtag($id) $xt [lindex $idpos($id) 2]
set text [$canv itemcget $linehtag($row) -text] set text [$canv itemcget $linehtag($id) -text]
set font [$canv itemcget $linehtag($row) -font] set font [$canv itemcget $linehtag($id) -font]
set xr [expr {$xt + [font measure $font $text]}] set xr [expr {$xt + [font measure $font $text]}]
if {$xr > $canvxmax} { if {$xr > $canvxmax} {
set canvxmax $xr set canvxmax $xr
setcanvscroll setcanvscroll
} }
if {[info exists currentid] && $currentid == $id} { if {[info exists currentid] && $currentid == $id} {
make_secsel $row make_secsel $id
} }
} }
@ -8208,7 +8270,6 @@ proc mkbranch {} {
grid $top.id $top.sha1 -sticky w grid $top.id $top.sha1 -sticky w
label $top.nlab -text [mc "Name:"] label $top.nlab -text [mc "Name:"]
entry $top.name -width 40 entry $top.name -width 40
bind $top.name <Key-Return> "[list mkbrgo $top]"
grid $top.nlab $top.name -sticky w grid $top.nlab $top.name -sticky w
frame $top.buts frame $top.buts
button $top.buts.go -text [mc "Create"] -command [list mkbrgo $top] button $top.buts.go -text [mc "Create"] -command [list mkbrgo $top]
@ -8342,6 +8403,7 @@ proc cherrypick {} {
} }
addnewchild $newhead $oldhead addnewchild $newhead $oldhead
if {[commitinview $oldhead $curview]} { if {[commitinview $oldhead $curview]} {
# XXX this isn't right if we have a path limit...
insertrow $newhead $oldhead $curview insertrow $newhead $oldhead $curview
if {$mainhead ne {}} { if {$mainhead ne {}} {
movehead $newhead $mainhead movehead $newhead $mainhead
@ -8449,7 +8511,7 @@ proc headmenu {x y id head} {
proc cobranch {} { proc cobranch {} {
global headmenuid headmenuhead headids global headmenuid headmenuhead headids
global showlocalchanges mainheadid global showlocalchanges
# check the tree is clean first?? # check the tree is clean first??
nowbusy checkout [mc "Checking out"] nowbusy checkout [mc "Checking out"]
@ -8470,6 +8532,7 @@ proc cobranch {} {
proc readcheckoutstat {fd newhead newheadid} { proc readcheckoutstat {fd newhead newheadid} {
global mainhead mainheadid headids showlocalchanges progresscoords global mainhead mainheadid headids showlocalchanges progresscoords
global viewmainheadid curview
if {[gets $fd line] >= 0} { if {[gets $fd line] >= 0} {
if {[regexp {([0-9]+)% \(([0-9]+)/([0-9]+)\)} $line match p m n]} { if {[regexp {([0-9]+)% \(([0-9]+)/([0-9]+)\)} $line match p m n]} {
@ -8487,6 +8550,7 @@ proc readcheckoutstat {fd newhead newheadid} {
set oldmainid $mainheadid set oldmainid $mainheadid
set mainhead $newhead set mainhead $newhead
set mainheadid $newheadid set mainheadid $newheadid
set viewmainheadid($curview) $newheadid
redrawtags $oldmainid redrawtags $oldmainid
redrawtags $newheadid redrawtags $newheadid
selbyid $newheadid selbyid $newheadid
@ -10766,8 +10830,8 @@ set nhl_names {}
set highlight_paths {} set highlight_paths {}
set findpattern {} set findpattern {}
set searchdirn -forwards set searchdirn -forwards
set boldrows {} set boldids {}
set boldnamerows {} set boldnameids {}
set diffelide {0 0} set diffelide {0 0}
set markingmatches 0 set markingmatches 0
set linkentercount 0 set linkentercount 0