Mercurial > evolve
changeset 2925:9efedcedd9dd
evolve: use registrar.revsetpredicate to register revset predicate functions
Now, using registrar.revsetpredicate of Mercurial directly in evolve
extension should be safe enough. because it has been available since
Mercurial 3.8, and minimum Mercurial version for evolve extension is
3.8, too.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sun, 10 Sep 2017 20:06:52 +0900 |
parents | 430fb1758d28 |
children | 1abafae41fe2 |
files | hgext3rd/evolve/__init__.py hgext3rd/evolve/exthelper.py |
diffstat | 2 files changed, 17 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py Mon Aug 07 23:17:13 2017 +0900 +++ b/hgext3rd/evolve/__init__.py Sun Sep 10 20:06:52 2017 +0900 @@ -482,10 +482,9 @@ ### Troubled revset symbol -@eh.revset('troubled') +@eh.revset('troubled()') def revsettroubled(repo, subset, x): - """``troubled()`` - Changesets with troubles. + """Changesets with troubles. """ revset.getargs(x, 0, 0, 'troubled takes no arguments') troubled = set() @@ -589,10 +588,9 @@ ### XXX I'm not sure this revset is useful -@eh.revset('suspended') +@eh.revset('suspended()') def revsetsuspended(repo, subset, x): - """``suspended()`` - Obsolete changesets with non-obsolete descendants. + """Obsolete changesets with non-obsolete descendants. """ revset.getargs(x, 0, 0, 'suspended takes no arguments') suspended = revset.baseset(getrevs(repo, 'suspended')) @@ -600,10 +598,9 @@ return subset & suspended -@eh.revset('precursors') +@eh.revset('precursors(set)') def revsetprecursors(repo, subset, x): - """``precursors(set)`` - Immediate precursors of changesets in set. + """Immediate precursors of changesets in set. """ s = revset.getset(repo, revset.fullreposet(repo), x) s = revset.baseset(_precursors(repo, s)) @@ -611,10 +608,9 @@ return subset & s -@eh.revset('allprecursors') +@eh.revset('allprecursors(set)') def revsetallprecursors(repo, subset, x): - """``allprecursors(set)`` - Transitive precursors of changesets in set. + """Transitive precursors of changesets in set. """ s = revset.getset(repo, revset.fullreposet(repo), x) s = revset.baseset(_allprecursors(repo, s)) @@ -622,20 +618,18 @@ return subset & s -@eh.revset('successors') +@eh.revset('successors(set)') def revsetsuccessors(repo, subset, x): - """``successors(set)`` - Immediate successors of changesets in set. + """Immediate successors of changesets in set. """ s = revset.getset(repo, revset.fullreposet(repo), x) s = revset.baseset(_successors(repo, s)) s.sort() return subset & s -@eh.revset('allsuccessors') +@eh.revset('allsuccessors(set)') def revsetallsuccessors(repo, subset, x): - """``allsuccessors(set)`` - Transitive successors of changesets in set. + """Transitive successors of changesets in set. """ s = revset.getset(repo, revset.fullreposet(repo), x) s = revset.baseset(_allsuccessors(repo, s))
--- a/hgext3rd/evolve/exthelper.py Mon Aug 07 23:17:13 2017 +0900 +++ b/hgext3rd/evolve/exthelper.py Sun Sep 10 20:06:52 2017 +0900 @@ -93,8 +93,12 @@ - Register revset functions """ knownexts = {} + + revsetpredicate = registrar.revsetpredicate() for name, symbol in self._revsetsymbols: - revset.symbols[name] = symbol + revsetpredicate(name)(symbol) + revset.loadpredicate(ui, 'evolve', revsetpredicate) + for name, kw in self._templatekws: templatekw.keywords[name] = kw for ext, command, wrapper, opts in self._extcommandwrappers: