Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 38872:576eef1ab43d
narrow: move .hg/narrowspec to .hg/store/narrowspec (BC)
The narrowspec is more closely related to the store than to the
working copy. For example, if the narrowspec changes, the set of
revlogs also needs to change (the working copy may change, but that
depends on which commit is checked out). Also, when using the share
extension, the narrowspec needs to be shared along with the
store. This patch therefore moves the narrowspec into the store/
directory.
This is clearly a breaking change, but I haven't bothered trying to
fall back to reading the narrowspec from the old location (.hg/),
because there are very few users of narrow out there. (We'll add a
temporary hack to our Google-internal extension to handle the
migration.)
Differential Revision: https://phab.mercurial-scm.org/D4099
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 02 Aug 2018 14:57:20 -0700 |
parents | ad24b581e4d9 |
children | ac0a87160012 |
comparison
equal
deleted
inserted
replaced
38871:204e074c188e | 38872:576eef1ab43d |
---|---|
809 self._dirstatevalidatewarned = True | 809 self._dirstatevalidatewarned = True |
810 self.ui.warn(_("warning: ignoring unknown" | 810 self.ui.warn(_("warning: ignoring unknown" |
811 " working parent %s!\n") % short(node)) | 811 " working parent %s!\n") % short(node)) |
812 return nullid | 812 return nullid |
813 | 813 |
814 @repofilecache(narrowspec.FILENAME) | 814 @storecache(narrowspec.FILENAME) |
815 def narrowpats(self): | 815 def narrowpats(self): |
816 """matcher patterns for this repository's narrowspec | 816 """matcher patterns for this repository's narrowspec |
817 | 817 |
818 A tuple of (includes, excludes). | 818 A tuple of (includes, excludes). |
819 """ | 819 """ |
821 if self.shared(): | 821 if self.shared(): |
822 from . import hg | 822 from . import hg |
823 source = hg.sharedreposource(self) | 823 source = hg.sharedreposource(self) |
824 return narrowspec.load(source) | 824 return narrowspec.load(source) |
825 | 825 |
826 @repofilecache(narrowspec.FILENAME) | 826 @storecache(narrowspec.FILENAME) |
827 def _narrowmatch(self): | 827 def _narrowmatch(self): |
828 if repository.NARROW_REQUIREMENT not in self.requirements: | 828 if repository.NARROW_REQUIREMENT not in self.requirements: |
829 return matchmod.always(self.root, '') | 829 return matchmod.always(self.root, '') |
830 include, exclude = self.narrowpats | 830 include, exclude = self.narrowpats |
831 return narrowspec.match(self.root, include=include, exclude=exclude) | 831 return narrowspec.match(self.root, include=include, exclude=exclude) |