Skip to content
Snippets Groups Projects
Commit bd22900e authored by Matt Harbison's avatar Matt Harbison
Browse files

exthelper: update the examples to be python3 complaint

Differential Revision: https://phab.mercurial-scm.org/D9368
parent f177fcd9
No related branches found
No related tags found
No related merge requests found
......@@ -53,10 +53,10 @@
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
......@@ -59,8 +59,8 @@
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,
)
......@@ -64,7 +64,7 @@
default=False,
)
@eh.filesetpredicate('lfs()')
@eh.filesetpredicate(b'lfs()')
def filesetbabar(mctx, x):
return mctx.predicate(...)
......@@ -68,5 +68,5 @@
def filesetbabar(mctx, x):
return mctx.predicate(...)
@eh.revsetpredicate('hidden')
@eh.revsetpredicate(b'hidden')
def revsetbabar(repo, subset, x):
......@@ -72,4 +72,4 @@
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()]
......@@ -75,3 +75,3 @@
@eh.templatekeyword('babar')
@eh.templatekeyword(b'babar')
def kwbabar(ctx):
......@@ -77,5 +77,5 @@
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,5 +258,5 @@
example::
@eh.wrapcommand('summary')
@eh.wrapcommand(b'summary')
def wrapsummary(orig, ui, repo, *args, **kwargs):
......@@ -262,5 +262,5 @@
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,5 +298,5 @@
example::
@eh.function(discovery, 'checkheads')
@eh.function(discovery, b'checkheads')
def wrapfunction(orig, *args, **kwargs):
......@@ -302,5 +302,5 @@
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)
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment