narrow: detect if narrowspec was changed in a different share
With this commit, `hg share` should be usable with narrow
repos. Design explained on
https://www.mercurial-scm.org/wiki/NarrowSharePlan
I was running into cache invalidation problems when updating the
narrowspec. After spending a day trying to figure out a good solution,
I resorted to just assigning repo.narrowpats and repo._narrowmatch
after invalidating them.
Differential Revision: https://phab.mercurial-scm.org/D5278
tests: add test for narrow+share
For how narrow+share is supposed to work, see
https://www.mercurial-scm.org/wiki/NarrowSharePlan.
Differential Revision: https://phab.mercurial-scm.org/D5276
narrow: keep narrowspec backup in store
As suggested by Yuya in review of D4099.
Differential Revision: https://phab.mercurial-scm.org/D5470
tests: update narrowspec when narrowspec, not dirstate, is accessed
test-narrow-expanddirstate.t mimics a Google-internal extension that
updates the narrowspec whenever the dirstate is accessed. Since
1d09ba0d2ed3 (narrow: move remaining narrow-limited dirstate walks to
core, 2018-10-01) and a few commits before it, we no longer restrict
repo.dirstate.walk() to the narrowspec. It is instead done at a higher
level (e.g. context.status()). We were running into problems with the
Google-internal extension when importing those commits. The issue was
that the narrowspec was read before the first dirstate access. I
believe the right fix is to instead update the narrowspec when trying
to read it (not when reading the dirstate), so that's what this patch
does.
Differential Revision: https://phab.mercurial-scm.org/D5275