hgext3rd/topic/revset.py
changeset 5223 cc9b6e64027c
parent 4814 48b30ff742cb
equal deleted inserted replaced
5222:13ca3810a105 5223:cc9b6e64027c
   130         if not s:
   130         if not s:
   131             return revset.baseset()
   131             return revset.baseset()
   132 
   132 
   133         def getrange(st, a, b):
   133         def getrange(st, a, b):
   134             start = 1 if a is None else a
   134             start = 1 if a is None else a
   135             end = len(st.revs) if b is None else b + 1
   135             end = len(st.indexedrevs) if b is None else b + 1
   136             return range(start, end)
   136             return range(start, end)
   137 
   137 
   138         revs = []
   138         revs = []
   139         for r in s:
   139         for r in s:
   140             topic = repo[r].topic()
   140             topic = repo[r].topic()
   141             if topic:
   141             if topic:
   142                 st = stack.stack(repo, topic=topic)
   142                 st = stack.stack(repo, topic=topic)
   143             else:
   143             else:
   144                 st = stack.stack(repo, branch=repo[r].branch())
   144                 st = stack.stack(repo, branch=repo[r].branch())
   145             for n in getrange(st, a, b):
   145             for n in getrange(st, a, b):
   146                 if abs(n) >= len(st.revs):
   146                 if abs(n) >= len(st.indexedrevs):
   147                     # also means stack base is not accessible with n < 0, which
   147                     # also means stack base is not accessible with n < 0, which
   148                     # is by design
   148                     # is by design
   149                     continue
   149                     continue
   150                 if n == 0 and b != 0 and a != 0:
   150                 if n == 0 and b != 0 and a != 0:
   151                     # quirk: we don't want stack base unless specifically asked
   151                     # quirk: we don't want stack base unless specifically asked
   152                     # for it (at least one of the indices is 0)
   152                     # for it (at least one of the indices is 0)
   153                     continue
   153                     continue
   154                 rev = st.revs[n]
   154                 rev = st.indexedrevs[n]
   155                 if rev == -1 and n == 0:
   155                 if rev == -1 and n == 0:
   156                     continue
   156                     continue
   157                 if rev not in revs:
   157                 if rev not in revs:
   158                     revs.append(rev)
   158                     revs.append(rev)
   159 
   159