mercurial/registrar.py
changeset 46015 c1bb02738f96
parent 45957 89a2afe31e82
child 48966 6000f5b25c9b
equal deleted inserted replaced
46014:c4c7a6b61146 46015:c1bb02738f96
    35 
    35 
    36     This should be used as below:
    36     This should be used as below:
    37 
    37 
    38         keyword = registrar.keyword()
    38         keyword = registrar.keyword()
    39 
    39 
    40         @keyword('bar')
    40         @keyword(b'bar')
    41         def barfunc(*args, **kwargs):
    41         def barfunc(*args, **kwargs):
    42             '''Explanation of bar keyword ....
    42             '''Explanation of bar keyword ....
    43             '''
    43             '''
    44             pass
    44             pass
    45 
    45 
   247 
   247 
   248     Usage::
   248     Usage::
   249 
   249 
   250         revsetpredicate = registrar.revsetpredicate()
   250         revsetpredicate = registrar.revsetpredicate()
   251 
   251 
   252         @revsetpredicate('mypredicate(arg1, arg2[, arg3])')
   252         @revsetpredicate(b'mypredicate(arg1, arg2[, arg3])')
   253         def mypredicatefunc(repo, subset, x):
   253         def mypredicatefunc(repo, subset, x):
   254             '''Explanation of this revset predicate ....
   254             '''Explanation of this revset predicate ....
   255             '''
   255             '''
   256             pass
   256             pass
   257 
   257 
   297 
   297 
   298     Usage::
   298     Usage::
   299 
   299 
   300         filesetpredicate = registrar.filesetpredicate()
   300         filesetpredicate = registrar.filesetpredicate()
   301 
   301 
   302         @filesetpredicate('mypredicate()')
   302         @filesetpredicate(b'mypredicate()')
   303         def mypredicatefunc(mctx, x):
   303         def mypredicatefunc(mctx, x):
   304             '''Explanation of this fileset predicate ....
   304             '''Explanation of this fileset predicate ....
   305             '''
   305             '''
   306             pass
   306             pass
   307 
   307 
   354     Usage::
   354     Usage::
   355 
   355 
   356         templatekeyword = registrar.templatekeyword()
   356         templatekeyword = registrar.templatekeyword()
   357 
   357 
   358         # new API (since Mercurial 4.6)
   358         # new API (since Mercurial 4.6)
   359         @templatekeyword('mykeyword', requires={'repo', 'ctx'})
   359         @templatekeyword(b'mykeyword', requires={b'repo', b'ctx'})
   360         def mykeywordfunc(context, mapping):
   360         def mykeywordfunc(context, mapping):
   361             '''Explanation of this template keyword ....
   361             '''Explanation of this template keyword ....
   362             '''
   362             '''
   363             pass
   363             pass
   364 
   364 
   386 
   386 
   387     Usage::
   387     Usage::
   388 
   388 
   389         templatefilter = registrar.templatefilter()
   389         templatefilter = registrar.templatefilter()
   390 
   390 
   391         @templatefilter('myfilter', intype=bytes)
   391         @templatefilter(b'myfilter', intype=bytes)
   392         def myfilterfunc(text):
   392         def myfilterfunc(text):
   393             '''Explanation of this template filter ....
   393             '''Explanation of this template filter ....
   394             '''
   394             '''
   395             pass
   395             pass
   396 
   396 
   418 
   418 
   419     Usage::
   419     Usage::
   420 
   420 
   421         templatefunc = registrar.templatefunc()
   421         templatefunc = registrar.templatefunc()
   422 
   422 
   423         @templatefunc('myfunc(arg1, arg2[, arg3])', argspec='arg1 arg2 arg3',
   423         @templatefunc(b'myfunc(arg1, arg2[, arg3])', argspec=b'arg1 arg2 arg3',
   424                       requires={'ctx'})
   424                       requires={b'ctx'})
   425         def myfuncfunc(context, mapping, args):
   425         def myfuncfunc(context, mapping, args):
   426             '''Explanation of this template function ....
   426             '''Explanation of this template function ....
   427             '''
   427             '''
   428             pass
   428             pass
   429 
   429 
   458 
   458 
   459     Usage::
   459     Usage::
   460 
   460 
   461         internalmerge = registrar.internalmerge()
   461         internalmerge = registrar.internalmerge()
   462 
   462 
   463         @internalmerge('mymerge', internalmerge.mergeonly,
   463         @internalmerge(b'mymerge', internalmerge.mergeonly,
   464                        onfailure=None, precheck=None,
   464                        onfailure=None, precheck=None,
   465                        binary=False, symlink=False):
   465                        binary=False, symlink=False):
   466         def mymergefunc(repo, mynode, orig, fcd, fco, fca,
   466         def mymergefunc(repo, mynode, orig, fcd, fco, fca,
   467                         toolconf, files, labels=None):
   467                         toolconf, files, labels=None):
   468             '''Explanation of this internal merge tool ....
   468             '''Explanation of this internal merge tool ....