Re: [PATCH 03 of 12 V2] context: also accept diff option directly

2018-07-03 Thread Yuya Nishihara
On Tue, 03 Jul 2018 12:32:22 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld 
> # Date 1529756343 -3600
> #  Sat Jun 23 13:19:03 2018 +0100
> # Node ID 9d94a3118a9c253a09bdf48258548dca92e35018
> # Parent  e6ba698b9c7354f21e2ae764a11e043872990d79
> # EXP-Topic diff-cleanup
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> 9d94a3118a9c
> context: also accept diff option directly

Queued up to this patch, thanks.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 03 of 12 V2] context: also accept diff option directly

2018-07-03 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1529756343 -3600
#  Sat Jun 23 13:19:03 2018 +0100
# Node ID 9d94a3118a9c253a09bdf48258548dca92e35018
# Parent  e6ba698b9c7354f21e2ae764a11e043872990d79
# EXP-Topic diff-cleanup
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
9d94a3118a9c
context: also accept diff option directly

For now we accept both diff option and dictionary. This will let us upgrade
internal users gradually before we drop the old API at the end of this series.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -30,6 +30,7 @@ from . import (
 error,
 fileset,
 match as matchmod,
+mdiff,
 obsolete as obsmod,
 patch,
 pathutil,
@@ -302,7 +303,11 @@ class basectx(object):
 ctx2 = self.p1()
 if ctx2 is not None:
 ctx2 = self._repo[ctx2]
-diffopts = patch.diffopts(self._repo.ui, opts)
+
+if isinstance(opts, mdiff.diffopts):
+diffopts = opts
+else:
+diffopts = patch.diffopts(self._repo.ui, opts)
 return patch.diff(self._repo, ctx2, self, match=match, changes=changes,
   opts=diffopts, losedatafn=losedatafn, prefix=prefix,
   relroot=relroot, copy=copy,
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel