hgext3rd/topic/revset.py
changeset 4379 2893b127923b
parent 4369 75276f858444
child 4380 c73edc31e0dd
--- a/hgext3rd/topic/revset.py	Fri Jan 25 16:51:36 2019 +0530
+++ b/hgext3rd/topic/revset.py	Sun Jan 27 17:39:09 2019 +0800
@@ -146,18 +146,9 @@
     revset.subscriptrelations['stack'] = stackrel
     revset.subscriptrelations['s'] = stackrel
 
-    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)
-        if n <= 0:
-            n = -n
-            return ancestors(repo, subset, x, startdepth=n, stopdepth=n + 1)
-        else:
-            return descendants(repo, subset, x, startdepth=n, stopdepth=n + 1)
+    def topicrel(repo, subset, x, *args):
+        subset &= topicset(repo, subset, x)
+        return revset.generationsrel(repo, subset, x, *args)
 
     revset.subscriptrelations['topic'] = topicrel
     revset.subscriptrelations['t'] = topicrel