Mercurial > hg
comparison mercurial/graphmod.py @ 14088:e83ced8b6464
graphlog: use a set for inclusion test
This makes a big difference in performance in the special case where all
revisions are being graphed.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sat, 30 Apr 2011 19:42:00 +0200 |
parents | f3d585c9b042 |
children | 03e1c2d35c6a |
comparison
equal
deleted
inserted
replaced
14087:f3d585c9b042 | 14088:e83ced8b6464 |
---|---|
34 | 34 |
35 cl = repo.changelog | 35 cl = repo.changelog |
36 lowestrev = min(revs) | 36 lowestrev = min(revs) |
37 gpcache = {} | 37 gpcache = {} |
38 | 38 |
39 knownrevs = set(revs) | |
39 for rev in revs: | 40 for rev in revs: |
40 ctx = repo[rev] | 41 ctx = repo[rev] |
41 parents = sorted(set([p.rev() for p in ctx.parents() if p.rev() in revs])) | 42 parents = sorted(set([p.rev() for p in ctx.parents() |
43 if p.rev() in knownrevs])) | |
42 mpars = [p.rev() for p in ctx.parents() if | 44 mpars = [p.rev() for p in ctx.parents() if |
43 p.rev() != nullrev and p.rev() not in parents] | 45 p.rev() != nullrev and p.rev() not in parents] |
44 | 46 |
45 for mpar in mpars: | 47 for mpar in mpars: |
46 gp = gpcache.get(mpar) or grandparent(cl, lowestrev, revs, mpar) | 48 gp = gpcache.get(mpar) or grandparent(cl, lowestrev, revs, mpar) |