changeset 3576:00427c4b533b

log speedup: don't call revlog.node if we don't have to
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sat, 28 Oct 2006 20:21:59 -0300
parents 0facae7566cc
children 7f7425306925
files mercurial/commands.py
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Oct 28 20:21:57 2006 -0300
+++ b/mercurial/commands.py	Sat Oct 28 20:21:59 2006 -0300
@@ -320,11 +320,13 @@
 
         hexfunc = self.ui.debugflag and hex or short
 
-        parents = [(p, hexfunc(log.node(p))) for p in log.parentrevs(rev)
-                   if self.ui.debugflag or p != -1]
-        if (not self.ui.debugflag and len(parents) == 1 and
-            parents[0][0] == rev-1):
-            parents = []
+        parents = log.parentrevs(rev)
+        if not self.ui.debugflag:
+            parents = [p for p in parents if p != -1]
+            if len(parents) == 1 and parents[0] == rev-1:
+                parents = []
+        parents = [(p, hexfunc(log.node(p))) for p in parents]
+
 
         self.ui.write(_("changeset:   %d:%s\n") % (rev, hexfunc(changenode)))
 
@@ -1915,7 +1917,7 @@
                     rename = getrenamed(fn, rev, mf)
                     if rename:
                         copies.append((fn, rename[0]))
-            displayer.show(rev, brinfo=br, copies=copies)
+            displayer.show(rev, changenode, brinfo=br, copies=copies)
             if opts['patch']:
                 if parents:
                     prev = parents[0]