Mercurial > hg-git
changeset 1132:58c61489f722
overlaychangectx: also assign repo to self._repo
Without doing this, we get test failures due to core Mercurial
methods (e.g. context.obsolete, context.orphan, etc) access self._repo.
If we didn't go this route, we'd need to change core to (correctly) call
self.repo() instead of _repo.
author | Sean Farley <sean@farley.io> |
---|---|
date | Thu, 24 May 2018 11:45:12 +0200 |
parents | 9cbf81bb5e27 |
children | bbad9283f80f |
files | hggit/overlay.py |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/overlay.py Thu May 24 11:35:10 2018 +0200 +++ b/hggit/overlay.py Thu May 24 11:45:12 2018 +0200 @@ -213,8 +213,11 @@ class overlaychangectx(context.changectx): def __init__(self, repo, sha): - # Can't store this in self._repo because the base class uses that field - self._hgrepo = repo + # we need to keep the repo around in a variable that isn't overridden + # by self._repo but we also need to assign this to self._repo so that + # self.obsolete() (and friends) keep working since they access _repo + # directly. + self._hgrepo = self._repo = repo if not isinstance(sha, basestring): sha = sha.hex() self.commit = repo.handler.git.get_object(_maybehex(sha))