changeset 276:f26e9bc5f7fc

obsolete: use new-style command registration
author Patrick Mezard <patrick@mezard.eu>
date Tue, 19 Jun 2012 10:17:02 +0200
parents 336210dada95
children 5d1d7aaf1bc3
files hgext/obsolete.py
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/obsolete.py	Wed Jun 20 15:42:01 2012 +0200
+++ b/hgext/obsolete.py	Tue Jun 19 10:17:02 2012 +0200
@@ -103,6 +103,7 @@
 from mercurial.node import hex, bin, short, nullid
 from mercurial.lock import release
 from mercurial import localrepo
+from mercurial import cmdutil
 
 try:
     from mercurial.localrepo import storecache
@@ -392,7 +393,10 @@
 ### New commands
 #############################
 
+cmdtable = {}
+command = cmdutil.command(cmdtable)
 
+@command('debugobsolete', [], _('SUBJECT OBJECT'))
 def cmddebugobsolete(ui, repo, subject, object):
     """Add an obsolete relation between a too node
 
@@ -406,6 +410,7 @@
         lock.release()
     return 0
 
+@command('debugconvertobsolete', [], '')
 def cmddebugconvertobsolete(ui, repo):
     cnt = 0
     l = repo.lock()
@@ -440,6 +445,7 @@
         l.release()
     ui.status('%i obsolete marker converted\n' % cnt)
 
+@command('debugsuccessors', [], '')
 def cmddebugsuccessors(ui, repo):
     """dump obsolete changesets and their successors
 
@@ -459,11 +465,6 @@
     finally:
         lock.release()
 
-cmdtable = {'debugobsolete': (cmddebugobsolete, [], '<subject> <object>'),
-            'debugconvertobsolete': (cmddebugconvertobsolete, [], ''),
-            'debugsuccessors': (cmddebugsuccessors, [], ''),
-           }
-
 ### Altering existing command
 #############################