Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 39959: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 | 6962ebc8f817 |
comparison
equal
deleted
inserted
replaced
39958:3d35304bd09b | 39959:43d3b09b3e5a |
---|---|
1226 return context.changectx(self, rev, node) | 1226 return context.changectx(self, rev, node) |
1227 elif changeid == 'tip': | 1227 elif changeid == 'tip': |
1228 node = self.changelog.tip() | 1228 node = self.changelog.tip() |
1229 rev = self.changelog.rev(node) | 1229 rev = self.changelog.rev(node) |
1230 return context.changectx(self, rev, node) | 1230 return context.changectx(self, rev, node) |
1231 elif (changeid == '.' | 1231 elif changeid == '.': |
1232 or self.local() and changeid == self.dirstate.p1()): | |
1233 # this is a hack to delay/avoid loading obsmarkers | 1232 # this is a hack to delay/avoid loading obsmarkers |
1234 # when we know that '.' won't be hidden | 1233 # when we know that '.' won't be hidden |
1235 node = self.dirstate.p1() | 1234 node = self.dirstate.p1() |
1236 rev = self.unfiltered().changelog.rev(node) | 1235 rev = self.unfiltered().changelog.rev(node) |
1237 return context.changectx(self, rev, node) | 1236 return context.changectx(self, rev, node) |