diff --git a/gitk-git/gitk b/gitk-git/gitk
index 9ab6dbaa460cc4c63398e836506c204d382419b4..fddcb45817ed6839ba95965d7e57e9a2e04ae30a 100644 (file)
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
global startmsecs commitidx viewcomplete curview
global commfd leftover tclencoding
global viewargs viewargscmd viewfiles vfilelimit
global startmsecs commitidx viewcomplete curview
global commfd leftover tclencoding
global viewargs viewargscmd viewfiles vfilelimit
- global showlocalchanges commitinterest mainheadid
+ global showlocalchanges commitinterest
global viewactive loginstance viewinstances vmergeonly
global pending_select mainheadid
global vcanopt vflags vrevs vorigargs
global viewactive loginstance viewinstances vmergeonly
global pending_select mainheadid
global vcanopt vflags vrevs vorigargs
set viewinstances($view) [list $i]
set commfd($i) $fd
set leftover($i) {}
set viewinstances($view) [list $i]
set commfd($i) $fd
set leftover($i) {}
- if {$showlocalchanges} {
+ if {$showlocalchanges && $mainheadid ne {}} {
lappend commitinterest($mainheadid) {dodiffindex}
}
fconfigure $fd -blocking 0 -translation lf -eofchar {}
lappend commitinterest($mainheadid) {dodiffindex}
}
fconfigure $fd -blocking 0 -translation lf -eofchar {}
proc updatecommits {} {
global curview vcanopt vorigargs vfilelimit viewinstances
proc updatecommits {} {
global curview vcanopt vorigargs vfilelimit viewinstances
- global viewactive viewcomplete loginstance tclencoding mainheadid
+ global viewactive viewcomplete loginstance tclencoding
global startmsecs commfd showneartags showlocalchanges leftover
global mainheadid pending_select
global isworktree
global startmsecs commfd showneartags showlocalchanges leftover
global mainheadid pending_select
global isworktree
stop_rev_list $curview
}
resetvarcs $curview
stop_rev_list $curview
}
resetvarcs $curview
- catch {unset selectedline}
+ set selectedline {}
catch {unset currentid}
catch {unset thickerline}
catch {unset treediffs}
catch {unset currentid}
catch {unset thickerline}
catch {unset treediffs}
modify_arc $v $a $i
if {[info exist currentid] && $id eq $currentid} {
unset currentid
modify_arc $v $a $i
if {[info exist currentid] && $id eq $currentid} {
unset currentid
- unset selectedline
+ set selectedline {}
}
if {[info exists targetid] && $targetid eq $id} {
set targetid $p
}
if {[info exists targetid] && $targetid eq $id} {
set targetid $p
if {$viewcomplete($curview)} {
global commitidx varctok
global numcommits startmsecs
if {$viewcomplete($curview)} {
global commitidx varctok
global numcommits startmsecs
- global mainheadid nullid
if {[info exists pending_select]} {
set row [first_real_row]
if {[info exists pending_select]} {
set row [first_real_row]
set mainhead {}
set mainheadid {}
catch {
set mainhead {}
set mainheadid {}
catch {
+ set mainheadid [exec git rev-parse HEAD]
set thehead [exec git symbolic-ref HEAD]
if {[string match "refs/heads/*" $thehead]} {
set mainhead [string range $thehead 11 end]
set thehead [exec git symbolic-ref HEAD]
if {[string match "refs/heads/*" $thehead]} {
set mainhead [string range $thehead 11 end]
- if {[info exists headids($mainhead)]} {
- set mainheadid $headids($mainhead)
- }
}
}
}
}
}
}
pack .tf.bar.rowlabel .tf.bar.rownum .tf.bar.rowlabel2 .tf.bar.numcommits \
-side left
global selectedline
pack .tf.bar.rowlabel .tf.bar.rownum .tf.bar.rowlabel2 .tf.bar.numcommits \
-side left
global selectedline
- trace add variable selectedline {write unset} selectedline_change
+ trace add variable selectedline write selectedline_change
# Status label and progress bar
set statusw .tf.bar.status
# Status label and progress bar
set statusw .tf.bar.status
proc selectedline_change {n1 n2 op} {
global selectedline rownumsel
proc selectedline_change {n1 n2 op} {
global selectedline rownumsel
- if {$op eq "unset"} {
+ if {$selectedline eq {}} {
set rownumsel {}
} else {
set rownumsel [expr {$selectedline + 1}]
set rownumsel {}
} else {
set rownumsel [expr {$selectedline + 1}]
set ytop [expr {[lindex $span 0] * $ymax}]
set ybot [expr {[lindex $span 1] * $ymax}]
set yscreen [expr {($ybot - $ytop) / 2}]
set ytop [expr {[lindex $span 0] * $ymax}]
set ybot [expr {[lindex $span 1] * $ymax}]
set yscreen [expr {($ybot - $ytop) / 2}]
- if {[info exists selectedline]} {
+ if {$selectedline ne {}} {
set selid $currentid
set y [yc $selectedline]
if {$ytop < $y && $y < $ybot} {
set selid $currentid
set y [yc $selectedline]
if {$ytop < $y && $y < $ybot} {
lappend boldrows $row
$canv itemconf $linehtag($row) -font $font
lappend boldrows $row
$canv itemconf $linehtag($row) -font $font
- if {[info exists selectedline] && $row == $selectedline} {
+ if {$row == $selectedline} {
$canv delete secsel
set t [eval $canv create rect [$canv bbox $linehtag($row)] \
-outline {{}} -tags secsel \
$canv delete secsel
set t [eval $canv create rect [$canv bbox $linehtag($row)] \
-outline {{}} -tags secsel \
lappend boldnamerows $row
$canv2 itemconf $linentag($row) -font $font
lappend boldnamerows $row
$canv2 itemconf $linentag($row) -font $font
- if {[info exists selectedline] && $row == $selectedline} {
+ if {$row == $selectedline} {
$canv2 delete secsel
set t [eval $canv2 create rect [$canv2 bbox $linentag($row)] \
-outline {{}} -tags secsel \
$canv2 delete secsel
set t [eval $canv2 create rect [$canv2 bbox $linentag($row)] \
-outline {{}} -tags secsel \
global descendent highlight_related iddrawn rhighlights
global selectedline ancestor
global descendent highlight_related iddrawn rhighlights
global selectedline ancestor
- if {![info exists selectedline]} return
+ if {$selectedline eq {}} return
set isbold 0
if {$highlight_related eq [mc "Descendant"] ||
$highlight_related eq [mc "Not descendant"]} {
set isbold 0
if {$highlight_related eq [mc "Descendant"] ||
$highlight_related eq [mc "Not descendant"]} {
proc layoutmore {} {
global commitidx viewcomplete curview
proc layoutmore {} {
global commitidx viewcomplete curview
- global numcommits pending_select selectedline curview
+ global numcommits pending_select curview
global lastscrollset lastscrollrows commitinterest
if {$lastscrollrows < 100 || $viewcomplete($curview) ||
global lastscrollset lastscrollrows commitinterest
if {$lastscrollrows < 100 || $viewcomplete($curview) ||
proc doshowlocalchanges {} {
global curview mainheadid
proc doshowlocalchanges {} {
global curview mainheadid
+ if {$mainheadid eq {}} return
if {[commitinview $mainheadid $curview]} {
dodiffindex
} else {
if {[commitinview $mainheadid $curview]} {
dodiffindex
} else {
global cmitlisted commitinfo rowidlist parentlist
global rowtextx idpos idtags idheads idotherrefs
global linehtag linentag linedtag selectedline
global cmitlisted commitinfo rowidlist parentlist
global rowtextx idpos idtags idheads idotherrefs
global linehtag linentag linedtag selectedline
- global canvxmax boldrows boldnamerows fgcolor nullid nullid2
+ global canvxmax boldrows boldnamerows fgcolor
+ global mainheadid nullid nullid2 circleitem circlecolors
# listed is 0 for boundary, 1 for normal, 2 for negative, 3 for left, 4 for right
set listed $cmitlisted($curview,$id)
# listed is 0 for boundary, 1 for normal, 2 for negative, 3 for left, 4 for right
set listed $cmitlisted($curview,$id)
set ofill red
} elseif {$id eq $nullid2} {
set ofill green
set ofill red
} elseif {$id eq $nullid2} {
set ofill green
+ } elseif {$id eq $mainheadid} {
+ set ofill yellow
} else {
} else {
- set ofill [expr {$listed != 0 ? $listed == 2 ? "gray" : "blue" : "white"}]
+ set ofill [lindex $circlecolors $listed]
}
set x [xc $row $col]
set y [yc $row]
}
set x [xc $row $col]
set y [yc $row]
[expr {$x - $orad}] [expr {$y + $orad - 1}] \
-fill $ofill -outline $fgcolor -width 1 -tags circle]
}
[expr {$x - $orad}] [expr {$y + $orad - 1}] \
-fill $ofill -outline $fgcolor -width 1 -tags circle]
}
+ set circleitem($row) $t
$canv raise $t
$canv bind $t <1> {selcanvline {} %x %y}
set rmx [llength [lindex $rowidlist $row]]
$canv raise $t
$canv bind $t <1> {selcanvline {} %x %y}
set rmx [llength [lindex $rowidlist $row]]
-text $name -font $nfont -tags text]
set linedtag($row) [$canv3 create text 3 $y -anchor w -fill $fgcolor \
-text $date -font mainfont -tags text]
-text $name -font $nfont -tags text]
set linedtag($row) [$canv3 create text 3 $y -anchor w -fill $fgcolor \
-text $date -font mainfont -tags text]
- if {[info exists selectedline] && $selectedline == $row} {
+ if {$selectedline == $row} {
make_secsel $row
}
set xr [expr {$xt + [font measure $font $headline]}]
make_secsel $row
}
set xr [expr {$xt + [font measure $font $headline]}]
if {$endrow >= $vrowmod($curview)} {
update_arcrows $curview
}
if {$endrow >= $vrowmod($curview)} {
update_arcrows $curview
}
- if {[info exists selectedline] &&
+ if {$selectedline ne {} &&
$row <= $selectedline && $selectedline <= $endrow} {
set targetrow $selectedline
} elseif {[info exists targetid]} {
$row <= $selectedline && $selectedline <= $endrow} {
set targetrow $selectedline
} elseif {[info exists targetid]} {
proc clear_display {} {
global iddrawn linesegs need_redisplay nrows_drawn
global vhighlights fhighlights nhighlights rhighlights
proc clear_display {} {
global iddrawn linesegs need_redisplay nrows_drawn
global vhighlights fhighlights nhighlights rhighlights
+ global linehtag linentag linedtag boldrows boldnamerows
allcanvs delete all
catch {unset iddrawn}
catch {unset linesegs}
allcanvs delete all
catch {unset iddrawn}
catch {unset linesegs}
+ catch {unset linehtag}
+ catch {unset linentag}
+ catch {unset linedtag}
+ set boldrows {}
+ set boldnamerows {}
catch {unset vhighlights}
catch {unset fhighlights}
catch {unset nhighlights}
catch {unset vhighlights}
catch {unset fhighlights}
catch {unset nhighlights}
}
focus .
if {$findstring eq {} || $numcommits == 0} return
}
focus .
if {$findstring eq {} || $numcommits == 0} return
- if {![info exists selectedline]} {
+ if {$selectedline eq {}} {
set findstartline [lindex [visiblerows] [expr {$dirn < 0}]]
} else {
set findstartline $selectedline
set findstartline [lindex [visiblerows] [expr {$dirn < 0}]]
} else {
set findstartline $selectedline
[expr {$x0+$xlen+2}] $y1 \
-outline {} -tags [list match$l matches] -fill yellow]
$canv lower $t
[expr {$x0+$xlen+2}] $y1 \
-outline {} -tags [list match$l matches] -fill yellow]
$canv lower $t
- if {[info exists selectedline] && $row == $selectedline} {
+ if {$row == $selectedline} {
$canv raise $t secsel
}
}
$canv raise $t secsel
}
}
proc dispneartags {delay} {
global selectedline currentid showneartags tagphase
proc dispneartags {delay} {
global selectedline currentid showneartags tagphase
- if {![info exists selectedline] || !$showneartags} return
+ if {$selectedline eq {} || !$showneartags} return
after cancel dispnexttag
if {$delay} {
after 200 dispnexttag
after cancel dispnexttag
if {$delay} {
after 200 dispnexttag
proc dispnexttag {} {
global selectedline currentid showneartags tagphase ctext
proc dispnexttag {} {
global selectedline currentid showneartags tagphase ctext
- if {![info exists selectedline] || !$showneartags} return
+ if {$selectedline eq {} || !$showneartags} return
switch -- $tagphase {
0 {
set dtags [desctags $currentid]
switch -- $tagphase {
0 {
set dtags [desctags $currentid]
proc selnextline {dir} {
global selectedline
focus .
proc selnextline {dir} {
global selectedline
focus .
- if {![info exists selectedline]} return
+ if {$selectedline eq {}} return
set l [expr {$selectedline + $dir}]
unmarkmatches
selectline $l 1
set l [expr {$selectedline + $dir}]
unmarkmatches
selectline $l 1
}
allcanvs yview scroll [expr {$dir * $lpp}] units
drawvisible
}
allcanvs yview scroll [expr {$dir * $lpp}] units
drawvisible
- if {![info exists selectedline]} return
+ if {$selectedline eq {}} return
set l [expr {$selectedline + $dir * $lpp}]
if {$l < 0} {
set l 0
set l [expr {$selectedline + $dir * $lpp}]
if {$l < 0} {
set l 0
proc unselectline {} {
global selectedline currentid
proc unselectline {} {
global selectedline currentid
- catch {unset selectedline}
+ set selectedline {}
catch {unset currentid}
allcanvs delete secsel
rhighlight_none
catch {unset currentid}
allcanvs delete secsel
rhighlight_none
proc reselectline {} {
global selectedline
proc reselectline {} {
global selectedline
- if {[info exists selectedline]} {
+ if {$selectedline ne {}} {
selectline $selectedline 0
}
}
selectline $selectedline 0
}
}
setcanvscroll
allcanvs yview moveto [lindex $span 0]
drawvisible
setcanvscroll
allcanvs yview moveto [lindex $span 0]
drawvisible
- if {[info exists selectedline]} {
+ if {$selectedline ne {}} {
selectline $selectedline 0
allcanvs yview moveto [lindex $span 0]
}
selectline $selectedline 0
allcanvs yview moveto [lindex $span 0]
}
stopfinding
set rowmenuid $id
stopfinding
set rowmenuid $id
- if {![info exists selectedline]
- || [rowofcommit $id] eq $selectedline} {
+ if {$selectedline eq {} || [rowofcommit $id] eq $selectedline} {
set state disabled
} else {
set state normal
set state disabled
} else {
set state normal
proc diffvssel {dirn} {
global rowmenuid selectedline
proc diffvssel {dirn} {
global rowmenuid selectedline
- if {![info exists selectedline]} return
+ if {$selectedline eq {}} return
if {$dirn} {
set oldid [commitonrow $selectedline]
set newid $rowmenuid
if {$dirn} {
set oldid [commitonrow $selectedline]
set newid $rowmenuid
}
proc redrawtags {id} {
}
proc redrawtags {id} {
- global canv linehtag idpos currentid curview
- global canvxmax iddrawn
+ global canv linehtag idpos currentid curview cmitlisted
+ global canvxmax iddrawn circleitem mainheadid circlecolors
if {![commitinview $id $curview]} return
if {![info exists iddrawn($id)]} return
set row [rowofcommit $id]
if {![commitinview $id $curview]} return
if {![info exists iddrawn($id)]} return
set row [rowofcommit $id]
+ if {$id eq $mainheadid} {
+ set ofill yellow
+ } else {
+ set ofill [lindex $circlecolors $cmitlisted($curview,$id)]
+ }
+ $canv itemconf $circleitem($row) -fill $ofill
$canv delete tag.$id
set xt [eval drawtags $id $idpos($id)]
$canv coords $linehtag($row) $xt [lindex $idpos($id) 2]
$canv delete tag.$id
set xt [eval drawtags $id $idpos($id)]
$canv coords $linehtag($row) $xt [lindex $idpos($id) 2]
if {$mainhead ne {}} {
movehead $newhead $mainhead
movedhead $newhead $mainhead
if {$mainhead ne {}} {
movehead $newhead $mainhead
movedhead $newhead $mainhead
- set mainheadid $newhead
}
}
+ set mainheadid $newhead
redrawtags $oldhead
redrawtags $newhead
selbyid $newhead
redrawtags $oldhead
redrawtags $newhead
selbyid $newhead
}
proc cobranch {} {
}
proc cobranch {} {
- global headmenuid headmenuhead mainhead headids
+ global headmenuid headmenuhead headids
global showlocalchanges mainheadid
# check the tree is clean first??
global showlocalchanges mainheadid
# check the tree is clean first??
if {[catch {close $fd} err]} {
error_popup $err
}
if {[catch {close $fd} err]} {
error_popup $err
}
- set oldmainhead $mainhead
+ set oldmainid $mainheadid
set mainhead $newhead
set mainheadid $newheadid
set mainhead $newhead
set mainheadid $newheadid
- if {[info exists headids($oldmainhead)]} {
- redrawtags $headids($oldmainhead)
- }
+ redrawtags $oldmainid
redrawtags $newheadid
selbyid $newheadid
if {$showlocalchanges} {
redrawtags $newheadid
selbyid $newheadid
if {$showlocalchanges} {
[array names idheads] [array names idotherrefs]]]
foreach id $refids {
set v [listrefs $id]
[array names idheads] [array names idotherrefs]]]
foreach id $refids {
set v [listrefs $id]
- if {![info exists ref($id)] || $ref($id) != $v ||
- ($id eq $oldmainhead && $id ne $mainheadid) ||
- ($id eq $mainheadid && $id ne $oldmainhead)} {
+ if {![info exists ref($id)] || $ref($id) != $v} {
redrawtags $id
}
}
redrawtags $id
}
}
+ if {$oldmainhead ne $mainheadid} {
+ redrawtags $oldmainhead
+ redrawtags $mainheadid
+ }
run refill_reflist
}
run refill_reflist
}
set ignorespace 0
set selectbgcolor gray85
set ignorespace 0
set selectbgcolor gray85
+set circlecolors {white blue gray blue blue}
+
## For msgcat loading, first locate the installation location.
if { [info exists ::env(GITK_MSGSDIR)] } {
## Msgsdir was manually set in the environment.
## For msgcat loading, first locate the installation location.
if { [info exists ::env(GITK_MSGSDIR)] } {
## Msgsdir was manually set in the environment.
set viewargs(0) {}
set viewargscmd(0) {}
set viewargs(0) {}
set viewargscmd(0) {}
+set selectedline {}
set numcommits 0
set loginstance 0
set cmdlineok 0
set numcommits 0
set loginstance 0
set cmdlineok 0