changeset 11950:d157e040ac4c stable

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
author Alecs King <alecsk@gmail.com>
date Fri, 13 Aug 2010 14:29:30 +0800
parents 8e56928e8991
children 03b5ad552b42
files mercurial/cmdutil.py
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Tue Aug 17 17:33:42 2010 +0200
+++ b/mercurial/cmdutil.py	Fri Aug 13 14:29:30 2010 +0800
@@ -663,7 +663,7 @@
             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 @@
             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):