Mercurial > hg
diff mercurial/localrepo.py @ 41043:ce0bc2952e2a
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
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 21 Dec 2018 10:13:49 -0800 |
parents | 3913223417ea |
children | e7a2cc84dbc0 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Fri Jul 13 11:26:46 2018 -0700 +++ b/mercurial/localrepo.py Fri Dec 21 10:13:49 2018 -0800 @@ -1227,6 +1227,7 @@ def _narrowmatch(self): if repository.NARROW_REQUIREMENT not in self.requirements: return matchmod.always(self.root, '') + narrowspec.checkworkingcopynarrowspec(self) include, exclude = self.narrowpats return narrowspec.match(self.root, include=include, exclude=exclude) @@ -1251,7 +1252,14 @@ def setnarrowpats(self, newincludes, newexcludes): narrowspec.save(self, newincludes, newexcludes) + narrowspec.copytoworkingcopy(self, self.currenttransaction()) self.invalidate(clearfilecache=True) + # So the next access won't be considered a conflict + # TODO: It seems like there should be a way of doing this that + # doesn't involve replacing these attributes. + self.narrowpats = newincludes, newexcludes + self._narrowmatch = narrowspec.match(self.root, include=newincludes, + exclude=newexcludes) def __getitem__(self, changeid): if changeid is None: