changeset 14832:d60e4f227d75 stable

patch: fix parsing patch files containing CRs not followed by LFs Since 1e64e1e12195 , patch lines containing a CR not followed by a LF would be incorrectly splitten, causing a failure to apply the patch.
author Wagner Bruna <wbruna@softwareexpress.com.br>
date Mon, 04 Jul 2011 19:53:39 -0300
parents 0407b7613e99
children 308e1b5acc87
files mercurial/patch.py tests/test-patch.t
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Tue Jul 05 11:53:32 2011 +0100
+++ b/mercurial/patch.py	Mon Jul 04 19:53:39 2011 -0300
@@ -593,7 +593,7 @@
                 self.exists = backend.exists(self.fname)
             self.missing = False
             if data:
-                self.lines = data.splitlines(True)
+                self.lines = mdiff.splitnewlines(data)
             if self.mode is None:
                 self.mode = mode
             if self.lines:
--- a/tests/test-patch.t	Tue Jul 05 11:53:32 2011 +0100
+++ b/tests/test-patch.t	Mon Jul 04 19:53:39 2011 -0300
@@ -46,9 +46,9 @@
   $ rm $HGRCPATH
   $ hg init c
   $ cd c
-  $ echo 0 > a
+  $ printf "a\rc" > a
   $ hg ci -A -m 0 a -d '0 0'
-  $ echo 1 >> a
+  $ printf "a\rb\rc" > a
   $ cat << eof > log
   > first line which can't start with '# '
   > # second line is a comment but that shouldn't be a problem.
@@ -73,7 +73,7 @@
   $ hg import ../c/p
   applying ../c/p
   $ hg log -v -r 1
-  changeset:   1:e8cc66fbbaa6
+  changeset:   1:cd0bde79c428
   tag:         tip
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000