evolve: adapt for changed @command decorator
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 18 Oct 2018 22:11:43 -0700
changeset 4184 b9e0cc531b2b
parent 4183 536c67823962
child 4185 9bce7e6c18b3
evolve: adapt for changed @command decorator Core changed the hacky "^command" syntax to be a proper decorator option in fa88170c10bb (help: adding a proper declaration for shortlist/basic commands (API), 2018-10-12). This patch makes evolve compatible with that.
hgext3rd/evolve/__init__.py
hgext3rd/evolve/cmdrewrite.py
hgext3rd/evolve/evolvecmd.py
hgext3rd/evolve/exthelper.py
hgext3rd/evolve/rewind.py
--- a/hgext3rd/evolve/__init__.py	Wed Oct 17 23:10:30 2018 +0800
+++ b/hgext3rd/evolve/__init__.py	Thu Oct 18 22:11:43 2018 -0700
@@ -1043,14 +1043,15 @@
     return target, bookmark
 
 @eh.command(
-    '^previous',
+    'previous',
     [('B', 'move-bookmark', False,
         _('move active bookmark after update')),
      ('m', 'merge', False, _('bring uncommitted change along')),
      ('', 'no-topic', False, _('ignore topic and move topologically')),
      ('n', 'dry-run', False,
         _('do not perform actions, just print what would be done'))],
-    '[OPTION]...')
+    '[OPTION]...',
+    helpbasic=True)
 def cmdprevious(ui, repo, **opts):
     """update to parent revision
 
@@ -1104,7 +1105,7 @@
         lockmod.release(wlock)
 
 @eh.command(
-    '^next',
+    'next',
     [('B', 'move-bookmark', False,
         _('move active bookmark after update')),
      ('m', 'merge', False, _('bring uncommitted change along')),
@@ -1112,7 +1113,8 @@
      ('', 'no-topic', False, _('ignore topic and move topologically')),
      ('n', 'dry-run', False,
       _('do not perform actions, just print what would be done'))],
-    '[OPTION]...')
+    '[OPTION]...',
+    helpbasic=True)
 def cmdnext(ui, repo, **opts):
     """update to next child revision
 
--- a/hgext3rd/evolve/cmdrewrite.py	Wed Oct 17 23:10:30 2018 +0800
+++ b/hgext3rd/evolve/cmdrewrite.py	Thu Oct 18 22:11:43 2018 -0700
@@ -95,7 +95,7 @@
 interactiveopt = [['i', 'interactive', None, _('use interactive mode')]]
 
 @eh.command(
-    '^amend|refresh',
+    'amend|refresh',
     [('A', 'addremove', None,
       _('mark new/missing files as added/removed before committing')),
      ('a', 'all', False, _("match all files")),
@@ -107,7 +107,8 @@
      ('s', 'secret', None, _('use the secret phase for committing')),
      ('n', 'note', '', _('store a note on amend'), _('TEXT')),
     ] + walkopts + commitopts + commitopts2 + commitopts3 + interactiveopt,
-    _('[OPTION]... [FILE]...'))
+    _('[OPTION]... [FILE]...'),
+    helpbasic=True)
 def amend(ui, repo, *pats, **opts):
     """combine a changeset with updates and replace it with a new one
 
@@ -660,13 +661,14 @@
     return newcm
 
 @eh.command(
-    '^fold|squash',
+    'fold|squash',
     [('r', 'rev', [], _("revision to fold"), _('REV')),
      ('', 'exact', None, _("only fold specified revisions")),
      ('', 'from', None, _("fold revisions linearly to working copy parent")),
      ('n', 'note', '', _('store a note on fold'), _('TEXT')),
     ] + commitopts + commitopts2 + commitopts3,
-    _('hg fold [OPTION]... [-r] REV'))
+    _('hg fold [OPTION]... [-r] REV'),
+    helpbasic=True)
 def fold(ui, repo, *revs, **opts):
     """fold multiple revisions into a single one
 
@@ -937,7 +939,7 @@
     return metadata
 
 @eh.command(
-    '^prune|obsolete',
+    'prune|obsolete',
     [('n', 'new', [], _("successor changeset (DEPRECATED)")),
      ('s', 'succ', [], _("successor changeset"), _('REV')),
      ('r', 'rev', [], _("revisions to prune"), _('REV')),
@@ -952,7 +954,8 @@
       _("record a split (on precursor, multiple successors)")),
      ('B', 'bookmark', [], _("remove revs only reachable from given"
                              " bookmark"), _('BOOKMARK'))] + metadataopts,
-    _('[OPTION] [-r] REV...'))
+    _('[OPTION] [-r] REV...'),
+    helpbasic=True)
 # XXX -U  --noupdate option to prevent wc update and or bookmarks update ?
 def cmdprune(ui, repo, *revs, **opts):
     """mark changesets as obsolete or succeeded by another changeset
@@ -1128,11 +1131,12 @@
         lockmod.release(tr, lock, wlock)
 
 @eh.command(
-    '^split',
+    'split',
     [('r', 'rev', [], _("revision to split"), _('REV')),
      ('n', 'note', '', _("store a note on split"), _('TEXT')),
     ] + commitopts + commitopts2 + commitopts3,
-    _('hg split [OPTION]... [-r] REV'))
+    _('hg split [OPTION]... [-r] REV'),
+    helpbasic=True)
 def cmdsplit(ui, repo, *revs, **opts):
     """split a changeset into smaller changesets
 
--- a/hgext3rd/evolve/evolvecmd.py	Wed Oct 17 23:10:30 2018 +0800
+++ b/hgext3rd/evolve/evolvecmd.py	Thu Oct 18 22:11:43 2018 -0700
@@ -1332,7 +1332,7 @@
     return divergence
 
 @eh.command(
-    '^evolve|stabilize|solve',
+    'evolve|stabilize|solve',
     [('n', 'dry-run', False,
       _('do not perform actions, just print what would be done')),
      ('', 'confirm', False,
@@ -1356,7 +1356,8 @@
      ('l', 'list', False, _('provide details on troubled changesets'
                             ' in the repo')),
     ] + mergetoolopts,
-    _('[OPTIONS]...')
+    _('[OPTIONS]...'),
+    helpbasic=True
 )
 def evolve(ui, repo, **opts):
     """solve troubled changesets in your repository
--- a/hgext3rd/evolve/exthelper.py	Wed Oct 17 23:10:30 2018 +0800
+++ b/hgext3rd/evolve/exthelper.py	Thu Oct 18 22:11:43 2018 -0700
@@ -39,6 +39,14 @@
         self._duckpunchers = []
         self.cmdtable = {}
         self.command = registrar.command(self.cmdtable)
+        if '^init' in commands.table:
+            olddoregister = self.command._doregister
+
+            def _newdoregister(self, name, *args, **kwargs):
+                if kwargs.pop('helpbasic', False):
+                    name = '^' + name
+                return olddoregister(self, name, *args, **kwargs)
+            self.command._doregister = _newdoregister
 
         self.configtable = {}
         self._configitem = None
--- a/hgext3rd/evolve/rewind.py	Wed Oct 17 23:10:30 2018 +0800
+++ b/hgext3rd/evolve/rewind.py	Thu Oct 18 22:11:43 2018 -0700
@@ -26,14 +26,15 @@
 identicalflag = 4
 
 @eh.command(
-    '^rewind|undo',
+    'rewind|undo',
     [('', 'to', [], _("rewind to these revisions"), _('REV')),
      ('', 'as-divergence', None, _("preserve current latest successors")),
      ('', 'exact', None, _("only rewind explicitly selected revisions")),
      ('', 'from', [],
       _("rewind these revisions to their predecessors"), _('REV')),
     ],
-    _(''))
+    _(''),
+    helpbasic=True)
 def rewind(ui, repo, **opts):
     """rewind a stack of changesets to a previous state