Mercurial > public > mercurial-scm > hg-stable
diff mercurial/patch.py @ 23924:0db6810e84e8 stable
diff: use binary diff when copy source is binary
When a binary source has been copied or renamed into a non-binary
file, we don't check whether the copy source was binary. There is a
code comment explaining that a git mode will be forced anyway in order
to capture the copy record (i.e. losedatafn() will be called). This is
true, but forcing git mode is not the only effect binary files have:
when git mode was already requested, we use the binary-ness to tell us
whether to use a regular unified diff or a git binary diff. The user
sees this as a "Binary file $file has changed" instead of the binary
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sat, 17 Jan 2015 15:03:41 -0800 |
parents | ed645dc672e5 |
children | d8330fb8c44d |
line wrap: on
line diff
--- a/mercurial/patch.py Sun Jan 18 15:15:40 2015 -0500 +++ b/mercurial/patch.py Sat Jan 17 15:03:41 2015 -0800 @@ -1831,10 +1831,7 @@ header.append('new file mode %s\n' % mode) elif ctx2.flags(f): losedatafn(f) - # In theory, if tn was copied or renamed we should check - # if the source is binary too but the copy record already - # forces git mode. - if util.binary(tn): + if util.binary(to) or util.binary(tn): if opts.git: binarydiff = True else: