[PATCH 6 of 7] diffutil: remove diffopts() in favor of diffallopts()

Yuya Nishihara yuya at tcha.org
Fri Jul 6 09:03:51 EDT 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1530880896 -32400
#      Fri Jul 06 21:41:36 2018 +0900
# Node ID c83051a12b0c5d269f00813b89ae9fa1cfd7cce8
# Parent  4ee2c39c085c9175efead3a9197b533dfe890bcb
diffutil: remove diffopts() in favor of diffallopts()

patch.diffopts() exists only for backward compatibility. We don't need it
in new module.

diff --git a/contrib/synthrepo.py b/contrib/synthrepo.py
--- a/contrib/synthrepo.py
+++ b/contrib/synthrepo.py
@@ -196,7 +196,7 @@ def analyze(ui, repo, *revs, **opts):
             if lastctx.rev() != nullrev:
                 timedelta = ctx.date()[0] - lastctx.date()[0]
                 interarrival[roundto(timedelta, 300)] += 1
-            diffopts = diffutil.diffopts(ui, {'git': True})
+            diffopts = diffutil.diffallopts(ui, {'git': True})
             diff = sum((d.splitlines()
                        for d in ctx.diff(pctx, opts=diffopts)), [])
             fileadds, diradds, fileremoves, filechanges = 0, 0, 0, 0
diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
--- a/mercurial/obsutil.py
+++ b/mercurial/obsutil.py
@@ -395,7 +395,7 @@ def _cmpdiff(leftctx, rightctx):
 
     This is a first and basic implementation, with many shortcoming.
     """
-    diffopts = diffutil.diffopts(leftctx.repo().ui, {'git': True})
+    diffopts = diffutil.diffallopts(leftctx.repo().ui, {'git': True})
     # Leftctx or right ctx might be filtered, so we need to use the contexts
     # with an unfiltered repository to safely compute the diff
     leftunfi = leftctx._repo.unfiltered()[leftctx.rev()]
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -2233,7 +2233,7 @@ def changedfiles(ui, repo, patchpath, st
 class GitDiffRequired(Exception):
     pass
 
-diffopts = diffutil.diffopts
+diffopts = diffutil.diffallopts
 diffallopts = diffutil.diffallopts
 difffeatureopts = diffutil.difffeatureopts
 
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1805,7 +1805,7 @@ def matching(repo, subset, x):
         'substate': lambda r: repo[r].substate,
         'summary': lambda r: repo[r].description().splitlines()[0],
         'diff': lambda r: list(repo[r].diff(
-            opts=diffutil.diffopts(repo.ui, {'git': True}))),
+            opts=diffutil.diffallopts(repo.ui, {'git': True}))),
     }
     for info in fields:
         getfield = _funcs.get(info, None)
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -265,7 +265,7 @@ def showdiffstat(context, mapping):
     """
     ui = context.resource(mapping, 'ui')
     ctx = context.resource(mapping, 'ctx')
-    diffopts = diffutil.diffopts(ui, {'noprefix': False})
+    diffopts = diffutil.diffallopts(ui, {'noprefix': False})
     diff = ctx.diff(opts=diffopts)
     stats = patch.diffstatdata(util.iterlines(diff))
     maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)
diff --git a/mercurial/utils/diffutil.py b/mercurial/utils/diffutil.py
--- a/mercurial/utils/diffutil.py
+++ b/mercurial/utils/diffutil.py
@@ -21,8 +21,6 @@ def diffallopts(ui, opts=None, untrusted
     return difffeatureopts(ui, opts=opts, untrusted=untrusted, section=section,
                            git=True, whitespace=True, formatchanging=True)
 
-diffopts = diffallopts
-
 def difffeatureopts(ui, opts=None, untrusted=False, section='diff', git=False,
                     whitespace=False, formatchanging=False):
     '''return diffopts with only opted-in features parsed
diff --git a/tests/test-context.py b/tests/test-context.py
--- a/tests/test-context.py
+++ b/tests/test-context.py
@@ -77,7 +77,7 @@ ctxb = context.memctx(repo, [ctxa.node()
 print(ctxb.status(ctxa))
 
 # test performing a diff on a memctx
-diffopts = diffutil.diffopts(repo.ui, {'git': True})
+diffopts = diffutil.diffallopts(repo.ui, {'git': True})
 for d in ctxb.diff(ctxa, opts=diffopts):
     printb(d, end=b'')
 


More information about the Mercurial-devel mailing list