Mercurial > public > mercurial-scm > hg
diff mercurial/context.py @ 34926:f7e4d6c20095 stable
statichttprepo: prevent loading dirstate over HTTP on node lookup (issue5717)
This seems a bit hacky, but works well. There should be no reason that
static-http repo had to load dirstate.
Initially I tried to proxy os.stat() call through vfs so that statichttpvfs
could hook it, but there wasn't a good error value which the statichttpvfs
could return to get around the util.filestat issue.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 25 Oct 2017 21:58:03 +0900 |
parents | 14c87708f432 |
children | a9454beb9dd8 |
line wrap: on
line diff
--- a/mercurial/context.py Wed Oct 25 21:21:42 2017 +0900 +++ b/mercurial/context.py Wed Oct 25 21:58:03 2017 +0900 @@ -471,7 +471,8 @@ self._node = repo.changelog.tip() self._rev = repo.changelog.rev(self._node) return - if changeid == '.' or changeid == repo.dirstate.p1(): + if (changeid == '.' + or repo.local() and changeid == repo.dirstate.p1()): # this is a hack to delay/avoid loading obsmarkers # when we know that '.' won't be hidden self._node = repo.dirstate.p1() @@ -536,7 +537,8 @@ # # XXX we could avoid the unfiltered if we had a recognizable # exception for filtered changeset access - if changeid in repo.unfiltered().dirstate.parents(): + if (repo.local() + and changeid in repo.unfiltered().dirstate.parents()): msg = _("working directory has unknown parent '%s'!") raise error.Abort(msg % short(changeid)) try: