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) |