[PATCH 2 of 6 stable] mq: create non-lossy patches, also with [diff] nobinary=True

Yuya Nishihara yuya at tcha.org
Sun Jun 18 03:03:53 EDT 2017


On Sat, 17 Jun 2017 23:06:18 +0200, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <mads at 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

The direction seems good, but can't we use patchmod.difffeatureopts() ?


More information about the Mercurial-devel mailing list