comparison mercurial/context.py @ 44051:436d106de670

overlayworkginctx: implement a setparents() to mirror dirstate.setparents() This lets us make the in-memory and on-disk code a bit more similar. I'll soon also implement setparents() on the regular workingctx. Differential Revision: https://phab.mercurial-scm.org/D7822
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 10 Jan 2020 21:41:28 -0800
parents 2ecbc4ec87d8
children b74270da5eee
comparison
equal deleted inserted replaced
44050:2ecbc4ec87d8 44051:436d106de670
2159 # Drop old manifest cache as it is now out of date. 2159 # Drop old manifest cache as it is now out of date.
2160 # This is necessary when, e.g., rebasing several nodes with one 2160 # This is necessary when, e.g., rebasing several nodes with one
2161 # ``overlayworkingctx`` (e.g. with --collapse). 2161 # ``overlayworkingctx`` (e.g. with --collapse).
2162 util.clearcachedproperty(self, b'_manifest') 2162 util.clearcachedproperty(self, b'_manifest')
2163 2163
2164 def setparents(self, p1node, p2node=nullid):
2165 assert p1node == self._wrappedctx.node()
2166 self._parents = [self._wrappedctx, self._repo.unfiltered()[p2node]]
2167
2164 def data(self, path): 2168 def data(self, path):
2165 if self.isdirty(path): 2169 if self.isdirty(path):
2166 if self._cache[path][b'exists']: 2170 if self._cache[path][b'exists']:
2167 if self._cache[path][b'data'] is not None: 2171 if self._cache[path][b'data'] is not None:
2168 return self._cache[path][b'data'] 2172 return self._cache[path][b'data']
2413 committed. 2417 committed.
2414 2418
2415 ``text`` is the commit message. 2419 ``text`` is the commit message.
2416 ``parents`` (optional) are rev numbers. 2420 ``parents`` (optional) are rev numbers.
2417 """ 2421 """
2418 # Default parents to the wrapped contexts' if not passed. 2422 # Default parents to the wrapped context if not passed.
2419 if parents is None: 2423 if parents is None:
2420 parents = self._wrappedctx.parents() 2424 parents = self.parents()
2421 if len(parents) == 1: 2425 if len(parents) == 1:
2422 parents = (parents[0], None) 2426 parents = (parents[0], None)
2423 2427
2424 # ``parents`` is passed as rev numbers; convert to ``commitctxs``. 2428 # ``parents`` is passed as rev numbers; convert to ``commitctxs``.
2425 if parents[1] is None: 2429 if parents[1] is None: