mercurial/dagop.py
changeset 33075 d83b189aef83
parent 33073 b04cf7a6e0f3
child 33076 a76a64c78807
equal deleted inserted replaced
33074:e999b59d6eb1 33075:d83b189aef83
    96     first = min(revs)
    96     first = min(revs)
    97     nullrev = node.nullrev
    97     nullrev = node.nullrev
    98     if first == nullrev:
    98     if first == nullrev:
    99         # Are there nodes with a null first parent and a non-null
    99         # Are there nodes with a null first parent and a non-null
   100         # second one? Maybe. Do we care? Probably not.
   100         # second one? Maybe. Do we care? Probably not.
       
   101         yield first
   101         for i in cl:
   102         for i in cl:
   102             yield i
   103             yield i
   103     else:
   104     else:
   104         seen = set(revs)
   105         seen = set(revs)
   105         for i in cl.revs(first + 1):
   106         for i in cl.revs(first):
       
   107             if i in seen:
       
   108                 yield i
       
   109                 continue
   106             for x in cl.parentrevs(i)[:cut]:
   110             for x in cl.parentrevs(i)[:cut]:
   107                 if x != nullrev and x in seen:
   111                 if x != nullrev and x in seen:
   108                     seen.add(i)
   112                     seen.add(i)
   109                     yield i
   113                     yield i
   110                     break
   114                     break
   111 
   115 
   112 def revdescendants(repo, revs, followfirst):
   116 def revdescendants(repo, revs, followfirst):
   113     """Like revlog.descendants() but supports followfirst."""
   117     """Like revlog.descendants() but supports additional options, includes
       
   118     the given revs themselves, and returns a smartset"""
   114     gen = _genrevdescendants(repo, revs, followfirst)
   119     gen = _genrevdescendants(repo, revs, followfirst)
   115     return generatorset(gen, iterasc=True)
   120     return generatorset(gen, iterasc=True)
   116 
   121 
   117 def _reachablerootspure(repo, minroot, roots, heads, includepath):
   122 def _reachablerootspure(repo, minroot, roots, heads, includepath):
   118     """return (heads(::<roots> and ::<heads>))
   123     """return (heads(::<roots> and ::<heads>))