mercurial/revlog.py
changeset 17009 0c18aed2fcca
parent 17008 553e8f5aba7a
child 17128 1028a1c9077a
child 17134 e7167007c083
equal deleted inserted replaced
17008:553e8f5aba7a 17009:0c18aed2fcca
   358             return l
   358             return l
   359 
   359 
   360         t = self.revision(self.node(rev))
   360         t = self.revision(self.node(rev))
   361         return len(t)
   361         return len(t)
   362     size = rawsize
   362     size = rawsize
   363 
       
   364     def reachable(self, node, stop=None):
       
   365         """return the set of all nodes ancestral to a given node, including
       
   366          the node itself, stopping when stop is matched"""
       
   367         reachable = set((node,))
       
   368         visit = util.deque([node])
       
   369         if stop:
       
   370             stopn = self.rev(stop)
       
   371         else:
       
   372             stopn = 0
       
   373         while visit:
       
   374             n = visit.popleft()
       
   375             if n == stop:
       
   376                 continue
       
   377             if n == nullid:
       
   378                 continue
       
   379             for p in self.parents(n):
       
   380                 if self.rev(p) < stopn:
       
   381                     continue
       
   382                 if p not in reachable:
       
   383                     reachable.add(p)
       
   384                     visit.append(p)
       
   385         return reachable
       
   386 
   363 
   387     def ancestors(self, revs, stoprev=0):
   364     def ancestors(self, revs, stoprev=0):
   388         """Generate the ancestors of 'revs' in reverse topological order.
   365         """Generate the ancestors of 'revs' in reverse topological order.
   389         Does not generate revs lower than stoprev.
   366         Does not generate revs lower than stoprev.
   390 
   367