Mercurial > hg
comparison tests/test-import-eol @ 10127:d8214e944b84
patch: fix eolmode=auto with new files
If target file does not exist or has no eol, current code was normalizing eols
to LF. Preserve patch file eols instead.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Wed, 23 Dec 2009 19:31:47 +0100 |
parents | 1720d70cd6d4 |
children | 7936cd261dc9 |
comparison
equal
deleted
inserted
replaced
10126:78b8acae2088 | 10127:d8214e944b84 |
---|---|
55 hg commit -m 'switch EOLs in a' | 55 hg commit -m 'switch EOLs in a' |
56 hg --traceback --config patch.eol='auto' import eol.diff | 56 hg --traceback --config patch.eol='auto' import eol.diff |
57 python -c 'print repr(file("a","rb").read())' | 57 python -c 'print repr(file("a","rb").read())' |
58 hg st | 58 hg st |
59 | 59 |
60 echo % auto EOL on new file or source without any EOL | |
61 python -c 'file("noeol", "wb").write("noeol")' | |
62 hg add noeol | |
63 hg commit -m 'add noeol' | |
64 python -c 'file("noeol", "wb").write("noeol\r\nnoeol\n")' | |
65 python -c 'file("neweol", "wb").write("neweol\nneweol\r\n")' | |
66 hg add neweol | |
67 hg diff --git > noeol.diff | |
68 hg revert --no-backup noeol neweol | |
69 rm neweol | |
70 hg --traceback --config patch.eol='auto' import -m noeol noeol.diff | |
71 python -c 'print repr(file("noeol","rb").read())' | |
72 python -c 'print repr(file("neweol","rb").read())' | |
73 hg st | |
74 | |
60 # Test --eol and binary patches | 75 # Test --eol and binary patches |
61 python -c 'file("b", "wb").write("a\x00\nb")' | 76 python -c 'file("b", "wb").write("a\x00\nb")' |
62 hg ci -Am addb | 77 hg ci -Am addb |
63 python -c 'file("b", "wb").write("a\x00\nc")' | 78 python -c 'file("b", "wb").write("a\x00\nc")' |
64 hg diff --git > bin.diff | 79 hg diff --git > bin.diff |