changeset 309:de21685d22d1

evolve: warn when latecomer changeset are created
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Tue, 26 Jun 2012 11:29:51 +0200
parents 23ef1c71d164
children 2d0dc5c18489
files hgext/evolve.py tests/test-evolve.t
diffstat 2 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Mon Jun 25 15:18:47 2012 +0200
+++ b/hgext/evolve.py	Tue Jun 26 11:29:51 2012 +0200
@@ -33,19 +33,23 @@
     return map(repo.changelog.node,
                scmutil.revrange(repo, revsets))
 
-def warnunstable(orig, ui, repo, *args, **kwargs):
+def warnobserrors(orig, ui, repo, *args, **kwargs):
     """display warning is the command resulted in more instable changeset"""
     priorunstables = len(repo.revs('unstable()'))
+    priorlatecomers = len(repo.revs('latecomer()'))
     #print orig, priorunstables
     #print len(repo.revs('secret() - obsolete()'))
     try:
         return orig(ui, repo, *args, **kwargs)
     finally:
         newunstables = len(repo.revs('unstable()')) - priorunstables
+        newlatecomers = len(repo.revs('latecomer()')) - priorlatecomers
         #print orig, newunstables
         #print len(repo.revs('secret() - obsolete()'))
         if newunstables > 0:
             ui.warn(_('%i new unstables changesets\n') % newunstables)
+        if newlatecomers > 0:
+            ui.warn(_('%i new latecomers changesets\n') % newlatecomers)
 
 ### changeset rewriting logic
 #############################
@@ -530,10 +534,10 @@
                      _("make graft obsoletes its source")))
 
     # warning about more obsolete
-    for cmd in ['commit', 'push', 'pull', 'graft']:
-        entry = extensions.wrapcommand(commands.table, cmd, warnunstable)
+    for cmd in ['commit', 'push', 'pull', 'graft', 'phase', 'unbundle']:
+        entry = extensions.wrapcommand(commands.table, cmd, warnobserrors)
     for cmd in ['kill', 'amend']:
-        entry = extensions.wrapcommand(cmdtable, cmd, warnunstable)
+        entry = extensions.wrapcommand(cmdtable, cmd, warnobserrors)
 
     if rebase is not None:
-        entry = extensions.wrapcommand(rebase.cmdtable, 'rebase', warnunstable)
+        entry = extensions.wrapcommand(rebase.cmdtable, 'rebase', warnobserrors)
--- a/tests/test-evolve.t	Mon Jun 25 15:18:47 2012 +0200
+++ b/tests/test-evolve.t	Tue Jun 26 11:29:51 2012 +0200
@@ -257,6 +257,12 @@
   8	feature-B: another feature that rox - test
   6	feature-A: a nifty feature - test
   0	: base - test
+
+phase change turning obsolete changeset public issue a latecomer warning
+
+  $ hg phase --public 7
+  1 new latecomers changesets
+
   $ cd ..
 
 enable general delta