# HG changeset patch # User FUJIWARA Katsunori # Date 1505041612 -32400 # Node ID 9efedcedd9dd16039b9c8e4e6de141d59851b0d2 # Parent 430fb1758d28b9bc26e3a9715f0d6393195cd3cc 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. diff -r 430fb1758d28 -r 9efedcedd9dd hgext3rd/evolve/__init__.py --- 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)) diff -r 430fb1758d28 -r 9efedcedd9dd hgext3rd/evolve/exthelper.py --- 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: