diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -387,7 +387,7 @@ class uihunk(patchnode): contextlen = (len(self.before) + len(self.after) + removedconvertedtocontext) - if self.after and self.after[-1] == '\\ no newline at end of file\n': + if self.after and self.after[-1] == '\\ No newline at end of file\n': contextlen -= 1 fromlen = contextlen + self.removed tolen = contextlen + self.added diff --git a/tests/test-commit-interactive-curses.t b/tests/test-commit-interactive-curses.t --- a/tests/test-commit-interactive-curses.t +++ b/tests/test-commit-interactive-curses.t @@ -9,6 +9,21 @@ Set up a repo > crecordtest = testModeCommands > EOF +Record with noeol at eof (issue5268) + $ hg init noeol + $ cd noeol + $ printf '0' > a + $ printf '0\n' > b + $ hg ci -Aqm initial + $ printf '1\n0' > a + $ printf '1\n0\n' > b + $ cat <testModeCommands + > c + > EOF + $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "add hunks" -d "0 0" + $ cd .. + +Normal repo $ hg init a $ cd a