[PATCH 2 of 2 phases] phases: add phase data to summary

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Jan 17 14:02:40 CST 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1326830266 -3600
# Node ID 39932706a868a495d170abaf530e8024c9f6ced6
# Parent  d30248fe9cd42e98e6fdaad1bd2cd50513790c03
phases: add phase data to summary

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5339,6 +5339,13 @@
           ui.write(' ' + m, label='log.bookmark')
         ui.write('\n', label='log.bookmark')
 
+    targetphase = repo.ui.configint('phases', 'new-commit', phases.draft)
+    for p in parents:
+        targetphase = max(targetphase, p.phase())
+    if phases.secret <= targetphase:
+        phase = phases.phasenames[targetphase]
+        ui.write(_('phase: %s\n') % phase, label='log.phase')
+
     st = list(repo.status(unknown=True))[:6]
 
     c = repo.dirstate.copies()
diff --git a/tests/test-phases.t b/tests/test-phases.t
--- a/tests/test-phases.t
+++ b/tests/test-phases.t
@@ -88,6 +88,16 @@
   1 0 B
   0 0 A
 
+And advertised by summary
+
+  $ hg summary
+  parent: 7:17a481b3bccb tip
+   merge B' and E
+  branch: default
+  phase: secret
+  commit: (clean)
+  update: 1 new changesets, 2 branch heads (merge)
+
 Test secret changeset are not pushed
 
   $ hg init ../push-dest


More information about the Mercurial-devel mailing list