mercurial/revlog.py
changeset 51259 f20c4b307a5a
parent 51251 f94c10334bcb
child 51267 ceeb8fa23cc8
equal deleted inserted replaced
51258:9088c6d65ef6 51259:f20c4b307a5a
  2360             ishead[r] = 1  # I may be an head
  2360             ishead[r] = 1  # I may be an head
  2361             e = index[r]
  2361             e = index[r]
  2362             ishead[e[5]] = ishead[e[6]] = 0  # my parent are not
  2362             ishead[e[5]] = ishead[e[6]] = 0  # my parent are not
  2363         return [r for r, val in enumerate(ishead) if val]
  2363         return [r for r, val in enumerate(ishead) if val]
  2364 
  2364 
       
  2365     def _head_node_ids(self):
       
  2366         try:
       
  2367             return self.index.head_node_ids()
       
  2368         except AttributeError:
       
  2369             return [self.node(r) for r in self.headrevs()]
       
  2370 
  2365     def heads(self, start=None, stop=None):
  2371     def heads(self, start=None, stop=None):
  2366         """return the list of all nodes that have no children
  2372         """return the list of all nodes that have no children
  2367 
  2373 
  2368         if start is specified, only heads that are descendants of
  2374         if start is specified, only heads that are descendants of
  2369         start will be returned
  2375         start will be returned
  2371         as if they had no children
  2377         as if they had no children
  2372         """
  2378         """
  2373         if start is None and stop is None:
  2379         if start is None and stop is None:
  2374             if not len(self):
  2380             if not len(self):
  2375                 return [self.nullid]
  2381                 return [self.nullid]
  2376             return [self.node(r) for r in self.headrevs()]
  2382             return self._head_node_ids()
  2377 
       
  2378         if start is None:
  2383         if start is None:
  2379             start = nullrev
  2384             start = nullrev
  2380         else:
  2385         else:
  2381             start = self.rev(start)
  2386             start = self.rev(start)
  2382 
  2387