# HG changeset patch # User Patrick Mezard # Date 1307305561 -7200 # Node ID e597ef52a7c21ffe862339225bd915438f2dddcc # Parent ecc79816d31e50e118c93cb9a78085111664273b patch: dot not ignore hunk of files marked as 'deleted' git 'deleted' flag was processed unconditionnally and the file removed even if the related hunk was not matching. diff -r ecc79816d31e -r e597ef52a7c2 mercurial/patch.py --- a/mercurial/patch.py Sun Jun 05 22:24:19 2011 +0200 +++ b/mercurial/patch.py Sun Jun 05 22:26:01 2011 +0200 @@ -1237,12 +1237,12 @@ if gp.oldpath: copysource = pstrip(gp.oldpath) changed[path] = gp - if gp.op == 'DELETE': - backend.unlink(path) - continue if gp.op == 'RENAME': backend.unlink(copysource) if not first_hunk: + if gp.op == 'DELETE': + backend.unlink(path) + continue data, mode = None, None if gp.op in ('RENAME', 'COPY'): data, mode = store.getfile(copysource) diff -r ecc79816d31e -r e597ef52a7c2 tests/test-git-import.t --- a/tests/test-git-import.t Sun Jun 05 22:24:19 2011 +0200 +++ b/tests/test-git-import.t Sun Jun 05 22:26:01 2011 +0200 @@ -442,4 +442,27 @@ [255] $ cat b b + + $ ln -s b linkb + $ hg add linkb + $ hg ci -m addlinkb + $ hg import --no-commit - < diff --git a/linkb b/linkb + > deleted file mode 120000 + > --- a/linkb + > +++ /dev/null + > @@ -1,1 +0,0 @@ + > -badhunk + > \ No newline at end of file + > EOF + applying patch from stdin + patching file linkb + Hunk #1 FAILED at 0 + 1 out of 1 hunks FAILED -- saving rejects to file linkb.rej + abort: patch failed to apply + [255] + $ hg st + ? b.rej + ? linkb.rej + $ cd ..