[PATCH 1 of 4] context: explicitly take diffopts in `context.diff` (API)

Yuya Nishihara yuya at tcha.org
Thu May 24 09:31:33 EDT 2018


On Thu, 24 May 2018 10:38:54 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld at octobus.net>
> # Date 1526994172 -7200
> #      Tue May 22 15:02:52 2018 +0200
> # Node ID 4e013ebfa2c64f1849cb3a4242c47da981b35198
> # Parent  37ef6ee87488ac0095f8dedf75284f64d1d54455
> # EXP-Topic diff-cleanup
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 4e013ebfa2c6
> context: explicitly take diffopts in `context.diff` (API)
> 
> To provide a proper replacement for the `patch.diff(…)` function, the
> `context.diff(…)` method needs to be able to take more parameters. To
> distinguish the diff options from the other arguments new arguments, we
> upgrade the diff options to its own explicit argument.

A couple more ctx.diff() calls found:

contrib/synthrepo.py:199:52:            diff = sum((d.splitlines() for d in ctx.diff(pctx, git=True)), [])
mercurial/revset.py:1797:39:        'diff': lambda r: list(repo[r].diff(git=True),)

> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -294,7 +294,7 @@ class basectx(object):
>                                auditor=r.nofsauditor, ctx=self,
>                                listsubrepos=listsubrepos, badfn=badfn)
>  
> -    def diff(self, ctx2=None, match=None, **opts):
> +    def diff(self, ctx2=None, match=None, opts=None):
>          """Returns a diff generator for the given contexts and matcher"""
>          if ctx2 is None:
>              ctx2 = self.p1()

Needs to remove pycompat.byteskwargs(opts) since it's no longer a kwargs.


More information about the Mercurial-devel mailing list