##// END OF EJS Templates
Fixed patch.eol bug that truncated all patched lines to one character...
Colin Caughie -
r8817:6c9dce20 default
parent child Browse files
Show More
@@ -299,7 +299,7 b' class patchfile(object):'
299 if self.eol and self.eol != '\n':
299 if self.eol and self.eol != '\n':
300 for l in lines:
300 for l in lines:
301 if l and l[-1] == '\n':
301 if l and l[-1] == '\n':
302 l = l[:1] + self.eol
302 l = l[:-1] + self.eol
303 fp.write(l)
303 fp.write(l)
304 else:
304 else:
305 fp.writelines(lines)
305 fp.writelines(lines)
@@ -9,9 +9,10 b" w('--- a/a\\n')"
9 w('+++ b/a\n')
9 w('+++ b/a\n')
10 w('@@ -1,5 +1,5 @@\n')
10 w('@@ -1,5 +1,5 @@\n')
11 w(' a\n')
11 w(' a\n')
12 w('-b\r\n')
12 w('-bbb\r\n')
13 w('+y\r\n')
13 w('+yyyy\r\n')
14 w(' c\r\n')
14 w(' cc\r\n')
15 w(' \n')
15 w(' d\n')
16 w(' d\n')
16 w('-e\n')
17 w('-e\n')
17 w('\ No newline at end of file\n')
18 w('\ No newline at end of file\n')
@@ -24,7 +25,7 b' cd repo'
24 echo '\.diff' > .hgignore
25 echo '\.diff' > .hgignore
25
26
26 # Test different --eol values
27 # Test different --eol values
27 python -c 'file("a", "wb").write("a\nb\nc\nd\ne")'
28 python -c 'file("a", "wb").write("a\nbbb\ncc\n\nd\ne")'
28 hg ci -Am adda
29 hg ci -Am adda
29 python ../makepatch.py
30 python ../makepatch.py
30 echo % invalid eol
31 echo % invalid eol
@@ -5,11 +5,11 b' applying eol.diff'
5 abort: Unsupported line endings type: LFCR
5 abort: Unsupported line endings type: LFCR
6 % force LF
6 % force LF
7 applying eol.diff
7 applying eol.diff
8 'a\ny\nc\nd\nz'
8 'a\nyyyy\ncc\n\nd\ne'
9 % force CRLF
9 % force CRLF
10 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
10 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
11 applying eol.diff
11 applying eol.diff
12 'a\r\ny\r\nc\r\nd\r\nz'
12 'a\r\nyyyy\r\ncc\r\n\r\nd\r\ne'
13 adding b
13 adding b
14 % binary patch with --eol
14 % binary patch with --eol
15 applying bin.diff
15 applying bin.diff
General Comments 0
You need to be logged in to leave comments. Login now