# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1490541771 -19800
#      Sun Mar 26 20:52:51 2017 +0530
# Node ID 989c6385adcc3385ab984a718e09fa5d694563c4
# Parent  2632df096fc0ac7582382b1f94ea4b9ad0bce8f2
diff: slice over bytes to make sure conditions work normally

Both of this are part of generating `hg diff` on python 3.

diff -r 2632df096fc0 -r 989c6385adcc mercurial/mdiff.py
--- a/mercurial/mdiff.py        Sun Mar 26 20:49:18 2017 +0530
+++ b/mercurial/mdiff.py        Sun Mar 26 20:52:51 2017 +0530
@@ -227,7 +227,7 @@
 
     def checknonewline(lines):
         for text in lines:
-            if text[-1] != '\n':
+            if text[-1:len(text)] != '\n':
                 text += "\n\ No newline at end of file\n"
             yield text
 
diff -r 2632df096fc0 -r 989c6385adcc mercurial/patch.py
--- a/mercurial/patch.py        Sun Mar 26 20:49:18 2017 +0530
+++ b/mercurial/patch.py        Sun Mar 26 20:52:51 2017 +0530
@@ -737,7 +737,7 @@
         for x in self.rej:
             for l in x.hunk:
                 lines.append(l)
-                if l[-1] != '\n':
+                if l[-1:len(l)] != '\n':
                     lines.append("\n\ No newline at end of file\n")
         self.backend.writerej(self.fname, len(self.rej), self.hunks, lines)
 
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to