changeset 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 1b49b84d5ed5
children cf3bef7f162b
files mercurial/obsutil.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/obsutil.py	Mon Nov 05 19:52:42 2018 -0800
+++ b/mercurial/obsutil.py	Tue May 22 15:26:17 2018 +0200
@@ -397,12 +397,14 @@
 
     This is a first and basic implementation, with many shortcoming.
     """
-    diffopts = diffutil.diffallopts(leftctx.repo().ui, {'git': True})
+    # lefctx.repo() and rightctx.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)