hgext/mq.py
changeset 9640 9e76232fbfbe
parent 9599 f3404b7f37ca
child 9642 7d17794f08a9
--- a/hgext/mq.py	Sun Oct 25 02:35:35 2009 +0200
+++ b/hgext/mq.py	Sun Oct 25 02:52:35 2009 +0200
@@ -420,11 +420,19 @@
 
     def printdiff(self, repo, node1, node2=None, files=None,
                   fp=None, changes=None, opts={}):
+        stat = opts.get('stat')
+        if stat:
+            opts['unified'] = '0'
+
         m = cmdutil.match(repo, files, opts)
         chunks = patch.diff(repo, node1, node2, m, changes, self.diffopts())
         write = fp is None and repo.ui.write or fp.write
-        for chunk in chunks:
-            write(chunk)
+        if stat:
+            width = self.ui.interactive() and util.termwidth() or 80
+            write(patch.diffstat(util.iterlines(chunks), width=width))
+        else:
+            for chunk in chunks:
+                write(chunk)
 
     def mergeone(self, repo, mergeq, head, patch, rev):
         # first try just applying the patch