mercurial/manifest.py
changeset 42341 27d6956d386b
parent 41965 e4ac7e63c213
child 42347 6310180662f5
equal deleted inserted replaced
42340:7ada598941d2 42341:27d6956d386b
   464                 # specified pattern is the exact name
   464                 # specified pattern is the exact name
   465                 fset.remove(fn)
   465                 fset.remove(fn)
   466             if match(fn):
   466             if match(fn):
   467                 yield fn
   467                 yield fn
   468 
   468 
   469         # for dirstate.walk, files=['.'] means "walk the whole tree".
   469         # for dirstate.walk, files=[''] means "walk the whole tree".
   470         # follow that here, too
   470         # follow that here, too
   471         fset.discard('.')
   471         fset.discard('')
   472 
   472 
   473         for fn in sorted(fset):
   473         for fn in sorted(fset):
   474             if not self.hasdir(fn):
   474             if not self.hasdir(fn):
   475                 match.bad(fn, None)
   475                 match.bad(fn, None)
   476 
   476 
  1036             if fn in fset:
  1036             if fn in fset:
  1037                 # specified pattern is the exact name
  1037                 # specified pattern is the exact name
  1038                 fset.remove(fn)
  1038                 fset.remove(fn)
  1039             yield fn
  1039             yield fn
  1040 
  1040 
  1041         # for dirstate.walk, files=['.'] means "walk the whole tree".
  1041         # for dirstate.walk, files=[''] means "walk the whole tree".
  1042         # follow that here, too
  1042         # follow that here, too
  1043         fset.discard('.')
  1043         fset.discard('')
  1044 
  1044 
  1045         for fn in sorted(fset):
  1045         for fn in sorted(fset):
  1046             if not self.hasdir(fn):
  1046             if not self.hasdir(fn):
  1047                 match.bad(fn, None)
  1047                 match.bad(fn, None)
  1048 
  1048 
  1049     def _walk(self, match):
  1049     def _walk(self, match):
  1050         '''Recursively generates matching file names for walk().'''
  1050         '''Recursively generates matching file names for walk().'''
  1051         visit = match.visitchildrenset(self._dir[:-1] or '.')
  1051         visit = match.visitchildrenset(self._dir[:-1])
  1052         if not visit:
  1052         if not visit:
  1053             return
  1053             return
  1054 
  1054 
  1055         # yield this dir's files and walk its submanifests
  1055         # yield this dir's files and walk its submanifests
  1056         self._load()
  1056         self._load()
  1074 
  1074 
  1075     def _matches(self, match):
  1075     def _matches(self, match):
  1076         '''recursively generate a new manifest filtered by the match argument.
  1076         '''recursively generate a new manifest filtered by the match argument.
  1077         '''
  1077         '''
  1078 
  1078 
  1079         visit = match.visitchildrenset(self._dir[:-1] or '.')
  1079         visit = match.visitchildrenset(self._dir[:-1])
  1080         if visit == 'all':
  1080         if visit == 'all':
  1081             return self.copy()
  1081             return self.copy()
  1082         ret = treemanifest(self._dir)
  1082         ret = treemanifest(self._dir)
  1083         if not visit:
  1083         if not visit:
  1084             return ret
  1084             return ret
  1233             if ld:
  1233             if ld:
  1234                 return ld[1]
  1234                 return ld[1]
  1235             return m._dirs.get(d, emptytree)._node
  1235             return m._dirs.get(d, emptytree)._node
  1236 
  1236 
  1237         # let's skip investigating things that `match` says we do not need.
  1237         # let's skip investigating things that `match` says we do not need.
  1238         visit = match.visitchildrenset(self._dir[:-1] or '.')
  1238         visit = match.visitchildrenset(self._dir[:-1])
  1239         visit = self._loadchildrensetlazy(visit)
  1239         visit = self._loadchildrensetlazy(visit)
  1240         if visit == 'this' or visit == 'all':
  1240         if visit == 'this' or visit == 'all':
  1241             visit = None
  1241             visit = None
  1242         for d, subm in self._dirs.iteritems():
  1242         for d, subm in self._dirs.iteritems():
  1243             if visit and d[:-1] not in visit:
  1243             if visit and d[:-1] not in visit:
  1252         """Returns an iterator of the subtrees of this manifest, including this
  1252         """Returns an iterator of the subtrees of this manifest, including this
  1253         manifest itself.
  1253         manifest itself.
  1254 
  1254 
  1255         If `matcher` is provided, it only returns subtrees that match.
  1255         If `matcher` is provided, it only returns subtrees that match.
  1256         """
  1256         """
  1257         if matcher and not matcher.visitdir(self._dir[:-1] or '.'):
  1257         if matcher and not matcher.visitdir(self._dir[:-1]):
  1258             return
  1258             return
  1259         if not matcher or matcher(self._dir[:-1]):
  1259         if not matcher or matcher(self._dir[:-1]):
  1260             yield self
  1260             yield self
  1261 
  1261 
  1262         self._load()
  1262         self._load()
  1683         """
  1683         """
  1684         if node in self._dirmancache.get(tree, ()):
  1684         if node in self._dirmancache.get(tree, ()):
  1685             return self._dirmancache[tree][node]
  1685             return self._dirmancache[tree][node]
  1686 
  1686 
  1687         if not self._narrowmatch.always():
  1687         if not self._narrowmatch.always():
  1688             if not self._narrowmatch.visitdir(tree[:-1] or '.'):
  1688             if not self._narrowmatch.visitdir(tree[:-1]):
  1689                 return excludeddirmanifestctx(tree, node)
  1689                 return excludeddirmanifestctx(tree, node)
  1690         if tree:
  1690         if tree:
  1691             if self._rootstore._treeondisk:
  1691             if self._rootstore._treeondisk:
  1692                 if verify:
  1692                 if verify:
  1693                     # Side-effect is LookupError is raised if node doesn't
  1693                     # Side-effect is LookupError is raised if node doesn't
  1876         #self.linkrev = store.linkrev(rev)
  1876         #self.linkrev = store.linkrev(rev)
  1877 
  1877 
  1878     def _storage(self):
  1878     def _storage(self):
  1879         narrowmatch = self._manifestlog._narrowmatch
  1879         narrowmatch = self._manifestlog._narrowmatch
  1880         if not narrowmatch.always():
  1880         if not narrowmatch.always():
  1881             if not narrowmatch.visitdir(self._dir[:-1] or '.'):
  1881             if not narrowmatch.visitdir(self._dir[:-1]):
  1882                 return excludedmanifestrevlog(self._dir)
  1882                 return excludedmanifestrevlog(self._dir)
  1883         return self._manifestlog.getstorage(self._dir)
  1883         return self._manifestlog.getstorage(self._dir)
  1884 
  1884 
  1885     def read(self):
  1885     def read(self):
  1886         if self._data is None:
  1886         if self._data is None: