mercurial/ancestor.py
changeset 49292 d44e3c45f0e4
parent 49037 642e31cb55f0
equal deleted inserted replaced
49291:44b26349127b 49292:d44e3c45f0e4
    10 
    10 
    11 from .node import nullrev
    11 from .node import nullrev
    12 from . import (
    12 from . import (
    13     dagop,
    13     dagop,
    14     policy,
    14     policy,
    15     pycompat,
       
    16 )
    15 )
    17 
    16 
    18 parsers = policy.importmod('parsers')
    17 parsers = policy.importmod('parsers')
    19 
    18 
    20 
    19 
   185         keepcount = sum(1 for r in revs if r > start)
   184         keepcount = sum(1 for r in revs if r > start)
   186         if len(revs) == keepcount:
   185         if len(revs) == keepcount:
   187             # no revs to consider
   186             # no revs to consider
   188             return
   187             return
   189 
   188 
   190         for curr in pycompat.xrange(start, min(revs) - 1, -1):
   189         for curr in range(start, min(revs) - 1, -1):
   191             if curr not in bases:
   190             if curr not in bases:
   192                 continue
   191                 continue
   193             revs.discard(curr)
   192             revs.discard(curr)
   194             bases.update(pfunc(curr))
   193             bases.update(pfunc(curr))
   195             if len(revs) == keepcount:
   194             if len(revs) == keepcount:
   226         # revsvisit and added to bothvisit. When revsvisit becomes empty, there
   225         # revsvisit and added to bothvisit. When revsvisit becomes empty, there
   227         # are no more ancestors of revs that aren't also ancestors of bases, so
   226         # are no more ancestors of revs that aren't also ancestors of bases, so
   228         # exit.
   227         # exit.
   229 
   228 
   230         missing = []
   229         missing = []
   231         for curr in pycompat.xrange(start, nullrev, -1):
   230         for curr in range(start, nullrev, -1):
   232             if not revsvisit:
   231             if not revsvisit:
   233                 break
   232                 break
   234 
   233 
   235             if curr in bothvisit:
   234             if curr in bothvisit:
   236                 bothvisit.remove(curr)
   235                 bothvisit.remove(curr)