##// END OF EJS Templates
exthelper: update the examples to be python3 complaint...
Matt Harbison -
r46544:bd22900e default
parent child Browse files
Show More
@@ -53,29 +53,29 b' class exthelper(object):'
53 revsetpredicate = eh.revsetpredicate
53 revsetpredicate = eh.revsetpredicate
54 templatekeyword = eh.templatekeyword
54 templatekeyword = eh.templatekeyword
55
55
56 @eh.command('mynewcommand',
56 @eh.command(b'mynewcommand',
57 [('r', 'rev', [], _('operate on these revisions'))],
57 [(b'r', b'rev', [], _(b'operate on these revisions'))],
58 _('-r REV...'),
58 _(b'-r REV...'),
59 helpcategory=command.CATEGORY_XXX)
59 helpcategory=command.CATEGORY_XXX)
60 def newcommand(ui, repo, *revs, **opts):
60 def newcommand(ui, repo, *revs, **opts):
61 # implementation goes here
61 # implementation goes here
62
62
63 eh.configitem('experimental', 'foo',
63 eh.configitem(b'experimental', b'foo',
64 default=False,
64 default=False,
65 )
65 )
66
66
67 @eh.filesetpredicate('lfs()')
67 @eh.filesetpredicate(b'lfs()')
68 def filesetbabar(mctx, x):
68 def filesetbabar(mctx, x):
69 return mctx.predicate(...)
69 return mctx.predicate(...)
70
70
71 @eh.revsetpredicate('hidden')
71 @eh.revsetpredicate(b'hidden')
72 def revsetbabar(repo, subset, x):
72 def revsetbabar(repo, subset, x):
73 args = revset.getargs(x, 0, 0, 'babar accept no argument')
73 args = revset.getargs(x, 0, 0, b'babar accept no argument')
74 return [r for r in subset if 'babar' in repo[r].description()]
74 return [r for r in subset if b'babar' in repo[r].description()]
75
75
76 @eh.templatekeyword('babar')
76 @eh.templatekeyword(b'babar')
77 def kwbabar(ctx):
77 def kwbabar(ctx):
78 return 'babar'
78 return b'babar'
79 """
79 """
80
80
81 def __init__(self):
81 def __init__(self):
@@ -160,7 +160,7 b' class exthelper(object):'
160 The following operations belong here:
160 The following operations belong here:
161
161
162 - Changes depending on the status of other extensions. (if
162 - Changes depending on the status of other extensions. (if
163 extensions.find('mq'))
163 extensions.find(b'mq'))
164 - Add a global option to all commands
164 - Add a global option to all commands
165 """
165 """
166 knownexts = {}
166 knownexts = {}
@@ -203,7 +203,7 b' class exthelper(object):'
203
203
204 @eh.uisetup
204 @eh.uisetup
205 def setupbabar(ui):
205 def setupbabar(ui):
206 print 'this is uisetup!'
206 print('this is uisetup!')
207 """
207 """
208 self._uicallables.append(call)
208 self._uicallables.append(call)
209 return call
209 return call
@@ -215,7 +215,7 b' class exthelper(object):'
215
215
216 @eh.uipopulate
216 @eh.uipopulate
217 def setupfoo(ui):
217 def setupfoo(ui):
218 print 'this is uipopulate!'
218 print('this is uipopulate!')
219 """
219 """
220 self._uipopulatecallables.append(call)
220 self._uipopulatecallables.append(call)
221 return call
221 return call
@@ -227,7 +227,7 b' class exthelper(object):'
227
227
228 @eh.extsetup
228 @eh.extsetup
229 def setupcelestine(ui):
229 def setupcelestine(ui):
230 print 'this is extsetup!'
230 print('this is extsetup!')
231 """
231 """
232 self._extcallables.append(call)
232 self._extcallables.append(call)
233 return call
233 return call
@@ -239,7 +239,7 b' class exthelper(object):'
239
239
240 @eh.reposetup
240 @eh.reposetup
241 def setupzephir(ui, repo):
241 def setupzephir(ui, repo):
242 print 'this is reposetup!'
242 print('this is reposetup!')
243 """
243 """
244 self._repocallables.append(call)
244 self._repocallables.append(call)
245 return call
245 return call
@@ -258,9 +258,9 b' class exthelper(object):'
258
258
259 example::
259 example::
260
260
261 @eh.wrapcommand('summary')
261 @eh.wrapcommand(b'summary')
262 def wrapsummary(orig, ui, repo, *args, **kwargs):
262 def wrapsummary(orig, ui, repo, *args, **kwargs):
263 ui.note('Barry!')
263 ui.note(b'Barry!')
264 return orig(ui, repo, *args, **kwargs)
264 return orig(ui, repo, *args, **kwargs)
265
265
266 The `opts` argument allows specifying a list of tuples for additional
266 The `opts` argument allows specifying a list of tuples for additional
@@ -298,9 +298,9 b' class exthelper(object):'
298
298
299 example::
299 example::
300
300
301 @eh.function(discovery, 'checkheads')
301 @eh.function(discovery, b'checkheads')
302 def wrapfunction(orig, *args, **kwargs):
302 def wrapfunction(orig, *args, **kwargs):
303 ui.note('His head smashed in and his heart cut out')
303 ui.note(b'His head smashed in and his heart cut out')
304 return orig(*args, **kwargs)
304 return orig(*args, **kwargs)
305 """
305 """
306
306
General Comments 0
You need to be logged in to leave comments. Login now