hgext3rd/topic/revset.py
changeset 4380 c73edc31e0dd
parent 4379 2893b127923b
child 4381 5f1d0cff514d
--- a/hgext3rd/topic/revset.py	Sun Jan 27 17:39:09 2019 +0800
+++ b/hgext3rd/topic/revset.py	Mon Jan 28 22:31:31 2019 +0800
@@ -129,14 +129,11 @@
                 st = stack.stack(repo, topic=topic)
             else:
                 st = stack.stack(repo, branch=repo[r].branch())
-            if n < 0:
-                st = list(st)[1:]
-            else:
-                st = list(st)
-            try:
-                rev = st[n]
-            except IndexError:
+            if abs(n) >= len(st.revs):
+                # also means stack base is not accessible with n < 0, which is
+                # by design
                 continue
+            rev = st.revs[n]
             if rev == -1 and n == 0:
                 continue
             if rev not in revs: