# HG changeset patch # User Michael Sommerville # Date 2008-09-15 22:39:11 # Node ID aafe12bd7174141f0c4c04cfb3ec146249cdbbd4 # Parent 0d513661d6c280fae68a96aea16231702959bfb6 hgk: Display branch name for each head (issue 740) In the graphical view, each head is decorated with an additonal tag containing the branch name, if that head is not on the default branch. diff --git a/contrib/hgk b/contrib/hgk --- a/contrib/hgk +++ b/contrib/hgk @@ -370,6 +370,25 @@ proc readrefs {} { lappend tagids($direct) $tag lappend idtags($tag) $direct } + + set status [catch {exec $env(HG) --config ui.report_untrusted=false heads} heads] + if { $status != 0 } { + puts $::errorInfo + if { ![string equal $::errorCode NONE] } { + exit 2 + } + } + regsub -all "\r\n" $heads "\n" heads + + set lines [split $heads "\n"] + foreach f $lines { + set match "" + regexp {changeset:\s+(\S+):(\S+)$} $f match id sha + if {$match != ""} { + lappend idheads($sha) $id + } + } + } proc readotherrefs {base dname excl} { @@ -1045,7 +1064,7 @@ proc drawcommitline {level} { } proc drawtags {id x xt y1} { - global idtags idheads idotherrefs + global idtags idheads idotherrefs commitinfo global linespc lthickness global canv mainfont idline rowtextx @@ -1057,8 +1076,11 @@ proc drawtags {id x xt y1} { set ntags [llength $marks] } if {[info exists idheads($id)]} { - set marks [concat $marks $idheads($id)] - set nheads [llength $idheads($id)] + set headmark [lindex $commitinfo($id) 7] + if {$headmark ne "default"} { + lappend marks $headmark + set nheads 1 + } } if {[info exists idotherrefs($id)]} { set marks [concat $marks $idotherrefs($id)]