evolve: register a summary hook instead of wrapping the summary command
authorSimon Heimberg <simohe@besonet.ch>
Fri, 07 Feb 2014 09:36:42 +0100
changeset 788 e973dd5bf583
parent 787 a9277d11db47
child 789 0d2bb0282e78
evolve: register a summary hook instead of wrapping the summary command
hgext/evolve.py
--- a/hgext/evolve.py	Wed Jan 22 14:30:45 2014 -0800
+++ b/hgext/evolve.py	Fri Feb 07 09:36:42 2014 +0100
@@ -621,8 +621,7 @@
             return result
     repo.__class__ = evolvingrepo
 
-@eh.wrapcommand("summary")
-def obssummary(orig, ui, repo, *args, **kwargs):
+def summaryhook(ui, repo):
     def write(fmt, count):
         s = fmt % count
         if count:
@@ -630,14 +629,16 @@
         else:
             ui.note(s)
 
-    ret = orig(ui, repo, *args, **kwargs)
     nbunstable = len(getrevs(repo, 'unstable'))
     nbbumped = len(getrevs(repo, 'bumped'))
     nbdivergent = len(getrevs(repo, 'divergent'))
     write('unstable: %i changesets\n', nbunstable)
     write('bumped: %i changesets\n', nbbumped)
     write('divergent: %i changesets\n', nbdivergent)
-    return ret
+
+@eh.extsetup
+def obssummarysetup(ui):
+    cmdutil.summaryhooks.add('evolve', summaryhook)
 
 
 #####################################################################