mercurial/localrepo.py
changeset 36471 c28b6d609c47
parent 36422 04c319a07c7b
child 36554 06f59bdde626
equal deleted inserted replaced
36470:d851951b421c 36471:c28b6d609c47
    41     manifest,
    41     manifest,
    42     match as matchmod,
    42     match as matchmod,
    43     merge as mergemod,
    43     merge as mergemod,
    44     mergeutil,
    44     mergeutil,
    45     namespaces,
    45     namespaces,
       
    46     narrowspec,
    46     obsolete,
    47     obsolete,
    47     pathutil,
    48     pathutil,
    48     peer,
    49     peer,
    49     phases,
    50     phases,
    50     pushkey,
    51     pushkey,
   733             if not self._dirstatevalidatewarned:
   734             if not self._dirstatevalidatewarned:
   734                 self._dirstatevalidatewarned = True
   735                 self._dirstatevalidatewarned = True
   735                 self.ui.warn(_("warning: ignoring unknown"
   736                 self.ui.warn(_("warning: ignoring unknown"
   736                                " working parent %s!\n") % short(node))
   737                                " working parent %s!\n") % short(node))
   737             return nullid
   738             return nullid
       
   739 
       
   740     @repofilecache(narrowspec.FILENAME)
       
   741     def narrowpats(self):
       
   742         """matcher patterns for this repository's narrowspec
       
   743 
       
   744         A tuple of (includes, excludes).
       
   745         """
       
   746         source = self
       
   747         if self.shared():
       
   748             from . import hg
       
   749             source = hg.sharedreposource(self)
       
   750         return narrowspec.load(source)
       
   751 
       
   752     @repofilecache(narrowspec.FILENAME)
       
   753     def _narrowmatch(self):
       
   754         if changegroup.NARROW_REQUIREMENT not in self.requirements:
       
   755             return matchmod.always(self.root, '')
       
   756         include, exclude = self.narrowpats
       
   757         return narrowspec.match(self.root, include=include, exclude=exclude)
       
   758 
       
   759     # TODO(martinvonz): make this property-like instead?
       
   760     def narrowmatch(self):
       
   761         return self._narrowmatch
       
   762 
       
   763     def setnarrowpats(self, newincludes, newexcludes):
       
   764         target = self
       
   765         if self.shared():
       
   766             from . import hg
       
   767             target = hg.sharedreposource(self)
       
   768         narrowspec.save(target, newincludes, newexcludes)
       
   769         self.invalidate(clearfilecache=True)
   738 
   770 
   739     def __getitem__(self, changeid):
   771     def __getitem__(self, changeid):
   740         if changeid is None:
   772         if changeid is None:
   741             return context.workingctx(self)
   773             return context.workingctx(self)
   742         if isinstance(changeid, slice):
   774         if isinstance(changeid, slice):