##// END OF EJS Templates
narrowtemplates: update to use registrar mechanism...
Augie Fackler -
r36108:ea02be86 default
parent child Browse files
Show More
@@ -62,7 +62,6 b' def uisetup(ui):'
62 narrowrevlog.setup()
62 narrowrevlog.setup()
63 narrowbundle2.setup()
63 narrowbundle2.setup()
64 narrowmerge.setup()
64 narrowmerge.setup()
65 narrowtemplates.setup()
66 narrowcommands.setup()
65 narrowcommands.setup()
67 narrowchangegroup.setup()
66 narrowchangegroup.setup()
68 narrowwirepeer.uisetup()
67 narrowwirepeer.uisetup()
@@ -91,3 +90,6 b' def extsetup(ui):'
91 extensions.wrapfunction(verifymod.verifier, '__init__', _verifierinit)
90 extensions.wrapfunction(verifymod.verifier, '__init__', _verifierinit)
92 extensions.wrapfunction(hg, 'postshare', narrowrepo.wrappostshare)
91 extensions.wrapfunction(hg, 'postshare', narrowrepo.wrappostshare)
93 extensions.wrapfunction(hg, 'copystore', narrowrepo.unsharenarrowspec)
92 extensions.wrapfunction(hg, 'copystore', narrowrepo.unsharenarrowspec)
93
94 templatekeyword = narrowtemplates.templatekeyword
95 revsetpredicate = narrowtemplates.revsetpredicate
@@ -8,17 +8,21 b''
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 from mercurial import (
10 from mercurial import (
11 registrar,
11 revlog,
12 revlog,
12 revset,
13 templatekw,
14 util,
13 util,
15 )
14 )
16
15
16 keywords = {}
17 templatekeyword = registrar.templatekeyword(keywords)
18 revsetpredicate = registrar.revsetpredicate()
19
17 def _isellipsis(repo, rev):
20 def _isellipsis(repo, rev):
18 if repo.changelog.flags(rev) & revlog.REVIDX_ELLIPSIS:
21 if repo.changelog.flags(rev) & revlog.REVIDX_ELLIPSIS:
19 return True
22 return True
20 return False
23 return False
21
24
25 @templatekeyword('ellipsis')
22 def ellipsis(repo, ctx, templ, **args):
26 def ellipsis(repo, ctx, templ, **args):
23 """:ellipsis: String. 'ellipsis' if the change is an ellipsis node,
27 """:ellipsis: String. 'ellipsis' if the change is an ellipsis node,
24 else ''."""
28 else ''."""
@@ -26,6 +30,7 b' def ellipsis(repo, ctx, templ, **args):'
26 return 'ellipsis'
30 return 'ellipsis'
27 return ''
31 return ''
28
32
33 @templatekeyword('outsidenarrow')
29 def outsidenarrow(repo, ctx, templ, **args):
34 def outsidenarrow(repo, ctx, templ, **args):
30 """:outsidenarrow: String. 'outsidenarrow' if the change affects no
35 """:outsidenarrow: String. 'outsidenarrow' if the change affects no
31 tracked files, else ''."""
36 tracked files, else ''."""
@@ -35,15 +40,9 b' def outsidenarrow(repo, ctx, templ, **ar'
35 return 'outsidenarrow'
40 return 'outsidenarrow'
36 return ''
41 return ''
37
42
43 @revsetpredicate('ellipsis')
38 def ellipsisrevset(repo, subset, x):
44 def ellipsisrevset(repo, subset, x):
39 """``ellipsis()``
45 """``ellipsis()``
40 Changesets that are ellipsis nodes.
46 Changesets that are ellipsis nodes.
41 """
47 """
42 return subset.filter(lambda r: _isellipsis(repo, r))
48 return subset.filter(lambda r: _isellipsis(repo, r))
43
44 def setup():
45 templatekw.keywords['ellipsis'] = ellipsis
46 templatekw.keywords['outsidenarrow'] = outsidenarrow
47
48 revset.symbols['ellipsis'] = ellipsisrevset
49 revset.safesymbols.add('ellipsis')
General Comments 0
You need to be logged in to leave comments. Login now