changeset 38587:b62000a28812

diffutil: remove diffopts() in favor of diffallopts() patch.diffopts() exists only for backward compatibility. We don't need it in new module.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 06 Jul 2018 21:41:36 +0900
parents 79d7d715f3d0
children 1c93e0237a24
files contrib/synthrepo.py mercurial/obsutil.py mercurial/patch.py mercurial/revset.py mercurial/templatekw.py mercurial/utils/diffutil.py tests/test-context.py
diffstat 7 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/synthrepo.py	Fri Jul 06 21:38:33 2018 +0900
+++ b/contrib/synthrepo.py	Fri Jul 06 21:41:36 2018 +0900
@@ -196,7 +196,7 @@
             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
--- a/mercurial/obsutil.py	Fri Jul 06 21:38:33 2018 +0900
+++ b/mercurial/obsutil.py	Fri Jul 06 21:41:36 2018 +0900
@@ -395,7 +395,7 @@
 
     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()]
--- a/mercurial/patch.py	Fri Jul 06 21:38:33 2018 +0900
+++ b/mercurial/patch.py	Fri Jul 06 21:41:36 2018 +0900
@@ -2233,7 +2233,7 @@
 class GitDiffRequired(Exception):
     pass
 
-diffopts = diffutil.diffopts
+diffopts = diffutil.diffallopts
 diffallopts = diffutil.diffallopts
 difffeatureopts = diffutil.difffeatureopts
 
--- a/mercurial/revset.py	Fri Jul 06 21:38:33 2018 +0900
+++ b/mercurial/revset.py	Fri Jul 06 21:41:36 2018 +0900
@@ -1805,7 +1805,7 @@
         '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)
--- a/mercurial/templatekw.py	Fri Jul 06 21:38:33 2018 +0900
+++ b/mercurial/templatekw.py	Fri Jul 06 21:41:36 2018 +0900
@@ -265,7 +265,7 @@
     """
     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)
--- a/mercurial/utils/diffutil.py	Fri Jul 06 21:38:33 2018 +0900
+++ b/mercurial/utils/diffutil.py	Fri Jul 06 21:41:36 2018 +0900
@@ -21,8 +21,6 @@
     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
--- a/tests/test-context.py	Fri Jul 06 21:38:33 2018 +0900
+++ b/tests/test-context.py	Fri Jul 06 21:41:36 2018 +0900
@@ -77,7 +77,7 @@
 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'')