# HG changeset patch # User Wagner Bruna # Date 1309820019 10800 # Node ID d60e4f227d753dff085a879dee1a92ce198f3615 # Parent 0407b7613e990dac2dc4ad98e2b206bd38c4ede2 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. diff -r 0407b7613e99 -r d60e4f227d75 mercurial/patch.py --- 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: diff -r 0407b7613e99 -r d60e4f227d75 tests/test-patch.t --- 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