changeset 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 d3f7e110c3c0
files mercurial/graphmod.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/graphmod.py	Sat Apr 30 15:10:58 2011 +0300
+++ b/mercurial/graphmod.py	Sat Apr 30 19:42:00 2011 +0200
@@ -36,9 +36,11 @@
     lowestrev = min(revs)
     gpcache = {}
 
+    knownrevs = set(revs)
     for rev in revs:
         ctx = repo[rev]
-        parents = sorted(set([p.rev() for p in ctx.parents() if p.rev() in revs]))
+        parents = sorted(set([p.rev() for p in ctx.parents()
+                              if p.rev() in knownrevs]))
         mpars = [p.rev() for p in ctx.parents() if
                  p.rev() != nullrev and p.rev() not in parents]