##// END OF EJS Templates
store: introduce a EntryFile object to actually access file info...
marmoute -
r51365:9fdc28e2 default
parent child Browse files
Show More
@@ -293,7 +293,8 b' def _narrow('
293 293 if f.startswith(b'data/'):
294 294 file = f[5:-2]
295 295 if not newmatch(file):
296 todelete.append(f)
296 for file_ in entry.files():
297 todelete.append(file_.unencoded_path)
297 298 elif f.startswith(b'meta/'):
298 299 dir = f[5:-13]
299 300 dirs = sorted(pathutil.dirs({dir})) + [dir]
@@ -306,7 +307,8 b' def _narrow('
306 307 if visit == b'all':
307 308 break
308 309 if not include:
309 todelete.append(f)
310 for file_ in entry.files():
311 todelete.append(file_.unencoded_path)
310 312
311 313 repo.destroying()
312 314
@@ -466,6 +466,24 b' class StoreEntry:'
466 466 is_volatile = attr.ib(default=False)
467 467 file_size = attr.ib(default=None)
468 468
469 def files(self):
470 return [
471 StoreFile(
472 unencoded_path=self.unencoded_path,
473 file_size=self.file_size,
474 is_volatile=self.is_volatile,
475 )
476 ]
477
478
479 @attr.s(slots=True)
480 class StoreFile:
481 """a file matching an entry"""
482
483 unencoded_path = attr.ib()
484 file_size = attr.ib()
485 is_volatile = attr.ib(default=False)
486
469 487
470 488 class basicstore:
471 489 '''base class for local repository stores'''
@@ -270,9 +270,10 b' def generatev1(repo):'
270 270 with repo.lock():
271 271 repo.ui.debug(b'scanning\n')
272 272 for entry in _walkstreamfiles(repo):
273 if entry.file_size:
274 entries.append((entry.unencoded_path, entry.file_size))
275 total_bytes += entry.file_size
273 for f in entry.files():
274 if f.file_size:
275 entries.append((f.unencoded_path, f.file_size))
276 total_bytes += f.file_size
276 277 _test_sync_point_walk_1(repo)
277 278 _test_sync_point_walk_2(repo)
278 279
@@ -678,14 +679,13 b' def _v2_walk(repo, includes, excludes, i'
678 679 matcher = narrowspec.match(repo.root, includes, excludes)
679 680
680 681 for entry in _walkstreamfiles(repo, matcher):
681 if entry.file_size:
682 ft = _fileappend
683 if entry.is_volatile:
684 ft = _filefull
685 entries.append(
686 (_srcstore, entry.unencoded_path, ft, entry.file_size)
687 )
688 totalfilesize += entry.file_size
682 for f in entry.files():
683 if f.file_size:
684 ft = _fileappend
685 if f.is_volatile:
686 ft = _filefull
687 entries.append((_srcstore, f.unencoded_path, ft, f.file_size))
688 totalfilesize += f.file_size
689 689 for name in _walkstreamfullstorefiles(repo):
690 690 if repo.svfs.exists(name):
691 691 totalfilesize += repo.svfs.lstat(name).st_size
@@ -408,11 +408,12 b' class verifier:'
408 408 revlogv1 = self.revlogv1
409 409 undecodable = []
410 410 for entry in repo.store.datafiles(undecodable=undecodable):
411 f = entry.unencoded_path
412 size = entry.file_size
413 if (size > 0 or not revlogv1) and f.startswith(b'meta/'):
414 storefiles.add(_normpath(f))
415 subdirs.add(os.path.dirname(f))
411 for file_ in entry.files():
412 f = file_.unencoded_path
413 size = file_.file_size
414 if (size > 0 or not revlogv1) and f.startswith(b'meta/'):
415 storefiles.add(_normpath(f))
416 subdirs.add(os.path.dirname(f))
416 417 for f in undecodable:
417 418 self._err(None, _(b"cannot decode filename '%s'") % f)
418 419 subdirprogress = ui.makeprogress(
@@ -475,10 +476,11 b' class verifier:'
475 476 storefiles = set()
476 477 undecodable = []
477 478 for entry in repo.store.datafiles(undecodable=undecodable):
478 size = entry.file_size
479 f = entry.unencoded_path
480 if (size > 0 or not revlogv1) and f.startswith(b'data/'):
481 storefiles.add(_normpath(f))
479 for file_ in entry.files():
480 size = file_.file_size
481 f = file_.unencoded_path
482 if (size > 0 or not revlogv1) and f.startswith(b'data/'):
483 storefiles.add(_normpath(f))
482 484 for f in undecodable:
483 485 self._err(None, _(b"cannot decode filename '%s'") % f)
484 486
General Comments 0
You need to be logged in to leave comments. Login now