diff -r a1bcc7ff0eac -r 230eb9594150 mercurial/diffhelpers.py --- a/mercurial/diffhelpers.py Mon Apr 09 21:08:52 2018 +0900 +++ b/mercurial/diffhelpers.py Sat Apr 07 01:37:25 2018 +0900 @@ -33,10 +33,10 @@ if s == "\\ No newline at end of file\n": fixnewline(hunk, a, b) continue - if s == "\n": + if s == '\n' or s == '\r\n': # Some patches may be missing the control char # on empty lines. Supply a leading space. - s = " \n" + s = ' ' + s hunk.append(s) if s.startswith('+'): b.append(s[1:])