Mercurial > public > mercurial-scm > hg
diff tests/test-diff-binary-file.t @ 31822:fde4822b0102
diff: add --binary option for git mode diffs
This patch adds --binary option to `hg diff` and `hg export` to allow more
control about when binary diffs are displayed in Git mode as well as some
tests to verify it behaves correctly (issue5510).
author | Alexander Fomin <afomin@fb.com> |
---|---|
date | Wed, 05 Apr 2017 15:31:08 -0700 |
parents | 66a9faadbc83 |
children | 75be14993fda |
line wrap: on
line diff
--- a/tests/test-diff-binary-file.t Wed Apr 05 15:15:06 2017 -0700 +++ b/tests/test-diff-binary-file.t Wed Apr 05 15:31:08 2017 -0700 @@ -108,4 +108,37 @@ \ No newline at end of file +\x00\x01\x02\x03 (esc) +Test binary mode with extended git-style diff format + $ hg diff --no-binary -r 0 -r 1 + diff -r fb45f71337ad -r 9ca112d1a3c1 binfile.bin + Binary file binfile.bin has changed + + $ hg diff --git --no-binary -r 0 -r 1 + diff --git a/binfile.bin b/binfile.bin + Binary file binfile.bin has changed + + $ hg diff --git --binary -r 0 -r 1 + diff --git a/binfile.bin b/binfile.bin + index eaf36c1daccfdf325514461cd1a2ffbc139b5464..ba71a782e93f3fb63a428383706065e3ec2828e9 + GIT binary patch + literal 5 + Mc${NkWMbw50018V5dZ)H + + $ hg diff --git --binary --config diff.nobinary=True -r 0 -r 1 + diff --git a/binfile.bin b/binfile.bin + index eaf36c1daccfdf325514461cd1a2ffbc139b5464..ba71a782e93f3fb63a428383706065e3ec2828e9 + GIT binary patch + literal 5 + Mc${NkWMbw50018V5dZ)H + + + $ hg diff --git --binary --text -r 0 -r 1 + diff --git a/binfile.bin b/binfile.bin + --- a/binfile.bin + +++ b/binfile.bin + @@ -1,1 +1,1 @@ + -\x00\x01\x02\x03 (esc) + \ No newline at end of file + +\x00\x01\x02\x03 (esc) + $ cd ..