comparison contrib/synthrepo.py @ 38567:97469c5430cd

synthrepo: pass a diffopts object to context.diff
author Boris Feld <boris.feld@octobus.net>
date Sat, 23 Jun 2018 14:46:28 +0200
parents 4455e5d4d59c
children c6398fc2fc9c
comparison
equal deleted inserted replaced
38566:1770416de208 38567:97469c5430cd
58 hg, 58 hg,
59 patch, 59 patch,
60 registrar, 60 registrar,
61 scmutil, 61 scmutil,
62 ) 62 )
63 from mercurial.utils import dateutil 63 from mercurial.utils import (
64 dateutil,
65 diffutil,
66 )
64 67
65 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for 68 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
66 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should 69 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
67 # be specifying the version(s) of Mercurial they are tested with, or 70 # be specifying the version(s) of Mercurial they are tested with, or
68 # leave the attribute unspecified. 71 # leave the attribute unspecified.
191 else: 194 else:
192 lastctx = repo[rev - 1] 195 lastctx = repo[rev - 1]
193 if lastctx.rev() != nullrev: 196 if lastctx.rev() != nullrev:
194 timedelta = ctx.date()[0] - lastctx.date()[0] 197 timedelta = ctx.date()[0] - lastctx.date()[0]
195 interarrival[roundto(timedelta, 300)] += 1 198 interarrival[roundto(timedelta, 300)] += 1
199 diffopts = diffutil.diffopts(ctx._repo.ui, {'git': True})
196 diff = sum((d.splitlines() 200 diff = sum((d.splitlines()
197 for d in ctx.diff(pctx, opts={'git': True})), []) 201 for d in ctx.diff(pctx, opts=diffopts)), [])
198 fileadds, diradds, fileremoves, filechanges = 0, 0, 0, 0 202 fileadds, diradds, fileremoves, filechanges = 0, 0, 0, 0
199 for filename, mar, lineadd, lineremove, isbin in parsegitdiff(diff): 203 for filename, mar, lineadd, lineremove, isbin in parsegitdiff(diff):
200 if isbin: 204 if isbin:
201 continue 205 continue
202 added = sum(lineadd.itervalues(), 0) 206 added = sum(lineadd.itervalues(), 0)