[PATCH 4 of 9] hgk: add support for phases
Andrew Shadura
bugzilla at tut.by
Wed Nov 7 14:06:46 CST 2012
# HG changeset patch
# User Andrew Shadura <bugzilla at tut.by>
# Date 1350418722 -7200
# Node ID 3ef4e94b6ebfebbcf6fd6c295304642777f462c3
# Parent 70544da3af3dc6619a34b309e3b944a4c4825125
hgk: add support for phases.
Add support for phases. Update tests.
diff --git a/contrib/hgk b/contrib/hgk
--- a/contrib/hgk
+++ b/contrib/hgk
@@ -330,6 +330,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
@@ -370,6 +371,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 {
@@ -394,7 +397,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]
@@ -2501,6 +2504,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,
diff --git a/tests/test-hgk.t b/tests/test-hgk.t
--- a/tests/test-hgk.t
+++ b/tests/test-hgk.t
@@ -14,6 +14,7 @@ Minimal hgk check
committer test 0 0
revision 0
branch default
+ phase draft
adda
More information about the Mercurial-devel
mailing list