Patchwork D9489: registrar: clarify the documentation about some byte strings being required

login
register
mail settings
Submitter phabricator
Date Dec. 1, 2020, 11:26 p.m.
Message ID <differential-rev-PHID-DREV-p2kboyqnjaz2in2wk2hc-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47771/
State Superseded
Headers show

Comments

phabricator - Dec. 1, 2020, 11:26 p.m.
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I *thought* these needed to be byte strings, but didn't remember and had to
  search out examples.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/registrar.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/registrar.py b/mercurial/registrar.py
--- a/mercurial/registrar.py
+++ b/mercurial/registrar.py
@@ -37,7 +37,7 @@ 
 
         keyword = registrar.keyword()
 
-        @keyword('bar')
+        @keyword(b'bar')
         def barfunc(*args, **kwargs):
             '''Explanation of bar keyword ....
             '''
@@ -249,7 +249,7 @@ 
 
         revsetpredicate = registrar.revsetpredicate()
 
-        @revsetpredicate('mypredicate(arg1, arg2[, arg3])')
+        @revsetpredicate(b'mypredicate(arg1, arg2[, arg3])')
         def mypredicatefunc(repo, subset, x):
             '''Explanation of this revset predicate ....
             '''
@@ -299,7 +299,7 @@ 
 
         filesetpredicate = registrar.filesetpredicate()
 
-        @filesetpredicate('mypredicate()')
+        @filesetpredicate(b'mypredicate()')
         def mypredicatefunc(mctx, x):
             '''Explanation of this fileset predicate ....
             '''
@@ -356,7 +356,7 @@ 
         templatekeyword = registrar.templatekeyword()
 
         # new API (since Mercurial 4.6)
-        @templatekeyword('mykeyword', requires={'repo', 'ctx'})
+        @templatekeyword(b'mykeyword', requires={b'repo', b'ctx'})
         def mykeywordfunc(context, mapping):
             '''Explanation of this template keyword ....
             '''
@@ -388,7 +388,7 @@ 
 
         templatefilter = registrar.templatefilter()
 
-        @templatefilter('myfilter', intype=bytes)
+        @templatefilter(b'myfilter', intype=bytes)
         def myfilterfunc(text):
             '''Explanation of this template filter ....
             '''
@@ -420,8 +420,8 @@ 
 
         templatefunc = registrar.templatefunc()
 
-        @templatefunc('myfunc(arg1, arg2[, arg3])', argspec='arg1 arg2 arg3',
-                      requires={'ctx'})
+        @templatefunc(b'myfunc(arg1, arg2[, arg3])', argspec=b'arg1 arg2 arg3',
+                      requires={b'ctx'})
         def myfuncfunc(context, mapping, args):
             '''Explanation of this template function ....
             '''
@@ -460,7 +460,7 @@ 
 
         internalmerge = registrar.internalmerge()
 
-        @internalmerge('mymerge', internalmerge.mergeonly,
+        @internalmerge(b'mymerge', internalmerge.mergeonly,
                        onfailure=None, precheck=None,
                        binary=False, symlink=False):
         def mymergefunc(repo, mynode, orig, fcd, fco, fca,