evolve: adapt for changed @command decorator stable
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 18 Oct 2018 22:11:43 -0700
branchstable
changeset 4191 5c734be63c3e
parent 4190 883e75e0a810
child 4192 e527df0f2a68
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.
CHANGELOG
hgext3rd/evolve/__init__.py
hgext3rd/evolve/cmdrewrite.py
hgext3rd/evolve/evolvecmd.py
hgext3rd/evolve/exthelper.py
hgext3rd/evolve/rewind.py
--- a/CHANGELOG	Wed Oct 17 14:47:38 2018 +0200
+++ b/CHANGELOG	Thu Oct 18 22:11:43 2018 -0700
@@ -1,15 +1,13 @@
 Changelog
 =========
 
-8.4.0 - in progress
--------------------
-
-  * use "new" unstabilities vocabulary in help
 
 8.3.1 - in progress
 -------------------
 
   * evolve+topic: fix possible crash during content-divergence evolution
+  * use "new" unstabilities vocabulary in help
+  * compat: compat with coming 4.8 release
 
 8.3.0 -- 2018-10-12
 -------------------
--- a/hgext3rd/evolve/__init__.py	Wed Oct 17 14:47:38 2018 +0200
+++ 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 14:47:38 2018 +0200
+++ 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')),
     ] + 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")),
      ('', 'exact', None, _("only fold specified revisions")),
      ('', 'from', None, _("fold revisions linearly to working copy parent")),
      ('n', 'note', '', _('store a note on fold')),
     ] + 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")),
      ('r', 'rev', [], _("revisions to prune")),
@@ -952,7 +954,8 @@
       _("record a split (on precursor, multiple successors)")),
      ('B', 'bookmark', [], _("remove revs only reachable from given"
                              " 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")),
      ('n', 'note', '', _("store a note on split")),
     ] + 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 14:47:38 2018 +0200
+++ 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 14:47:38 2018 +0200
+++ 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 14:47:38 2018 +0200
+++ b/hgext3rd/evolve/rewind.py	Thu Oct 18 22:11:43 2018 -0700
@@ -26,13 +26,14 @@
 identicalflag = 4
 
 @eh.command(
-    '^rewind|undo',
+    'rewind|undo',
     [('', 'to', [], _("rewind to these revisions")),
      ('', 'as-divergence', None, _("preserve current latest successors")),
      ('', 'exact', None, _("only rewind explicitly selected revisions")),
      ('', 'from', [], _("rewind these revisions to their predecessors")),
     ],
-    _(''))
+    _(''),
+    helpbasic=True)
 def rewind(ui, repo, **opts):
     """rewind a stack of changesets to a previous state