hgk: display branch name in diff header
authorPatrick Mezard <pmezard@gmail.com>
Tue, 15 Jan 2008 13:46:32 +0100
changeset 5859 e0f86c1e3ae5
parent 5855 a6ccb957fd07
child 5860 493632bb171c
hgk: display branch name in diff header
contrib/hgk
hgext/hgk.py
--- a/contrib/hgk	Mon Jan 14 09:00:23 2008 +0100
+++ b/contrib/hgk	Tue Jan 15 13:46:32 2008 +0100
@@ -274,6 +274,7 @@
     set comname {}
     set comdate {}
     set rev {}
+    set branch {}
     if {![info exists nchildren($id)]} {
 	set children($id) {}
 	set nchildren($id) 0
@@ -310,6 +311,8 @@
 		    set comname [join [lrange $line 1 [expr {$x - 1}]]]
 		} elseif {$tag == "revision"} {
 		    set rev [lindex $line 1]
+        } elseif {$tag == "branch"} {
+		    set branch [join [lrange $line 1 end]]
 		}
 	    }
 	} else {
@@ -334,7 +337,7 @@
 	set comdate [clock format $comdate -format "%Y-%m-%d %H:%M:%S"]
     }
     set commitinfo($id) [list $headline $auname $audate \
-			     $comname $comdate $comment $rev]
+			     $comname $comdate $comment $rev $branch]
 }
 
 proc readrefs {} {
@@ -2286,6 +2289,9 @@
     $ctext mark gravity fmark.0 left
     set info $commitinfo($id)
     $ctext insert end "Revision: [lindex $info 6]\n"
+    if {[llength [lindex $info 7]] > 0} {
+        $ctext insert end "Branch: [lindex $info 7]\n"
+    }
     $ctext insert end "Author: [lindex $info 1]  [lindex $info 2]\n"
     $ctext insert end "Committer: [lindex $info 3]  [lindex $info 4]\n"
     if {[info exists idtags($id)]} {
--- a/hgext/hgk.py	Mon Jan 14 09:00:23 2008 +0100
+++ b/hgext/hgk.py	Tue Jan 15 13:46:32 2008 +0100
@@ -121,6 +121,7 @@
     print "author %s %s %s" % (ctx.user(), int(date[0]), date[1])
     print "committer %s %s %s" % (committer, int(date[0]), date[1])
     print "revision %d" % ctx.rev()
+    print "branch %s" % ctx.branch()
     print ""
     if prefix != "":
         print "%s%s" % (prefix, description.replace('\n', nlprefix).strip())