log speedup: use only ui.write in changeset_printer.show
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Sat, 28 Oct 2006 20:21:54 -0300
changeset 3572 fe03c9a476f6
parent 3571 736a78469a85
child 3573 31401776153f
log speedup: use only ui.write in changeset_printer.show - ui.status is not very useful, since this code is never executed when ui.quiet is true. - explicitly checking for ui.debug allows a regular hg log to run without looking at the manifest index - the calls to ui.note were converted for consistency
mercurial/commands.py
--- a/mercurial/commands.py	Sat Oct 28 20:21:52 2006 -0300
+++ b/mercurial/commands.py	Sat Oct 28 20:21:54 2006 -0300
@@ -329,9 +329,9 @@
         self.ui.write(_("changeset:   %d:%s\n") % (rev, hexfunc(changenode)))
 
         if branch:
-            self.ui.status(_("branch:      %s\n") % branch)
+            self.ui.write(_("branch:      %s\n") % branch)
         for tag in self.repo.nodetags(changenode):
-            self.ui.status(_("tag:         %s\n") % tag)
+            self.ui.write(_("tag:         %s\n") % tag)
         for parent in parents:
             self.ui.write(_("parent:      %d:%s\n") % parent)
 
@@ -339,40 +339,41 @@
             br = brinfo[changenode]
             self.ui.write(_("branch:      %s\n") % " ".join(br))
 
-        self.ui.debug(_("manifest:    %d:%s\n") %
-                      (self.repo.manifest.rev(changes[0]), hex(changes[0])))
-        self.ui.status(_("user:        %s\n") % changes[1])
-        self.ui.status(_("date:        %s\n") % date)
+        if self.ui.debugflag:
+            self.ui.write(_("manifest:    %d:%s\n") %
+                          (self.repo.manifest.rev(changes[0]), hex(changes[0])))
+        self.ui.write(_("user:        %s\n") % changes[1])
+        self.ui.write(_("date:        %s\n") % date)
 
         if self.ui.debugflag:
             files = self.repo.status(log.parents(changenode)[0], changenode)[:3]
             for key, value in zip([_("files:"), _("files+:"), _("files-:")],
                                   files):
                 if value:
-                    self.ui.note("%-12s %s\n" % (key, " ".join(value)))
-        elif changes[3]:
-            self.ui.note(_("files:       %s\n") % " ".join(changes[3]))
-        if copies:
+                    self.ui.write("%-12s %s\n" % (key, " ".join(value)))
+        elif changes[3] and self.ui.verbose:
+            self.ui.write(_("files:       %s\n") % " ".join(changes[3]))
+        if copies and self.ui.verbose:
             copies = ['%s (%s)' % c for c in copies]
-            self.ui.note(_("copies:      %s\n") % ' '.join(copies))
+            self.ui.write(_("copies:      %s\n") % ' '.join(copies))
 
         if extra and self.ui.debugflag:
             extraitems = extra.items()
             extraitems.sort()
             for key, value in extraitems:
-                self.ui.debug(_("extra:       %s=%s\n")
+                self.ui.write(_("extra:       %s=%s\n")
                               % (key, value.encode('string_escape')))
 
         description = changes[4].strip()
         if description:
             if self.ui.verbose:
-                self.ui.status(_("description:\n"))
-                self.ui.status(description)
-                self.ui.status("\n\n")
+                self.ui.write(_("description:\n"))
+                self.ui.write(description)
+                self.ui.write("\n\n")
             else:
-                self.ui.status(_("summary:     %s\n") %
-                               description.splitlines()[0])
-        self.ui.status("\n")
+                self.ui.write(_("summary:     %s\n") %
+                              description.splitlines()[0])
+        self.ui.write("\n")
 
 def show_changeset(ui, repo, opts):
     """show one changeset using template or regular display.