# HG changeset patch # User Boris Feld <boris.f...@octobus.net> # Date 1526995577 -7200 # Tue May 22 15:26:17 2018 +0200 # Node ID 44b4391b6b68291e408fc7c42a477f893244cdd8 # Parent e0dea186ab6edfab124b1dfd84237a4b8142f13b # EXP-Topic gratuitous-cleanup # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 44b4391b6b68 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. diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py --- a/mercurial/obsutil.py +++ b/mercurial/obsutil.py @@ -396,12 +396,14 @@ def _cmpdiff(leftctx, rightctx): This is a first and basic implementation, with many shortcoming. """ - diffopts = diffutil.diffallopts(leftctx.repo().ui, {'git': True}) + # lefctx.repo() and right_ctx.repo() are the same here + repo = leftctx.repo() + diffopts = diffutil.diffallopts(repo.ui, {'git': True}) # Leftctx or right ctx might be filtered, so we need to use the contexts # with an unfiltered repository to safely compute the diff - leftunfi = leftctx._repo.unfiltered()[leftctx.rev()] + leftunfi = repo.unfiltered()[leftctx.rev()] leftdiff = leftunfi.diff(opts=diffopts) - rightunfi = rightctx._repo.unfiltered()[rightctx.rev()] + rightunfi = repo.unfiltered()[rightctx.rev()] rightdiff = rightunfi.diff(opts=diffopts) left, right = (0, 0) _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel