D5968: obsutil: don't assume leftctx and rightctx repo as same
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9de6c4f61608: obsutil: dont assume leftctx and rightctx repo as same (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5968?vs=14103=14123 REVISION DETAIL https://phab.mercurial-scm.org/D5968 AFFECTED FILES mercurial/obsutil.py CHANGE DETAILS 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) To: pulkit, #hg-reviewers, lothiraldan Cc: lothiraldan, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5968: obsutil: don't assume leftctx and rightctx repo as same
pulkit updated this revision to Diff 14103. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5968?vs=14099=14103 REVISION DETAIL https://phab.mercurial-scm.org/D5968 AFFECTED FILES mercurial/obsutil.py CHANGE DETAILS 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) To: pulkit, #hg-reviewers, lothiraldan Cc: lothiraldan, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5968: obsutil: don't assume leftctx and rightctx repo as same
lothiraldan accepted this revision. lothiraldan added a comment. LGTM, nice catch! Could you add a comment to clarify it? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5968 To: pulkit, #hg-reviewers, lothiraldan Cc: lothiraldan, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5968: obsutil: don't assume leftctx and rightctx repo as same
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Backed out changeset https://phab.mercurial-scm.org/rHG520514af2d9378d9d5815f0c4edc01617968356d. hgsubversion can pass leftctx and rightctx which are instances of two different repositories. This was making tests fail on hgsubversion with 4.9. The two different instances are: (Pdb) p rightctx.repo() > (Pdb) p leftctx.repo() > REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5968 AFFECTED FILES mercurial/obsutil.py CHANGE DETAILS diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py --- a/mercurial/obsutil.py +++ b/mercurial/obsutil.py @@ -397,14 +397,12 @@ 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()] +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) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel