subrepo: add the parent context to hgsubrepo
This brings parity with gitsubrepo and svnsubrepo (which already reference their
parent), and will be used in an upcoming patch.
I'm a bit concerned that the parent context could get stale (consider what
happens when the parent repo is reverted for example). I tried adding the
parent context to the substate tuple so that the parent is available everywhere
a state change is possible, but that made submerge() unhappy. Even with
removing the parent context inside submerge(), I wasn't able to get all of the
test diffs fixed.
But since the other subrepos reference their parent too, if there is a problem,
it is a preexisting one (that nobody seems to be running into). It can be fixed
if/when it pops up.
--- a/mercurial/subrepo.py Thu Mar 19 21:26:18 2015 -0700
+++ b/mercurial/subrepo.py Wed Mar 18 22:56:41 2015 -0400
@@ -519,6 +519,7 @@
super(hgsubrepo, self).__init__(ctx.repo().ui)
self._path = path
self._state = state
+ self._ctx = ctx
r = ctx.repo()
root = r.wjoin(path)
create = not r.wvfs.exists('%s/.hg' % path)