From patchwork Fri Mar 8 23:24:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [stable] : fix binary file removals in git mode. From: =?utf-8?q?Johan_Bj=C3=B6rk?= X-Patchwork-Id: 1086 Message-Id: To: mercurial-devel@selenic.com Date: Fri, 8 Mar 2013 18:24:38 -0500 # HG changeset patch # User Johan Bjork # Date 1362436451 0 # Branch stable # Node ID d0a224efdd3cfb5e5b54cdb805b92460a40c5f44 # Parent 605c7c94fd70dcdb2ed695e8420e6ddae10a3a5b diff: fix binary file removals in git mode. With the previous version, a binary file removal diff generated with diff --git a/bintoregular b/bintoregular diff --git would not apply with 'git apply' with the error " error: removal patch leaves file contents error: : patch does not apply " diff -r 605c7c94fd70 -r d0a224efdd3c mercurial/patch.py --- a/mercurial/patch.py Thu Feb 28 21:53:13 2013 -0600 +++ b/mercurial/patch.py Mon Mar 04 22:34:11 2013 +0000 @@ -1756,6 +1756,8 @@ else: header.append('deleted file mode %s\n' % gitmode[man1.flags(f)]) + if util.binary(to): + dodiff = 'binary' elif not to or util.binary(to): # regular diffs cannot represent empty file deletion losedatafn(f) diff -r 605c7c94fd70 -r d0a224efdd3c tests/test-diff-upgrade.t --- a/tests/test-diff-upgrade.t Thu Feb 28 21:53:13 2013 -0600 +++ b/tests/test-diff-upgrade.t Mon Mar 04 22:34:11 2013 +0000 @@ -200,7 +200,11 @@ % git=auto: git diff for rmbinary diff --git a/rmbinary b/rmbinary deleted file mode 100644 - Binary file rmbinary has changed + index f76dd238ade08917e6712764a16a22005a50573d..0000000000000000000000000000000000000000 + GIT binary patch + literal 0 + Hc$@