log speedup: don't call revlog.node if we don't have to
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Sat, 28 Oct 2006 20:21:59 -0300
changeset 3576 00427c4b533b
parent 3575 0facae7566cc
child 3577 7f7425306925
log speedup: don't call revlog.node if we don't have to
mercurial/commands.py
--- 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]