[Reproducible-commits] [debbindiff] 07/08: Add newlines if needed in text output

Jérémy Bobbio lunar at moszumanska.debian.org
Fri Mar 20 11:31:42 UTC 2015


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

lunar pushed a commit to branch master
in repository debbindiff.

commit 7d21adb9089240519e33eb631429fd843446e1e7
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Fri Mar 20 12:26:04 2015 +0100

    Add newlines if needed in text output
---
 debbindiff/presenters/text.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/debbindiff/presenters/text.py b/debbindiff/presenters/text.py
index 4811490..dadd218 100644
--- a/debbindiff/presenters/text.py
+++ b/debbindiff/presenters/text.py
@@ -29,6 +29,12 @@ def print_difference(difference, print_func):
         for line in difference.comment.split('\n'):
             print_func(u"│┄ %s" % line)
     if difference.lines1 or difference.lines2:
+        if not difference.lines1[-1].endswith('\n'):
+            difference.lines1[-1] = difference.lines1[-1] + '\n'
+            difference.lines1.append('<No newline at the end>\n')
+        if not difference.lines2[-1].endswith('\n'):
+            difference.lines2[-1] = difference.lines2[-1] + '\n'
+            difference.lines2.append('<No newline at the end>\n')
         g = difflib.unified_diff(difference.lines1, difference.lines2)
         # First skip lines with filename
         g.next()

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



More information about the Reproducible-commits mailing list