# HG changeset patch # User Siddharth Agarwal # Date 1416001645 28800 # Node ID 9a2489015592a54bfc6ce535a00e116b1f04b575 # Parent 194508240dc93eda1d473fd067cf0d663c25ef08 ancestor.missingancestors: calculate start point after filtering revsvisit Any revs that are filtered out are also in basesvisit, which means they wouldn't be returned in the missing list anyway. There's no need to explore such revs or their ancestors. The 'if not revsvisit' check moves down because we can't call max() on an empty set. diff -r 194508240dc9 -r 9a2489015592 mercurial/ancestor.py --- a/mercurial/ancestor.py Fri Nov 14 11:33:52 2014 -0800 +++ b/mercurial/ancestor.py Fri Nov 14 13:47:25 2014 -0800 @@ -148,13 +148,13 @@ revsvisit = set(revs) basesvisit = set(bases) - if not revsvisit: - return [] if not basesvisit: basesvisit.add(nullrev) - start = max(max(revsvisit), max(basesvisit)) bothvisit = revsvisit.intersection(basesvisit) revsvisit.difference_update(bothvisit) + if not revsvisit: + return [] + start = max(max(revsvisit), max(basesvisit)) # At this point, we hold the invariants that: # - revsvisit is the set of nodes we know are an ancestor of at least one # of the nodes in revs