obsutil: clarify the access to "repo"
authorBoris Feld <boris.feld@octobus.net>
Tue, 22 May 2018 15:26:17 +0200
changeset 40528 520514af2d93
parent 40527 1b49b84d5ed5
child 40529 cf3bef7f162b
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.
mercurial/obsutil.py
--- 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)