[Python-checkins] hooks: Indent diffstat with 2 spaces and another line break before the diff.

local-hg python-checkins at python.org
Wed Mar 23 19:51:34 CET 2011


http://hg.python.org/hooks/rev/de405da1192a
changeset:   68:de405da1192a
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Wed Mar 23 19:51:34 2011 +0100
summary:
  Indent diffstat with 2 spaces and another line break before the diff.

files:
  mail.py |  7 ++++---
  1 files changed, 4 insertions(+), 3 deletions(-)


diff --git a/mail.py b/mail.py
--- a/mail.py
+++ b/mail.py
@@ -62,9 +62,10 @@
     node1 = parents and parents[0].node() or nullid
     node2 = ctx.node()
     diffchunks = list(patch.diff(repo, node1, node2, opts=diffopts))
-    body.append(''.join(line for line in
-                        patch.diffstat(iterlines(diffchunks), width=60, git=True)
-                        ))
+    diffstat = patch.diffstat(iterlines(diffchunks), width=60, git=True)
+    for line in iterlines([''.join(diffstat)]):
+        body.append(' ' + line)
+    body += ['', '']
     body.append(''.join(chunk for chunk in diffchunks))
 
     body.append('-- ')

-- 
Repository URL: http://hg.python.org/hooks


More information about the Python-checkins mailing list