# HG changeset patch # User Mads Kiilerich <m...@kiilerich.com> # Date 1497727704 -7200 # Sat Jun 17 21:28:24 2017 +0200 # Branch stable # Node ID 2dae66ed58c0e2440a344ab8de645436a4c1f1a6 # Parent 1968bc846c16d0cf59a573daf879bb842daaf7f1 mq: create non-lossy patches, also with [diff] nobinary=True
Users with custom diff configuration most certainly didn't intend it to make mq drop changes. diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -503,7 +503,7 @@ class queue(object): self.guardsdirty = False self.activeguards = None - def diffopts(self, opts=None, patchfn=None): + def diffopts(self, opts=None, patchfn=None, stable=False): diffopts = patchmod.diffopts(self.ui, opts) if self.gitmode == 'auto': diffopts.upgrade = True @@ -516,6 +516,11 @@ class queue(object): ' got %s') % self.gitmode) if patchfn: diffopts = self.patchopts(diffopts, patchfn) + if stable: + # disable custom diff configuration - we need a stable format + diffopts.nobinary = False + # note: diff options showfunc and unified might influence diffs + # but don't do any harm return diffopts def patchopts(self, diffopts, *patches): @@ -1178,7 +1183,7 @@ class queue(object): date = opts.get('date') if date: date = util.parsedate(date) - diffopts = self.diffopts({'git': opts.get('git')}) + diffopts = self.diffopts({'git': opts.get('git')}, stable=True) if opts.get('checkname', True): self.checkpatchname(patchfn) inclsubs = checksubstate(repo) @@ -1644,7 +1649,8 @@ class queue(object): substatestate = repo.dirstate['.hgsubstate'] ph = patchheader(self.join(patchfn), self.plainmode) - diffopts = self.diffopts({'git': opts.get('git')}, patchfn) + diffopts = self.diffopts({'git': opts.get('git')}, patchfn, + stable=True) if newuser: ph.setuser(newuser) if newdate: diff --git a/tests/test-mq-git.t b/tests/test-mq-git.t --- a/tests/test-mq-git.t +++ b/tests/test-mq-git.t @@ -241,7 +241,11 @@ Test how [diff] configuration influence # Parent fb9c4422b0f37dd576522dd9a3f99b825c177efe diff --git b b - Binary file b has changed + index 78981922613b2afb6025042ff6bd878ac1994e85..f76dd238ade08917e6712764a16a22005a50573d + GIT binary patch + literal 1 + Ic${MZ000310RR91 + $ cd .. _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel