[PATCH] hgk: Display branch name for each head (issue 740)

Michael Sommerville msommerville at gmail.com
Wed Sep 10 02:09:15 CDT 2008


# HG changeset patch
# User Michael Sommerville <msommerville at gmail.com>
# Date 1220996547 -3600
# Node ID 91864578db8a2b0543f536bfc147198e65d1c48c
# Parent  6651de7176a01c8e93ecfcc4f7f1a2ec5ff02c73
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.

diff -r 6651de7176a0 -r 91864578db8a contrib/hgk
--- a/contrib/hgk	Tue Sep 09 21:32:39 2008 +0200
+++ b/contrib/hgk	Tue Sep 09 22:42:27 2008 +0100
@@ -370,6 +370,25 @@
 	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 drawtags {id x xt y1} {
-    global idtags idheads idotherrefs
+    global idtags idheads idotherrefs commitinfo
     global linespc lthickness
     global canv mainfont idline rowtextx
 
@@ -1057,7 +1076,8 @@
 	set ntags [llength $marks]
     }
     if {[info exists idheads($id)]} {
-	set marks [concat $marks $idheads($id)]
+    set head_mark [lindex $commitinfo($id) 7]
+	set marks [concat $marks $head_mark]
 	set nheads [llength $idheads($id)]
     }
     if {[info exists idotherrefs($id)]} {


More information about the Mercurial-devel mailing list