Show More
@@ -520,9 +520,17 b' class StoreFile:' | |||||
520 | """a file matching an entry""" |
|
520 | """a file matching an entry""" | |
521 |
|
521 | |||
522 | unencoded_path = attr.ib() |
|
522 | unencoded_path = attr.ib() | |
523 | file_size = attr.ib() |
|
523 | _file_size = attr.ib(default=False) | |
524 | is_volatile = attr.ib(default=False) |
|
524 | is_volatile = attr.ib(default=False) | |
525 |
|
525 | |||
|
526 | def file_size(self, vfs): | |||
|
527 | if self._file_size is not None: | |||
|
528 | return self._file_size | |||
|
529 | try: | |||
|
530 | return vfs.stat(self.unencoded_path).st_size | |||
|
531 | except FileNotFoundError: | |||
|
532 | return 0 | |||
|
533 | ||||
526 |
|
534 | |||
527 | class basicstore: |
|
535 | class basicstore: | |
528 | '''base class for local repository stores''' |
|
536 | '''base class for local repository stores''' | |
@@ -900,16 +908,12 b' class fncachestore(basicstore):' | |||||
900 | # However the fncache might contains such file added by |
|
908 | # However the fncache might contains such file added by | |
901 | # previous version of Mercurial. |
|
909 | # previous version of Mercurial. | |
902 | continue |
|
910 | continue | |
903 | try: |
|
|||
904 |
|
|
911 | yield RevlogStoreEntry( | |
905 |
|
|
912 | unencoded_path=f, | |
906 |
|
|
913 | revlog_type=FILEFLAGS_FILELOG, | |
907 |
|
|
914 | is_revlog_main=bool(t & FILEFLAGS_REVLOG_MAIN), | |
908 |
|
|
915 | is_volatile=bool(t & FILEFLAGS_VOLATILE), | |
909 | file_size=self.getsize(ef), |
|
|||
910 |
|
|
916 | ) | |
911 | except FileNotFoundError: |
|
|||
912 | pass |
|
|||
913 |
|
917 | |||
914 | def copylist(self): |
|
918 | def copylist(self): | |
915 | d = ( |
|
919 | d = ( |
@@ -271,9 +271,10 b' def generatev1(repo):' | |||||
271 | repo.ui.debug(b'scanning\n') |
|
271 | repo.ui.debug(b'scanning\n') | |
272 | for entry in _walkstreamfiles(repo): |
|
272 | for entry in _walkstreamfiles(repo): | |
273 | for f in entry.files(): |
|
273 | for f in entry.files(): | |
274 |
|
|
274 | file_size = f.file_size(repo.store.vfs) | |
275 | entries.append((f.unencoded_path, f.file_size)) |
|
275 | if file_size: | |
276 |
|
|
276 | entries.append((f.unencoded_path, file_size)) | |
|
277 | total_bytes += file_size | |||
277 | _test_sync_point_walk_1(repo) |
|
278 | _test_sync_point_walk_1(repo) | |
278 | _test_sync_point_walk_2(repo) |
|
279 | _test_sync_point_walk_2(repo) | |
279 |
|
280 | |||
@@ -680,12 +681,13 b' def _v2_walk(repo, includes, excludes, i' | |||||
680 |
|
681 | |||
681 | for entry in _walkstreamfiles(repo, matcher): |
|
682 | for entry in _walkstreamfiles(repo, matcher): | |
682 | for f in entry.files(): |
|
683 | for f in entry.files(): | |
683 |
|
|
684 | file_size = f.file_size(repo.store.vfs) | |
|
685 | if file_size: | |||
684 | ft = _fileappend |
|
686 | ft = _fileappend | |
685 | if f.is_volatile: |
|
687 | if f.is_volatile: | |
686 | ft = _filefull |
|
688 | ft = _filefull | |
687 |
entries.append((_srcstore, f.unencoded_path, ft, |
|
689 | entries.append((_srcstore, f.unencoded_path, ft, file_size)) | |
688 |
totalfilesize += |
|
690 | totalfilesize += file_size | |
689 | for name in _walkstreamfullstorefiles(repo): |
|
691 | for name in _walkstreamfullstorefiles(repo): | |
690 | if repo.svfs.exists(name): |
|
692 | if repo.svfs.exists(name): | |
691 | totalfilesize += repo.svfs.lstat(name).st_size |
|
693 | totalfilesize += repo.svfs.lstat(name).st_size |
@@ -410,7 +410,7 b' class verifier:' | |||||
410 | for entry in repo.store.datafiles(undecodable=undecodable): |
|
410 | for entry in repo.store.datafiles(undecodable=undecodable): | |
411 | for file_ in entry.files(): |
|
411 | for file_ in entry.files(): | |
412 | f = file_.unencoded_path |
|
412 | f = file_.unencoded_path | |
413 | size = file_.file_size |
|
413 | size = file_.file_size(repo.store.vfs) | |
414 | if (size > 0 or not revlogv1) and f.startswith(b'meta/'): |
|
414 | if (size > 0 or not revlogv1) and f.startswith(b'meta/'): | |
415 | storefiles.add(_normpath(f)) |
|
415 | storefiles.add(_normpath(f)) | |
416 | subdirs.add(os.path.dirname(f)) |
|
416 | subdirs.add(os.path.dirname(f)) | |
@@ -477,7 +477,7 b' class verifier:' | |||||
477 | undecodable = [] |
|
477 | undecodable = [] | |
478 | for entry in repo.store.datafiles(undecodable=undecodable): |
|
478 | for entry in repo.store.datafiles(undecodable=undecodable): | |
479 | for file_ in entry.files(): |
|
479 | for file_ in entry.files(): | |
480 | size = file_.file_size |
|
480 | size = file_.file_size(repo.store.vfs) | |
481 | f = file_.unencoded_path |
|
481 | f = file_.unencoded_path | |
482 | if (size > 0 or not revlogv1) and f.startswith(b'data/'): |
|
482 | if (size > 0 or not revlogv1) and f.startswith(b'data/'): | |
483 | storefiles.add(_normpath(f)) |
|
483 | storefiles.add(_normpath(f)) |
General Comments 0
You need to be logged in to leave comments.
Login now