Comments
Patch
@@ -469,6 +469,45 @@ def _installalias(ui):
"! $HG rebase --dest . --rev $@ && $HG up tip")
+
+def _nextcandidates(repo):
+ """Iterator yielding every changeset that can evolve on a non obsolete
+ descendant of the parent of the working copy
+
+ It is used to implement _nextcandidate and _allnextcandidates that in
+ turn are used to implement hg evolve with no argument and hg evole --all
+ """
+ nonobsdescendants = sorted(repo.revs("(.::) - obsolete() - troubled()"))
+ troubled = repo.revs("troubled()")
+
+ # Build a dependency graph for all the troubled
+ successors = collections.defaultdict(list)
+ for t in troubled:
+ for p in repo[t].parents():
+ try:
+ s = _singlesuccessor(repo, repo[p])
+ except MultipleSuccessorsError, exc:
+ successors[s].extend(exc.successorssets)
+ successors[s].append(t)
+
+ # Yield the revs that will evolve on descendants of .
+ tovisit = collections.deque(nonobsdescendants)
+ while tovisit:
+ n = tovisit.popleft()
+ if not n in successors:
+ # no rev will evolve on that one
+ pass
+ elif len(successors[n]) > 1:
+ # ambiguity
+ msg = _("several successors for %d %s\n") % n
+ hint = _("select one with --rev\n") % successors[n]
+ raise error.Abort(msg, hint=hint)
+ else:
+ successor = successors[n][0]
+ if successor in troubled:
+ yield successor
+ tovisit.append(successor)
+
### Troubled revset symbol
@eh.revset('troubled')