[PATCH 6 of 9 V2] synthrepo: pass a diffopts object to context.diff

Boris Feld boris.feld at octobus.net
Thu Jul 5 18:26:04 EDT 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1529757988 -7200
#      Sat Jun 23 14:46:28 2018 +0200
# Node ID c9c8f59da034530fc727b6918707a55f4edb9c5b
# Parent  9f46ea00651a4f26ea64be45f8b6d74bd9ab900b
# EXP-Topic diff-cleanup
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r c9c8f59da034
synthrepo: pass a diffopts object to context.diff

diff --git a/contrib/synthrepo.py b/contrib/synthrepo.py
--- a/contrib/synthrepo.py
+++ b/contrib/synthrepo.py
@@ -60,7 +60,10 @@ from mercurial import (
     registrar,
     scmutil,
 )
-from mercurial.utils import dateutil
+from mercurial.utils import (
+    dateutil,
+    diffutil,
+)
 
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
@@ -193,8 +196,9 @@ 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(ctx._repo.ui, {'git': True})
             diff = sum((d.splitlines()
-                       for d in ctx.diff(pctx, opts={'git': True})), [])
+                       for d in ctx.diff(pctx, opts=diffopts)), [])
             fileadds, diradds, fileremoves, filechanges = 0, 0, 0, 0
             for filename, mar, lineadd, lineremove, isbin in parsegitdiff(diff):
                 if isbin:


More information about the Mercurial-devel mailing list