395 def _cmpdiff(leftctx, rightctx): |
395 def _cmpdiff(leftctx, rightctx): |
396 """return True if both ctx introduce the "same diff" |
396 """return True if both ctx introduce the "same diff" |
397 |
397 |
398 This is a first and basic implementation, with many shortcoming. |
398 This is a first and basic implementation, with many shortcoming. |
399 """ |
399 """ |
400 diffopts = diffutil.diffallopts(leftctx.repo().ui, {'git': True}) |
400 # lefctx.repo() and rightctx.repo() are the same here |
|
401 repo = leftctx.repo() |
|
402 diffopts = diffutil.diffallopts(repo.ui, {'git': True}) |
401 # Leftctx or right ctx might be filtered, so we need to use the contexts |
403 # Leftctx or right ctx might be filtered, so we need to use the contexts |
402 # with an unfiltered repository to safely compute the diff |
404 # with an unfiltered repository to safely compute the diff |
403 leftunfi = leftctx._repo.unfiltered()[leftctx.rev()] |
405 leftunfi = repo.unfiltered()[leftctx.rev()] |
404 leftdiff = leftunfi.diff(opts=diffopts) |
406 leftdiff = leftunfi.diff(opts=diffopts) |
405 rightunfi = rightctx._repo.unfiltered()[rightctx.rev()] |
407 rightunfi = repo.unfiltered()[rightctx.rev()] |
406 rightdiff = rightunfi.diff(opts=diffopts) |
408 rightdiff = rightunfi.diff(opts=diffopts) |
407 |
409 |
408 left, right = (0, 0) |
410 left, right = (0, 0) |
409 while None not in (left, right): |
411 while None not in (left, right): |
410 left = _getdifflines(leftdiff) |
412 left = _getdifflines(leftdiff) |