Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/obsutil.py @ 40578:520514af2d93
obsutil: clarify the access to "repo"
We use the variable multiple times and we might use it even more in the
future. We use a temporary variable instead.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Tue, 22 May 2018 15:26:17 +0200 |
parents | c7618901584d |
children | 191fac9ff9d3 |
comparison
equal
deleted
inserted
replaced
40577:1b49b84d5ed5 | 40578:520514af2d93 |
---|---|
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) |