changeset 18824:f0d55e1b4855

diff: fix binary file removals in git mode. With the previous version, a binary file removal diff generated with
author Johan Bjork <jbjoerk@gmail.com>
date Mon, 04 Mar 2013 22:34:11 +0000
parents b2a36e9b9ccc
children f0564402d059
files mercurial/patch.py tests/test-diff-upgrade.t
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Sun Mar 24 16:56:25 2013 -0700
+++ 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)
--- a/tests/test-diff-upgrade.t	Sun Mar 24 16:56:25 2013 -0700
+++ 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$@<O00001
+  
   
   % git=auto: git diff for bintoregular
   diff --git a/bintoregular b/bintoregular
@@ -210,6 +214,7 @@
   Uc$`bh%qz(+N=+}#Ni5<5043uE82|tP
   
 
+
 git=warn: regular diff with data loss warnings
 
   $ hg autodiff --git=warn