[PATCH] gitk: Add a visual tag for remote refs
This patch partly changes the background color for remote refs. It makes it easy to quickly distinguish remote refs from local developer branches. I ignore remote HEADs, as these really should be drawn as aliases to other heads. But there is no simple way to detect that HEADs really are aliases for other refs via "git-ls-remote". Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de> Signed-off-by: Paul Mackerras <paulus@samba.org>
Josef Weidendorfer committed
Apr 18, 2006 at 23:53 UTC
a970fcf249534ca21ad721b289402c135722a24c
1 file changed
+14
gitk
+14
@@ -274,10 +274,16 @@ proc readrefs {} {
274
match id path]} {
275
continue
276
}
277
+ if {[regexp {^remotes/.*/HEAD$} $path match]} {
278
+ continue
279
+ }
280
if {![regexp {^(tags|heads)/(.*)$} $path match type name]} {
281
set type others
282
set name $path
283
}
284
+ if {[regexp {^remotes/} $path match]} {
285
+ set type heads
286
+ }
287
if {$type == "tags"} {
288
set tagids($name) $id
289
lappend idtags($id) $name
@@ -1702,6 +1708,14 @@ proc drawtags {id x xt y1} {
1708
set xl [expr {$xl - $delta/2}]
1709
$canv create polygon $x $yt $xr $yt $xr $yb $x $yb \
1710
-width 1 -outline black -fill $col -tags tag.$id
1711
+ if {[regexp {^(remotes/.*/|remotes/)} $tag match remoteprefix]} {
1712
+ set rwid [font measure $mainfont $remoteprefix]
1713
+ set xi [expr {$x + 1}]
1714
+ set yti [expr {$yt + 1}]
1715
+ set xri [expr {$x + $rwid}]
1716
+ $canv create polygon $xi $yti $xri $yti $xri $yb $xi $yb \
1717
+ -width 0 -fill "#ffddaa" -tags tag.$id
1718
+ }
1719
}
1720
set t [$canv create text $xl $y1 -anchor w -text $tag \
1721
-font $mainfont -tags tag.$id]