hgext/evolve.py
changeset 1423 ecd669c36c12
parent 1422 c868a69c29c5
child 1426 6db55f28c965
equal deleted inserted replaced
1422:c868a69c29c5 1423:ecd669c36c12
  1630 def _aspiringdescendant(repo, revs):
  1630 def _aspiringdescendant(repo, revs):
  1631     """Return a list of changectx which can be stabilized on top of pctx or
  1631     """Return a list of changectx which can be stabilized on top of pctx or
  1632     one of its descendants recursively. Empty list if none can be found."""
  1632     one of its descendants recursively. Empty list if none can be found."""
  1633     target = set(revs)
  1633     target = set(revs)
  1634     result = set(target)
  1634     result = set(target)
  1635     sizeresult = 0
  1635     paths = collections.defaultdict(set)
  1636     while sizeresult != len(result):
  1636     for r in repo.revs('unstable() - %ld', revs):
  1637         sizeresult = len(result)
  1637         for d in _possibledestination(repo, r):
  1638         result.update(_aspiringchildren(repo, result))
  1638             paths[d].add(r)
       
  1639 
       
  1640     result = set(target)
       
  1641     tovisit = list(revs)
       
  1642     while tovisit:
       
  1643         base = tovisit.pop()
       
  1644         for unstable in paths[base]:
       
  1645             if unstable not in result:
       
  1646                 tovisit.append(unstable)
       
  1647                 result.add(unstable)
  1639     return sorted(result - target)
  1648     return sorted(result - target)
  1640 
  1649 
  1641 def _solveunstable(ui, repo, orig, dryrun=False, confirm=False,
  1650 def _solveunstable(ui, repo, orig, dryrun=False, confirm=False,
  1642                    progresscb=None):
  1651                    progresscb=None):
  1643     """Stabilize a unstable changeset"""
  1652     """Stabilize a unstable changeset"""