On 24/05/2018 15:43, Yuya Nishihara wrote:
On Thu, 24 May 2018 10:38:56 +0200, Boris Feld wrote:
# HG changeset patch
# User Boris Feld <boris.f...@octobus.net>
# Date 1526993961 -7200
#      Tue May 22 14:59:21 2018 +0200
# Node ID d76075d78a860ea2b3e01f3c05969cd0b8839f35
# Parent  2f2232e5f0b60a3dd591ea16dfffc3c0a050acdc
# EXP-Topic diff-cleanup
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
d76075d78a86
diff: accept "dict" as diff option
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -34,7 +34,6 @@ from . import (
      patch,
      pathutil,
      phases,
-    pycompat,
      repoview,
      revlog,
      scmutil,
@@ -302,9 +301,8 @@ class basectx(object):
              ctx2 = self.p1()
          if ctx2 is not None:
              ctx2 = self._repo[ctx2]
-        diffopts = patch.diffopts(self._repo.ui, pycompat.byteskwargs(opts))
          return patch.diff(self._repo, ctx2, self, match=match, 
changes=changes,
-                          opts=diffopts, losedatafn=losedatafn, prefix=prefix,
+                          opts=opts, losedatafn=losedatafn, prefix=prefix,
I think this goes the opposite direction. We've introduced patch.diff*opts()
functions because initializing diffopts by patch.diffopts() tends to be buggy.
Creating diffopts object requires the patch module. This creates a cycle in places where we would need it.

We have a slight preference on passing opts as dict as it would simplify callers code, but it's not a strong preference.

I'd rather force callers of ctx.diff() to build a diffopts object.
Do you see a way to solves the import cycle?
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to