[Reproducible-commits] [diffoscope] 01/01: Split lines when adding comments

Jérémy Bobbio lunar at moszumanska.debian.org
Sat Oct 17 13:23:06 UTC 2015


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch master
in repository diffoscope.

commit b8688d3c9b1e9022bfddef30c0edf04827c2d417
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Sat Oct 17 13:17:44 2015 +0000

    Split lines when adding comments
    
    We want to break lines in comments all the same in HTML or text output. So
    let's do it just when they get added.
---
 diffoscope/difference.py      | 3 ++-
 diffoscope/presenters/text.py | 3 +--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/diffoscope/difference.py b/diffoscope/difference.py
index 2202afa..0c094f4 100644
--- a/diffoscope/difference.py
+++ b/diffoscope/difference.py
@@ -367,7 +367,8 @@ class Difference(object):
         return self._comments
 
     def add_comment(self, comment):
-        self._comments.append(comment)
+        for line in comment.splitlines():
+            self._comments.append(line)
 
     @property
     def source1(self):
diff --git a/diffoscope/presenters/text.py b/diffoscope/presenters/text.py
index 7607d15..b74b329 100644
--- a/diffoscope/presenters/text.py
+++ b/diffoscope/presenters/text.py
@@ -25,8 +25,7 @@ from diffoscope import logger
 def print_difference(difference, print_func):
     if difference.comments:
         for comment in difference.comments:
-            for line in comment.split('\n'):
-                print_func(u"│┄ %s" % line)
+            print_func(u"│┄ %s" % comment)
     if difference.unified_diff:
         for line in difference.unified_diff.splitlines():
             print_func(u"│ %s" % line)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git



More information about the Reproducible-commits mailing list