[PATCH 07 of 13] revset: introduce a _revinterval type and revsubset function
Matt Mackall
mpm at selenic.com
Mon Jun 4 16:58:31 CDT 2012
On Fri, 2012-06-01 at 15:52 -0700, Bryan O'Sullivan wrote:
> # HG changeset patch
> # User Bryan O'Sullivan <bryano at fb.com>
> # Date 1338591022 25200
> # Node ID 4b56ee070f13b26662ed848ed1c4cfaa6f4bf904
> # Parent 63833bb69bcaf02fec27610e8b3e11f56ae64031
> revset: introduce a _revinterval type and revsubset function
This has some stray bits:
> def _revancestors(repo, revs, followfirst):
> """Like revlog.ancestors(), but supports followfirst."""
> cut = followfirst and 1 or None
> @@ -58,23 +129,25 @@ def _revsbetween(repo, roots, heads):
> seen = {}
> minroot = min(roots)
> roots = set(roots)
> + addvisit = visit.append
> + addreachable = reachable.add
> # open-code the post-order traversal due to the tiny size of
> # sys.getrecursionlimit()
> while visit:
> rev = visit.pop()
> if rev in roots:
> - reachable.add(rev)
> + addreachable(rev)
> parents = parentrevs(rev)
> seen[rev] = parents
> for parent in parents:
> if parent >= minroot and parent not in seen:
> - visit.append(parent)
> + addvisit(parent)
> if not reachable:
> return []
> for rev in sorted(seen):
> for parent in seen[rev]:
> if parent in reachable:
> - reachable.add(rev)
> + addreachable(rev)
> return sorted(reachable)
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list