diff -r 7db1619af061 -r ce0bc2952e2a mercurial/localrepo.py --- 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: