# HG changeset patch # User Durham Goode # Date 1507226690 25200 # Node ID 5821075b289a1abd439192bee2182625fc06ad74 # Parent 5db8d0d0ae47c4aa12ea50e19a164737f487ef00 context: update to work with upstream Some upstream code now relies on ctx.repo() to access the repo object, since hggit stored ctx.repo as a field instead of a function, that failed. Let's move it to be a function. For overlaychangectx we can't just store the repo in self._repo because that causes other parts of the base class to act differently and causes tests to fail, so we store it as a new field. diff -r 5db8d0d0ae47 -r 5821075b289a hggit/overlay.py --- a/hggit/overlay.py Sun Oct 01 12:51:49 2017 +0100 +++ b/hggit/overlay.py Thu Oct 05 11:04:50 2017 -0700 @@ -174,10 +174,13 @@ class overlayfilectx(object): def __init__(self, repo, path, fileid=None): - self.repo = repo + self._repo = repo self._path = path self.fileid = fileid + def repo(self): + return self._repo + # this is a hack to skip copy detection def ancestors(self): return [self, self] @@ -195,7 +198,7 @@ return self.fileid def data(self): - blob = self.repo.handler.git.get_object(_maybehex(self.fileid)) + blob = self._repo.handler.git.get_object(_maybehex(self.fileid)) return blob.data def isbinary(self): @@ -203,13 +206,17 @@ class overlaychangectx(context.changectx): def __init__(self, repo, sha): - self.repo = repo + # Can't store this in self._repo because the base class uses that field + self._hgrepo = repo if not isinstance(sha, basestring): sha = sha.hex() self.commit = repo.handler.git.get_object(_maybehex(sha)) self._overlay = getattr(repo, 'gitoverlay', repo) self._rev = self._overlay.rev(bin(self.commit.id)) + def repo(self): + return self._hgrepo + def node(self): return bin(self.commit.id) @@ -235,13 +242,13 @@ return self.commit.message def parents(self): - cl = self.repo.changelog + cl = self._hgrepo.changelog parents = cl.parents(cl.node(self._rev)) if not parents: - return [self.repo['null']] + return [self._hgrepo['null']] if parents[1] == nullid: parents = parents[:-1] - return [self.repo[sha] for sha in parents] + return [self._hgrepo[sha] for sha in parents] def manifestnode(self): return bin(self.commit.tree)