[Updated] D9368: exthelper: update the examples to be python3 complaint

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Thu Nov 26 13:15:53 UTC 2020


Closed by commit rHGbd22900e26ac: exthelper: update the examples to be python3 complaint (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D9368?vs=23625&id=23700

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D9368/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D9368

AFFECTED FILES
  mercurial/exthelper.py

CHANGE DETAILS

diff --git a/mercurial/exthelper.py b/mercurial/exthelper.py
--- a/mercurial/exthelper.py
+++ b/mercurial/exthelper.py
@@ -53,29 +53,29 @@
         revsetpredicate = eh.revsetpredicate
         templatekeyword = eh.templatekeyword
 
-        @eh.command('mynewcommand',
-            [('r', 'rev', [], _('operate on these revisions'))],
-            _('-r REV...'),
+        @eh.command(b'mynewcommand',
+            [(b'r', b'rev', [], _(b'operate on these revisions'))],
+            _(b'-r REV...'),
             helpcategory=command.CATEGORY_XXX)
         def newcommand(ui, repo, *revs, **opts):
             # implementation goes here
 
-        eh.configitem('experimental', 'foo',
+        eh.configitem(b'experimental', b'foo',
             default=False,
         )
 
-        @eh.filesetpredicate('lfs()')
+        @eh.filesetpredicate(b'lfs()')
         def filesetbabar(mctx, x):
             return mctx.predicate(...)
 
-        @eh.revsetpredicate('hidden')
+        @eh.revsetpredicate(b'hidden')
         def revsetbabar(repo, subset, x):
-            args = revset.getargs(x, 0, 0, 'babar accept no argument')
-            return [r for r in subset if 'babar' in repo[r].description()]
+            args = revset.getargs(x, 0, 0, b'babar accept no argument')
+            return [r for r in subset if b'babar' in repo[r].description()]
 
-        @eh.templatekeyword('babar')
+        @eh.templatekeyword(b'babar')
         def kwbabar(ctx):
-            return 'babar'
+            return b'babar'
     """
 
     def __init__(self):
@@ -160,7 +160,7 @@
         The following operations belong here:
 
         - Changes depending on the status of other extensions. (if
-          extensions.find('mq'))
+          extensions.find(b'mq'))
         - Add a global option to all commands
         """
         knownexts = {}
@@ -203,7 +203,7 @@
 
             @eh.uisetup
             def setupbabar(ui):
-                print 'this is uisetup!'
+                print('this is uisetup!')
         """
         self._uicallables.append(call)
         return call
@@ -215,7 +215,7 @@
 
             @eh.uipopulate
             def setupfoo(ui):
-                print 'this is uipopulate!'
+                print('this is uipopulate!')
         """
         self._uipopulatecallables.append(call)
         return call
@@ -227,7 +227,7 @@
 
             @eh.extsetup
             def setupcelestine(ui):
-                print 'this is extsetup!'
+                print('this is extsetup!')
         """
         self._extcallables.append(call)
         return call
@@ -239,7 +239,7 @@
 
             @eh.reposetup
             def setupzephir(ui, repo):
-                print 'this is reposetup!'
+                print('this is reposetup!')
         """
         self._repocallables.append(call)
         return call
@@ -258,9 +258,9 @@
 
         example::
 
-            @eh.wrapcommand('summary')
+            @eh.wrapcommand(b'summary')
             def wrapsummary(orig, ui, repo, *args, **kwargs):
-                ui.note('Barry!')
+                ui.note(b'Barry!')
                 return orig(ui, repo, *args, **kwargs)
 
         The `opts` argument allows specifying a list of tuples for additional
@@ -298,9 +298,9 @@
 
         example::
 
-            @eh.function(discovery, 'checkheads')
+            @eh.function(discovery, b'checkheads')
             def wrapfunction(orig, *args, **kwargs):
-                ui.note('His head smashed in and his heart cut out')
+                ui.note(b'His head smashed in and his heart cut out')
                 return orig(*args, **kwargs)
         """
 



To: mharbison72, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20201126/e4df1244/attachment-0002.html>


More information about the Mercurial-patches mailing list