Conditionnaly add the `hidden` revset symbol stable
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Sun, 26 Aug 2012 12:04:16 +0200
branchstable
changeset 520 a426301ab306
parent 519 9825c7da5b54
child 521 46f1597bcfe6
Conditionnaly add the `hidden` revset symbol Mercurial Core#default now have it (but 2.3 don't)
hgext/evolve.py
--- a/hgext/evolve.py	Sat Aug 25 14:43:34 2012 +0200
+++ b/hgext/evolve.py	Sun Aug 26 12:04:16 2012 +0200
@@ -787,15 +787,16 @@
 # this section add several useful revset symbol not yet in core.
 # they are subject to changes
 
-### hidden revset is not in core yet
 
-@eh.revset('hidden')
-def revsethidden(repo, subset, x):
-    """``hidden()``
-    Changeset is hidden.
-    """
-    args = revset.getargs(x, 0, 0, 'hidden takes no argument')
-    return [r for r in subset if r in repo.hiddenrevs]
+if 'hidden' not in revset.symbols:
+    # in 2.3+
+    @eh.revset('hidden')
+    def revsethidden(repo, subset, x):
+        """``hidden()``
+        Changeset is hidden.
+        """
+        args = revset.getargs(x, 0, 0, 'hidden takes no argument')
+        return [r for r in subset if r in repo.hiddenrevs]
 
 ### XXX I'm not sure this revset is useful
 @eh.revset('suspended')