Title: [171856] trunk/Tools
Revision
171856
Author
[email protected]
Date
2014-07-31 09:24:02 -0700 (Thu, 31 Jul 2014)

Log Message

[webkitpy] Make diff_text generate correct diff if there is no newline at the end of file
https://bugs.webkit.org/show_bug.cgi?id=135381

Patch by Tibor Meszaros <[email protected]> on 2014-07-31
Reviewed by Csaba Osztrogonác.

* Scripts/webkitpy/port/base.py:
(Port.diff_text):
* Scripts/webkitpy/port/base_unittest.py:
(PortTest.test_diff_text):

Modified Paths

Property Changed

Diff

Modified: trunk/Tools/ChangeLog (171855 => 171856)


--- trunk/Tools/ChangeLog	2014-07-31 16:16:14 UTC (rev 171855)
+++ trunk/Tools/ChangeLog	2014-07-31 16:24:02 UTC (rev 171856)
@@ -1,3 +1,15 @@
+2014-07-31  Tibor Meszaros  <[email protected]>
+
+        [webkitpy] Make diff_text generate correct diff if there is no newline at the end of file
+        https://bugs.webkit.org/show_bug.cgi?id=135381
+
+        Reviewed by Csaba Osztrogonác.
+
+        * Scripts/webkitpy/port/base.py:
+        (Port.diff_text):
+        * Scripts/webkitpy/port/base_unittest.py:
+        (PortTest.test_diff_text):
+
 2014-07-31  Carlos Garcia Campos  <[email protected]>
 
         Unreviewed. Fix GTK+ make distcheck.

Modified: trunk/Tools/Scripts/webkitpy/port/base.py (171855 => 171856)


--- trunk/Tools/Scripts/webkitpy/port/base.py	2014-07-31 16:16:14 UTC (rev 171855)
+++ trunk/Tools/Scripts/webkitpy/port/base.py	2014-07-31 16:24:02 UTC (rev 171856)
@@ -313,7 +313,12 @@
                                     actual_text.splitlines(True),
                                     expected_filename,
                                     actual_filename)
-        return ''.join(diff)
+        result = ""
+        for line in diff:
+            result += line
+            if not line.endswith('\n'):
+                result += '\n\ No newline at end of file\n'
+        return result
 
     def check_for_leaks(self, process_name, process_pid):
         # Subclasses should check for leaks in the running process

Modified: trunk/Tools/Scripts/webkitpy/port/base_unittest.py (171855 => 171856)


--- trunk/Tools/Scripts/webkitpy/port/base_unittest.py	2014-07-31 16:16:14 UTC (rev 171855)
+++ trunk/Tools/Scripts/webkitpy/port/base_unittest.py	2014-07-31 16:24:02 UTC (rev 171856)
@@ -108,6 +108,11 @@
         port.diff_text(
             u'a\xac\u1234\u20ac\U00008000', 'act', 'exp.txt', 'act.txt')
 
+        t1 = "A\n\nB"
+        t2 = "A\n\nB\n\n\n"
+        t3 = "--- exp.txt\n+++ act.txt\n@@ -1,3 +1,5 @@\n A\n \n-B\n\ No newline at end of file\n+B\n+\n+\n"
+        self.assertEqual(t3, port.diff_text(t1, t2, 'exp.txt', 'act.txt'))
+
         # And make sure we actually get diff output.
         diff = port.diff_text('foo', 'bar', 'exp.txt', 'act.txt')
         self.assertIn('foo', diff)
Property changes on: trunk/Tools/Scripts/webkitpy/port/base_unittest.py
___________________________________________________________________

Added: svn:executable

_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to