stack: rename stack.revs into stack.indexedrevs draft
authorAnton Shestakov <av6@dwimlabs.net>
Thu, 12 Sep 2019 15:38:11 +0700
changeset 5223 cc9b6e64027c
parent 5222 13ca3810a105
stack: rename stack.revs into stack.indexedrevs They are accessible by an index, and are sorted. But they don't include all revisions for show in showstack().
hgext3rd/topic/revset.py
hgext3rd/topic/stack.py
--- a/hgext3rd/topic/revset.py	Thu Sep 12 15:22:50 2019 +0700
+++ b/hgext3rd/topic/revset.py	Thu Sep 12 15:38:11 2019 +0700
@@ -132,7 +132,7 @@
 
         def getrange(st, a, b):
             start = 1 if a is None else a
-            end = len(st.revs) if b is None else b + 1
+            end = len(st.indexedrevs) if b is None else b + 1
             return range(start, end)
 
         revs = []
@@ -143,7 +143,7 @@
             else:
                 st = stack.stack(repo, branch=repo[r].branch())
             for n in getrange(st, a, b):
-                if abs(n) >= len(st.revs):
+                if abs(n) >= len(st.indexedrevs):
                     # also means stack base is not accessible with n < 0, which
                     # is by design
                     continue
@@ -151,7 +151,7 @@
                     # quirk: we don't want stack base unless specifically asked
                     # for it (at least one of the indices is 0)
                     continue
-                rev = st.revs[n]
+                rev = st.indexedrevs[n]
                 if rev == -1 and n == 0:
                     continue
                 if rev not in revs:
--- a/hgext3rd/topic/stack.py	Thu Sep 12 15:22:50 2019 +0700
+++ b/hgext3rd/topic/stack.py	Thu Sep 12 15:38:11 2019 +0700
@@ -73,10 +73,10 @@
         self._revs = trevs
 
     def __iter__(self):
-        return iter(self.revs)
+        return iter(self.indexedrevs)
 
     def __getitem__(self, index):
-        return self.revs[index]
+        return self.indexedrevs[index]
 
     def __nonzero__(self):
         return bool(self._revs)
@@ -84,7 +84,7 @@
     __bool__ = __nonzero__
 
     def index(self, item):
-        return self.revs.index(item)
+        return self.indexedrevs.index(item)
 
     @util.propertycache
     def _dependencies(self):
@@ -138,7 +138,7 @@
         return deps, rdeps
 
     @util.propertycache
-    def revs(self):
+    def indexedrevs(self):
         # some duplication/change from _orderrevs because we use a post
         # processed dependency graph.