Mercurial > hg-stable
changeset 10129:900ccbd79ef7
diffhelpers: handle CRLF in hunk last line without EOL
Note that diff generation code always ends last lines without newline with a
LF, so this is a tolerance.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Wed, 23 Dec 2009 19:31:48 +0100 |
parents | ea7c392f2b08 |
children | 7936cd261dc9 |
files | mercurial/diffhelpers.c tests/test-mq-eol |
diffstat | 2 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/diffhelpers.c Wed Dec 23 19:31:48 2009 +0100 +++ b/mercurial/diffhelpers.c Wed Dec 23 19:31:48 2009 +0100 @@ -22,6 +22,9 @@ PyObject *s = PyList_GET_ITEM(hunk, hunksz-1); char *l = PyString_AS_STRING(s); int sz = PyString_GET_SIZE(s); + if (sz > 1 && l[sz-2] == '\r') + /* tolerate CRLF in last line */ + sz -= 1; int alen = PyList_Size(a); int blen = PyList_Size(b); char c = l[0];