revset: subscriptrelations functions now have two bounds
authorAnton Shestakov <av6@dwimlabs.net>
Sat, 26 Jan 2019 23:58:18 +0800
changeset 4369 75276f858444
parent 4368 acfd2b1a6176
child 4370 45c0415e45b9
revset: subscriptrelations functions now have two bounds
hgext3rd/topic/revset.py
--- a/hgext3rd/topic/revset.py	Wed Jan 23 15:49:44 2019 -0500
+++ b/hgext3rd/topic/revset.py	Sat Jan 26 23:58:18 2019 +0800
@@ -108,7 +108,7 @@
     return revset.baseset(stack.stack(repo, branch=branch, topic=topic)[1:]) & subset
 
 if util.safehasattr(revset, 'subscriptrelations'):
-    def stackrel(repo, subset, x, rel, n, order):
+    def stackrel(repo, subset, x, rel, n, *args):
         """This is a revset-flavored implementation of stack aliases.
 
         The syntax is: rev#stack[n] or rev#s[n]. Plenty of logic is borrowed
@@ -116,6 +116,9 @@
         (e.g. when stack index is too high), this returns empty set to be more
         revset-friendly.
         """
+        # hg 5.0 provides two bounds, for now we support only one
+        if len(args) == 2 and args[0] != n:
+            raise NotImplementedError
         s = revset.getset(repo, revset.fullreposet(repo), x)
         if not s:
             return revset.baseset()
@@ -143,7 +146,10 @@
     revset.subscriptrelations['stack'] = stackrel
     revset.subscriptrelations['s'] = stackrel
 
-    def topicrel(repo, subset, x, rel, n, order):
+    def topicrel(repo, subset, x, rel, n, *args):
+        # hg 5.0 provides two bounds, for now we support only one
+        if len(args) == 2 and args[0] != n:
+            raise NotImplementedError
         ancestors = revset._ancestors
         descendants = revset._descendants
         subset = topicset(repo, subset, x)