comparison mercurial/context.py @ 39960:43d3b09b3e5a

repo: move unfiltered-repo optimization to workingctx localrepo.__getitem__ special-cased lookup of the working copy parent to avoid looking up obsmarkers. I think the reason for that code (which I once wrote myself) was to make `hg commit` not load obsmarkers, which it would otherwise do via ctx.p1() in localrepo.commitctx(). That had the somewhat unfortunate consequence of making lookup of an unrelated binary nodeid load the dirstate. Now that changectx's constructor is dumb, we can let workingctx._parents() have the opmtimization instead. This affects two tests, because they no longer end up loading the dirstate and their "warning: ignoring unknown working parent ..." messages therefore go way. Differential Revision: https://phab.mercurial-scm.org/D4828
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 26 Sep 2018 23:09:28 -0700
parents 3d35304bd09b
children ccf4d808ec4c
comparison
equal deleted inserted replaced
39959:3d35304bd09b 39960:43d3b09b3e5a
1239 @propertycache 1239 @propertycache
1240 def _parents(self): 1240 def _parents(self):
1241 p = self._repo.dirstate.parents() 1241 p = self._repo.dirstate.parents()
1242 if p[1] == nullid: 1242 if p[1] == nullid:
1243 p = p[:-1] 1243 p = p[:-1]
1244 return [self._repo[x] for x in p] 1244 # use unfiltered repo to delay/avoid loading obsmarkers
1245 unfi = self._repo.unfiltered()
1246 return [changectx(self._repo, unfi.changelog.rev(n), n) for n in p]
1245 1247
1246 def _fileinfo(self, path): 1248 def _fileinfo(self, path):
1247 # populate __dict__['_manifest'] as workingctx has no _manifestdelta 1249 # populate __dict__['_manifest'] as workingctx has no _manifestdelta
1248 self._manifest 1250 self._manifest
1249 return super(workingctx, self)._fileinfo(path) 1251 return super(workingctx, self)._fileinfo(path)