[PATCH] log: fix the bug 'hg log --stat -p == hg log --stat'

Alecs King alecsk at gmail.com
Fri Aug 13 01:48:54 CDT 2010


Mainly changed the caller path of diffordiffstat()

 mercurial/cmdutil.py |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)


# HG changeset patch
# User Alecs King <alecsk at gmail.com>
# Date 1281680970 -28800
# Branch my
# Node ID e99d162cff729ef6f6530e1e87151bb915df44f9
# Parent  fcc0fd2cbb8f487b32ded691f33ddd7280bea1f8
log: fix the bug 'hg log --stat -p == hg log --stat'

Before:
    hg log --stat -p -r tip # only show stat

After:
    hg log --stat -p -r tip # show stat _and_ diff

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -663,7 +663,7 @@ def diffordiffstat(ui, repo, diffopts, n
             fp.write(s)
 
     if stat:
-        diffopts.context = 0
+        diffopts = diffopts.copy(context=0)
         width = 80
         if not ui.plain():
             width = util.termwidth()
@@ -803,10 +803,17 @@ class changeset_printer(object):
             matchfn = self.patch
         if matchfn:
             stat = self.diffopts.get('stat')
+            diff = self.diffopts.get('patch')
             diffopts = patch.diffopts(self.ui, self.diffopts)
             prev = self.repo.changelog.parents(node)[0]
-            diffordiffstat(self.ui, self.repo, diffopts, prev, node,
-                           match=matchfn, stat=stat)
+            if stat:
+                diffordiffstat(self.ui, self.repo, diffopts, prev, node,
+                               match=matchfn, stat=True)
+            if diff:
+                if stat:
+                    self.ui.write("\n")
+                diffordiffstat(self.ui, self.repo, diffopts, prev, node,
+                               match=matchfn, stat=False)
             self.ui.write("\n")
 
     def _meaningful_parentrevs(self, log, rev):



More information about the Mercurial-devel mailing list