hgext3rd/topic/__init__.py
changeset 2915 b3abdb3d819e
parent 2912 1341ff3ba4a9
child 2922 66357d4d03b2
equal deleted inserted replaced
2914:9897babc1fb5 2915:b3abdb3d819e
   133     topic = self.topic()
   133     topic = self.topic()
   134     if not topic:
   134     if not topic:
   135         # XXX we might want to include t0 here,
   135         # XXX we might want to include t0 here,
   136         # however t0 is related to  'currenttopic' which has no place here.
   136         # however t0 is related to  'currenttopic' which has no place here.
   137         return None
   137         return None
   138     revlist = stack.getstack(self._repo, topic=topic)
   138     revlist = stack.stack(self._repo, topic=topic)
   139     try:
   139     try:
   140         return revlist.index(self.rev())
   140         return revlist.index(self.rev())
   141     except IndexError:
   141     except IndexError:
   142         # Lets move to the last ctx of the current topic
   142         # Lets move to the last ctx of the current topic
   143         return None
   143         return None
   152         idx = int(name[1:])
   152         idx = int(name[1:])
   153         ttype = 'topic'
   153         ttype = 'topic'
   154         tname = topic = repo.currenttopic
   154         tname = topic = repo.currenttopic
   155         if not tname:
   155         if not tname:
   156             raise error.Abort(_('cannot resolve "%s": no active topic') % name)
   156             raise error.Abort(_('cannot resolve "%s": no active topic') % name)
   157         revs = list(stack.getstack(repo, topic=topic))
   157         revs = list(stack.stack(repo, topic=topic))
   158     elif branchrev.match(name):
   158     elif branchrev.match(name):
   159         ttype = 'branch'
   159         ttype = 'branch'
   160         idx = int(name[1:])
   160         idx = int(name[1:])
   161         tname = branch = repo[None].branch()
   161         tname = branch = repo[None].branch()
   162         revs = list(stack.getstack(repo, branch=branch))
   162         revs = list(stack.stack(repo, branch=branch))
   163 
   163 
   164     if revs is not None:
   164     if revs is not None:
   165         try:
   165         try:
   166             r = revs[idx]
   166             r = revs[idx]
   167         except IndexError:
   167         except IndexError: