changeset 6308:1d5cb87fbce9

evolve: drop helpcategory 4.7 compat, use helpcategory keyword directly
author Anton Shestakov <av6@dwimlabs.net>
date Sun, 09 Oct 2022 08:11:06 +0400
parents 554edfc7c55a
children f7d1a14fd6a4
files hgext3rd/evolve/__init__.py hgext3rd/evolve/cmdrewrite.py hgext3rd/evolve/compat.py hgext3rd/evolve/evolvecmd.py hgext3rd/evolve/exthelper.py hgext3rd/evolve/obshistory.py hgext3rd/evolve/rewind.py
diffstat 7 files changed, 33 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py	Thu Aug 11 10:39:34 2022 +0400
+++ b/hgext3rd/evolve/__init__.py	Sun Oct 09 08:11:06 2022 +0400
@@ -298,6 +298,7 @@
     node as nodemod,
     obsolete,
     pycompat,
+    registrar,
     util,
 )
 
@@ -458,7 +459,7 @@
     pstatusopts = [o for o in statuscmd[1] if o[1] not in inapplicable]
 
     @eh.command(b'pstatus', pstatusopts,
-                **compat.helpcategorykwargs('CATEGORY_WORKING_DIRECTORY'))
+                helpcategory=registrar.command.CATEGORY_WORKING_DIRECTORY)
     def pstatus(ui, repo, *args, **kwargs):
         """show status combining committed and uncommitted changes
 
@@ -475,7 +476,7 @@
     pdiffopts = [o for o in diffcmd[1] if o[1] not in inapplicable]
 
     @eh.command(b'pdiff', pdiffopts,
-                **compat.helpcategorykwargs('CATEGORY_WORKING_DIRECTORY'))
+                helpcategory=registrar.command.CATEGORY_WORKING_DIRECTORY)
     def pdiff(ui, repo, *args, **kwargs):
         """show diff combining committed and uncommitted changes
 
@@ -766,8 +767,9 @@
      (b'n', b'dry-run', False,
         _(b'do not perform actions, just print what would be done'))],
     b'[OPTION]...',
+    helpcategory=registrar.command.CATEGORY_WORKING_DIRECTORY,
     helpbasic=True,
-    **compat.helpcategorykwargs('CATEGORY_WORKING_DIRECTORY'))
+)
 def cmdprevious(ui, repo, **opts):
     """update to parent revision
 
@@ -827,8 +829,9 @@
       _(b'do not perform actions, just print what would be done')),
      (b'', b'abort', False, _(b'abort the interrupted next'))],
     b'[OPTION]...',
+    helpcategory=registrar.command.CATEGORY_WORKING_DIRECTORY,
     helpbasic=True,
-    **compat.helpcategorykwargs('CATEGORY_WORKING_DIRECTORY'))
+)
 def cmdnext(ui, repo, **opts):
     """update to next child revision
 
--- a/hgext3rd/evolve/cmdrewrite.py	Thu Aug 11 10:39:34 2022 +0400
+++ b/hgext3rd/evolve/cmdrewrite.py	Sun Oct 09 08:11:06 2022 +0400
@@ -28,6 +28,7 @@
     patch,
     phases,
     pycompat,
+    registrar,
     scmutil,
     util,
     repair,
@@ -104,8 +105,9 @@
      (b'n', b'note', b'', _(b'store a note on amend'), _(b'TEXT')),
      ] + walkopts + commitopts + commitopts2 + commitopts3 + interactiveopt,
     _(b'[OPTION]... [FILE]...'),
+    helpcategory=registrar.command.CATEGORY_COMMITTING,
     helpbasic=True,
-    **compat.helpcategorykwargs('CATEGORY_COMMITTING'))
+)
 def amend(ui, repo, *pats, **opts):
     """combine a changeset with updates and replace it with a new one
 
@@ -351,7 +353,8 @@
      (b'n', b'note', b'', _(b'store a note on uncommit'), _(b'TEXT')),
      ] + commands.walkopts + commitopts + commitopts2 + commitopts3,
     _(b'[OPTION]... [FILE]...'),
-    **compat.helpcategorykwargs('CATEGORY_CHANGE_MANAGEMENT'))
+    helpcategory=registrar.command.CATEGORY_CHANGE_MANAGEMENT,
+)
 def uncommit(ui, repo, *pats, **opts):
     """move changes from parent revision to working directory
 
@@ -587,8 +590,9 @@
      (b'n', b'note', b'', _(b'store a note on fold'), _(b'TEXT')),
      ] + commitopts + commitopts2 + commitopts3,
     _(b'hg fold [OPTION]... [-r] REV...'),
+    helpcategory=registrar.command.CATEGORY_CHANGE_MANAGEMENT,
     helpbasic=True,
-    **compat.helpcategorykwargs('CATEGORY_CHANGE_MANAGEMENT'))
+)
 def fold(ui, repo, *revs, **opts):
     """fold multiple revisions into a single one
 
@@ -716,7 +720,8 @@
      (b'n', b'note', b'', _(b'store a note on metaedit'), _(b'TEXT')),
      ] + commitopts + commitopts2 + commitopts3,
     _(b'hg metaedit [OPTION]... [[-r] REV]...'),
-    **compat.helpcategorykwargs('CATEGORY_CHANGE_MANAGEMENT'))
+    helpcategory=registrar.command.CATEGORY_CHANGE_MANAGEMENT,
+)
 def metaedit(ui, repo, *revs, **opts):
     """edit commit information
 
@@ -871,8 +876,9 @@
      (b'B', b'bookmark', [], _(b"remove revs only reachable from given"
                                b" bookmark"), _(b'BOOKMARK'))] + metadataopts,
     _(b'[OPTION]... [-r] REV...'),
+    helpcategory=registrar.command.CATEGORY_CHANGE_MANAGEMENT,
     helpbasic=True,
-    **compat.helpcategorykwargs('CATEGORY_CHANGE_MANAGEMENT'))
+)
 # 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
@@ -1068,8 +1074,9 @@
      (b'n', b'note', b'', _(b"store a note on split"), _(b'TEXT')),
      ] + commitopts + commitopts2 + commitopts3,
     _(b'hg split [OPTION]... [-r REV] [FILE]...'),
+    helpcategory=registrar.command.CATEGORY_CHANGE_MANAGEMENT,
     helpbasic=True,
-    **compat.helpcategorykwargs('CATEGORY_CHANGE_MANAGEMENT'))
+)
 def cmdsplit(ui, repo, *pats, **opts):
     """split a changeset into smaller changesets
 
@@ -1252,7 +1259,8 @@
       b'divergence')],
     # allow to choose the seed ?
     _(b'[OPTION]... [-r] REV...'),
-    **compat.helpcategorykwargs('CATEGORY_CHANGE_MANAGEMENT'))
+    helpcategory=registrar.command.CATEGORY_CHANGE_MANAGEMENT,
+)
 def touch(ui, repo, *revs, **opts):
     """create successors identical to their predecessors but the changeset ID
 
@@ -1333,7 +1341,8 @@
      (b'a', b'abort', False, b'abort interrupted pick'),
      ] + mergetoolopts,
     _(b'[OPTION]... [-r] REV'),
-    **compat.helpcategorykwargs('CATEGORY_CHANGE_MANAGEMENT'))
+    helpcategory=registrar.command.CATEGORY_CHANGE_MANAGEMENT,
+)
 def cmdpick(ui, repo, *revs, **opts):
     """move a commit onto the working directory parent and update to it.
 
@@ -1458,8 +1467,8 @@
         (b'', b'abort', False, _(b'abort an interrupted fixup')),
     ],
     _(b'[OPTION]... [-r] REV'),
+    helpcategory=registrar.command.CATEGORY_COMMITTING,
     helpbasic=True,
-    **compat.helpcategorykwargs('CATEGORY_COMMITTING')
 )
 def fixup(ui, repo, node=None, **opts):
     """add working directory changes to an arbitrary revision
--- a/hgext3rd/evolve/compat.py	Thu Aug 11 10:39:34 2022 +0400
+++ b/hgext3rd/evolve/compat.py	Sun Oct 09 08:11:06 2022 +0400
@@ -21,7 +21,6 @@
     node,
     obsolete,
     pycompat,
-    registrar,
     scmutil,
     util,
 )
@@ -337,15 +336,6 @@
 if not fixupstreamed:
     copiesmod._fullcopytracing = fixedcopytracing
 
-# help category compatibility
-# hg <= 4.7 (c303d65d2e34)
-def helpcategorykwargs(categoryname):
-    """Backwards-compatible specification of the helpategory argument."""
-    category = getattr(registrar.command, categoryname, None)
-    if not category:
-        return {}
-    return {'helpcategory': category}
-
 # nodemap.get and index.[has_node|rev|get_rev]
 # hg <= 5.2 (02802fa87b74)
 def getgetrev(cl):
--- a/hgext3rd/evolve/evolvecmd.py	Thu Aug 11 10:39:34 2022 +0400
+++ b/hgext3rd/evolve/evolvecmd.py	Sun Oct 09 08:11:06 2022 +0400
@@ -26,6 +26,7 @@
     obsutil,
     phases,
     pycompat,
+    registrar,
     repair,
     scmutil,
     simplemerge,
@@ -1534,8 +1535,8 @@
                               b' in the repo')),
      ] + mergetoolopts,
     _(b'[OPTIONS]...'),
+    helpcategory=registrar.command.CATEGORY_CHANGE_MANAGEMENT,
     helpbasic=True,
-    **compat.helpcategorykwargs('CATEGORY_CHANGE_MANAGEMENT')
 )
 def evolve(ui, repo, **opts):
     """solve troubled changesets in your repository
--- a/hgext3rd/evolve/exthelper.py	Thu Aug 11 10:39:34 2022 +0400
+++ b/hgext3rd/evolve/exthelper.py	Sun Oct 09 08:11:06 2022 +0400
@@ -50,7 +50,7 @@
         @eh.command('mynewcommand',
             [('r', 'rev', [], _('operate on these revisions'))],
             _('-r REV...'),
-            **compat.helpcategorykwargs('CATEGORY_XXX'))
+            helpcategory=registrar.command.CATEGORY_XXX)
         def newcommand(ui, repo, *revs, **opts):
             # implementation goes here
 
--- a/hgext3rd/evolve/obshistory.py	Thu Aug 11 10:39:34 2022 +0400
+++ b/hgext3rd/evolve/obshistory.py	Sun Oct 09 08:11:06 2022 +0400
@@ -19,6 +19,7 @@
     obsutil,
     patch,
     pycompat,
+    registrar,
     scmutil,
     util,
 )
@@ -28,7 +29,6 @@
 from mercurial.i18n import _
 
 from . import (
-    compat,
     exthelper,
 )
 
@@ -62,7 +62,7 @@
      (b'o', b'origin', True, _(b'show origin of changesets instead of fate')),
      ] + commands.formatteropts,
     _(b'hg obslog [OPTION]... [[-r] REV]...'),
-    **compat.helpcategorykwargs('CATEGORY_CHANGE_NAVIGATION'))
+    helpcategory=registrar.command.CATEGORY_CHANGE_NAVIGATION)
 def cmdobshistory(ui, repo, *revs, **opts):
     """show the obsolescence history of the specified revisions
 
--- a/hgext3rd/evolve/rewind.py	Thu Aug 11 10:39:34 2022 +0400
+++ b/hgext3rd/evolve/rewind.py	Sun Oct 09 08:11:06 2022 +0400
@@ -9,6 +9,7 @@
     node as nodemod,
     obsolete,
     obsutil,
+    registrar,
     scmutil,
     util,
 )
@@ -42,8 +43,9 @@
       _(b'do not perform actions, just print what would be done')),
      ],
     _(b'[--as-divergence] [--exact] [--keep] [--to REV]... [--from REV]...'),
+    helpcategory=registrar.command.CATEGORY_CHANGE_MANAGEMENT,
     helpbasic=True,
-    **compat.helpcategorykwargs('CATEGORY_CHANGE_MANAGEMENT'))
+)
 def rewind(ui, repo, **opts):
     """rewind a stack of changesets to a previous state