changeset 14308:e7ea3e38fea8

transplant: use cmdutil.command decorator
author Adrian Buehlmann <adrian@cadifra.com>
date Thu, 12 May 2011 17:50:07 +0200
parents d5a65e3ee6b1
children 37e80214badf
files hgext/transplant.py
diffstat 1 files changed, 17 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/transplant.py	Thu May 12 18:06:15 2011 +0800
+++ b/hgext/transplant.py	Thu May 12 17:50:07 2011 +0200
@@ -19,6 +19,9 @@
 from mercurial import patch, revlog, scmutil, util, error
 from mercurial import revset, templatekw
 
+cmdtable = {}
+command = cmdutil.command(cmdtable)
+
 class transplantentry(object):
     def __init__(self, lnode, rnode):
         self.lnode = lnode
@@ -450,6 +453,20 @@
     displayer.close()
     return (transplants, merges)
 
+@command('transplant',
+    [('s', 'source', '', _('pull patches from REPO'), _('REPO')),
+    ('b', 'branch', [],
+     _('pull patches from branch BRANCH'), _('BRANCH')),
+    ('a', 'all', None, _('pull all changesets up to BRANCH')),
+    ('p', 'prune', [], _('skip over REV'), _('REV')),
+    ('m', 'merge', [], _('merge at REV'), _('REV')),
+    ('', 'log', None, _('append transplant info to log message')),
+    ('c', 'continue', None, _('continue last transplant session '
+                              'after repair')),
+    ('', 'filter', '',
+     _('filter changesets through command'), _('CMD'))],
+    _('hg transplant [-s REPO] [-b BRANCH [-a]] [-p REV] '
+      '[-m REV] [REV]...'))
 def transplant(ui, repo, *revs, **opts):
     '''transplant changesets from another branch
 
@@ -611,26 +628,5 @@
     revset.symbols['transplanted'] = revsettransplanted
     templatekw.keywords['transplanted'] = kwtransplanted
 
-cmdtable = {
-    "transplant":
-        (transplant,
-         [('s', 'source', '',
-           _('pull patches from REPO'), _('REPO')),
-          ('b', 'branch', [],
-           _('pull patches from branch BRANCH'), _('BRANCH')),
-          ('a', 'all', None, _('pull all changesets up to BRANCH')),
-          ('p', 'prune', [],
-           _('skip over REV'), _('REV')),
-          ('m', 'merge', [],
-           _('merge at REV'), _('REV')),
-          ('', 'log', None, _('append transplant info to log message')),
-          ('c', 'continue', None, _('continue last transplant session '
-                                    'after repair')),
-          ('', 'filter', '',
-           _('filter changesets through command'), _('CMD'))],
-         _('hg transplant [-s REPO] [-b BRANCH [-a]] [-p REV] '
-           '[-m REV] [REV]...'))
-}
-
 # tell hggettext to extract docstrings from these functions:
 i18nfunctions = [revsettransplanted, kwtransplanted]