Patchwork D5968: obsutil: don't assume leftctx and rightctx repo as same

login
register
mail settings
Submitter phabricator
Date Feb. 15, 2019, 7:20 p.m.
Message ID <2cbf23d8296d6e5d0a898cea375ab8d0@localhost.localdomain>
Download mbox | patch
Permalink /patch/38760/
State Not Applicable
Headers show

Comments

phabricator - Feb. 15, 2019, 7:20 p.m.
pulkit updated this revision to Diff 14103.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5968?vs=14099&id=14103

REVISION DETAIL
  https://phab.mercurial-scm.org/D5968

AFFECTED FILES
  mercurial/obsutil.py

CHANGE DETAILS




To: pulkit, #hg-reviewers, lothiraldan
Cc: lothiraldan, mercurial-devel

Patch

diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
--- a/mercurial/obsutil.py
+++ b/mercurial/obsutil.py
@@ -397,14 +397,17 @@ 
 
     This is a first and basic implementation, with many shortcoming.
     """
-    # lefctx.repo() and rightctx.repo() are the same here
-    repo = leftctx.repo()
-    diffopts = diffutil.diffallopts(repo.ui, {'git': True})
+    diffopts = diffutil.diffallopts(leftctx.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 = repo.unfiltered()[leftctx.rev()]
+
+    # leftctx and rightctx can be from different repository views in case of
+    # hgsubversion, do don't try to access them from same repository
+    # rightctx.repo() and leftctx.repo() are not always the same
+    leftunfi = leftctx._repo.unfiltered()[leftctx.rev()]
     leftdiff = leftunfi.diff(opts=diffopts)
-    rightunfi = repo.unfiltered()[rightctx.rev()]
+    rightunfi = rightctx._repo.unfiltered()[rightctx.rev()]
     rightdiff = rightunfi.diff(opts=diffopts)
 
     left, right = (0, 0)