[PATCH 3 of 9] hgk: add support for phases

Andrew Shadura bugzilla at tut.by
Wed Nov 7 09:15:11 CST 2012


# HG changeset patch
# User Andrew Shadura <bugzilla at tut.by>
# Date 1350418722 -7200
# Node ID 6edb0dadd5c0777f6718666e4017cd1e4cfbb148
# Parent  6e00dd025800b8863a2e5ea56c436485a0911a0b
hgk: add support for phases.

diff --git a/contrib/hgk b/contrib/hgk
--- a/contrib/hgk
+++ b/contrib/hgk
@@ -297,6 +297,7 @@ proc parsecommit {id contents listed old
     set rev {}
     set branch {}
     set bookmark {}
+    set phase {}
     if {![info exists nchildren($id)]} {
 	set children($id) {}
 	set nchildren($id) 0
@@ -337,6 +338,8 @@ proc parsecommit {id contents listed old
 		    set branch [join [lrange $line 1 end]]
         } elseif {$tag == "bookmark"} {
 		    set bookmark [join [lrange $line 1 end]]
+        } elseif {$tag == "phase"} {
+		    set phase [join [lrange $line 1 end]]
         }
 	    }
 	} else {
@@ -361,7 +364,7 @@ proc parsecommit {id contents listed old
 	set comdate [clock format $comdate -format "%Y-%m-%d %H:%M:%S"]
     }
     set commitinfo($id) [list $headline $auname $audate \
-			     $comname $comdate $comment $rev $branch $bookmark]
+			     $comname $comdate $comment $rev $branch $bookmark $phase]
 
     if {[info exists firstparents]} {
         set i [lsearch $firstparents $id]
@@ -2484,6 +2487,9 @@ proc selectline {l isnew} {
 	}
 	$ctext insert end "\n"
     }
+    if {[llength [lindex $info 9]] > 0} {
+        $ctext insert end "Phase: [lindex $info 9]\n"
+    }
 
     set comment {}
     if {[info exists parents($id)]} {
diff --git a/hgext/hgk.py b/hgext/hgk.py
--- a/hgext/hgk.py
+++ b/hgext/hgk.py
@@ -35,7 +35,7 @@ vdiff on hovered and selected revisions.
 '''
 
 import os
-from mercurial import commands, util, patch, revlog, scmutil
+from mercurial import commands, util, patch, revlog, scmutil, phases
 from mercurial.node import nullid, nullrev, short
 from mercurial.i18n import _
 
@@ -113,7 +113,8 @@ def catcommit(ui, repo, n, prefix, ctx=N
     ui.write("author %s %s %s\n" % (ctx.user(), int(date[0]), date[1]))
     ui.write("committer %s %s %s\n" % (committer, int(date[0]), date[1]))
     ui.write("revision %d\n" % ctx.rev())
-    ui.write("branch %s\n\n" % ctx.branch())
+    ui.write("branch %s\n" % ctx.branch())
+    ui.write("phase %s\n\n" % phases.phasenames[ctx.phase()])
 
     if prefix != "":
         ui.write("%s%s\n" % (prefix,


More information about the Mercurial-devel mailing list