diff hgext/evolve.py @ 356:56d4c6207ef9 stable

Move obserror warning into the obsolete extension.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Wed, 11 Jul 2012 13:59:02 +0200
parents 72642a6970e0
children 88cee22c89f1
line wrap: on
line diff
--- a/hgext/evolve.py	Wed Jul 11 13:38:48 2012 +0200
+++ b/hgext/evolve.py	Wed Jul 11 13:59:02 2012 +0200
@@ -33,28 +33,6 @@
     return map(repo.changelog.node,
                scmutil.revrange(repo, revsets))
 
-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()'))
-    priorconflictings = len(repo.revs('conflicting()'))
-    #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
-        newconflictings = len(repo.revs('conflicting()')) - priorconflictings
-        #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)
-        if newconflictings > 0:
-            ui.warn(_('%i new conflictings changesets\n') % newconflictings)
-
 ### changeset rewriting logic
 #############################
 
@@ -681,6 +659,10 @@
         rebase = None
         raise error.Abort(_('evolution extension require rebase extension.'))
 
+    for cmd in ['amend', 'kill', 'uncommit']:
+        entry = extensions.wrapcommand(cmdtable, cmd,
+                                       obsolete.warnobserrors)
+
     entry = extensions.wrapcommand(commands.table, 'commit', commitwrapper)
     entry[1].append(('o', 'obsolete', [],
                      _("make commit obsolete this revision")))
@@ -690,11 +672,3 @@
     entry[1].append(('O', 'old-obsolete', False,
                      _("make graft obsoletes its source")))
 
-    # warning about more obsolete
-    for cmd in ['commit', 'push', 'pull', 'graft', 'phase', 'unbundle']:
-        entry = extensions.wrapcommand(commands.table, cmd, warnobserrors)
-    for cmd in ['amend', 'kill', 'uncommit']:
-        entry = extensions.wrapcommand(cmdtable, cmd, warnobserrors)
-
-    if rebase is not None:
-        entry = extensions.wrapcommand(rebase.cmdtable, 'rebase', warnobserrors)