comparison mercurial/obsutil.py @ 38568:f65e6095c5ac

obsutil: pass a diffopts object to context.diff
author Boris Feld <boris.feld@octobus.net>
date Sat, 23 Jun 2018 15:00:16 +0200
parents 4455e5d4d59c
children 79d7d715f3d0
comparison
equal deleted inserted replaced
38567:97469c5430cd 38568:f65e6095c5ac
13 from . import ( 13 from . import (
14 node as nodemod, 14 node as nodemod,
15 phases, 15 phases,
16 util, 16 util,
17 ) 17 )
18 from .utils import dateutil 18 from .utils import (
19 dateutil,
20 diffutil,
21 )
19 22
20 ### obsolescence marker flag 23 ### obsolescence marker flag
21 24
22 ## bumpedfix flag 25 ## bumpedfix flag
23 # 26 #
390 def _cmpdiff(leftctx, rightctx): 393 def _cmpdiff(leftctx, rightctx):
391 """return True if both ctx introduce the "same diff" 394 """return True if both ctx introduce the "same diff"
392 395
393 This is a first and basic implementation, with many shortcoming. 396 This is a first and basic implementation, with many shortcoming.
394 """ 397 """
395 398 diffopts = diffutil.diffopts(leftctx._repo.ui, {'git': True})
396 # Leftctx or right ctx might be filtered, so we need to use the contexts 399 # Leftctx or right ctx might be filtered, so we need to use the contexts
397 # with an unfiltered repository to safely compute the diff 400 # with an unfiltered repository to safely compute the diff
398 leftunfi = leftctx._repo.unfiltered()[leftctx.rev()] 401 leftunfi = leftctx._repo.unfiltered()[leftctx.rev()]
399 leftdiff = leftunfi.diff(opts={'git': True}) 402 leftdiff = leftunfi.diff(opts=diffopts)
400 rightunfi = rightctx._repo.unfiltered()[rightctx.rev()] 403 rightunfi = rightctx._repo.unfiltered()[rightctx.rev()]
401 rightdiff = rightunfi.diff(opts={'git': True}) 404 rightdiff = rightunfi.diff(opts=diffopts)
402 405
403 left, right = (0, 0) 406 left, right = (0, 0)
404 while None not in (left, right): 407 while None not in (left, right):
405 left = _getdifflines(leftdiff) 408 left = _getdifflines(leftdiff)
406 right = _getdifflines(rightdiff) 409 right = _getdifflines(rightdiff)