# HG changeset patch # User Jun Wu # Date 1529010266 25200 # Node ID 03350f5234a48daa3cdaf62f9c534c62b4bb46ed # Parent 6caca2a7d37f081fdbf86ff2c9c5aadde6713f4d crecord: fix line number in hunk header (issue5917) `@@ -1,1 +-1,0 @@` is not a valid patch hunk header. Change it to `@@ -1,1 +0,0 @@`. Differential Revision: https://phab.mercurial-scm.org/D3737 diff -r 6caca2a7d37f -r 03350f5234a4 mercurial/crecord.py --- a/mercurial/crecord.py Wed Jun 13 10:41:20 2018 -0400 +++ b/mercurial/crecord.py Thu Jun 14 14:04:26 2018 -0700 @@ -398,7 +398,7 @@ if fromline != 0: if fromlen == 0: fromline -= 1 - if tolen == 0: + if tolen == 0 and toline > 0: toline -= 1 fromtoline = '@@ -%d,%d +%d,%d @@%s\n' % ( diff -r 6caca2a7d37f -r 03350f5234a4 tests/test-commit-interactive-curses.t --- a/tests/test-commit-interactive-curses.t Wed Jun 13 10:41:20 2018 -0400 +++ b/tests/test-commit-interactive-curses.t Thu Jun 14 14:04:26 2018 -0700 @@ -214,6 +214,14 @@ @@ -0,0 +1,1 @@ +hello world +Make file empty + $ echo -n > x + $ cat <testModeCommands + > X + > EOF + $ hg ci -i -m emptify -d "0 0" + $ hg update -C '.^' -q + Editing a hunk puts you back on that hunk when done editing (issue5041) To do that, we change two lines in a file, pretend to edit the second line, exit, toggle the line selected at the end of the edit and commit. @@ -236,7 +244,7 @@ > X > EOF $ printf "printf 'editor ran\n'; exit 0" > editor.sh - $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "edit hunk" -d "0 0" + $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "edit hunk" -d "0 0" -q editor ran $ hg cat -r . x foo