Show More
@@ -524,6 +524,16 class BaseStoreEntry: | |||||
524 | assert vfs is not None |
|
524 | assert vfs is not None | |
525 | return [f.get_stream(vfs, volatiles) for f in self.files()] |
|
525 | return [f.get_stream(vfs, volatiles) for f in self.files()] | |
526 |
|
526 | |||
|
527 | def preserve_volatiles(self, vfs, volatiles): | |||
|
528 | """Use a VolatileManager to preserve the state of any volatile file | |||
|
529 | ||||
|
530 | This is useful for code that need a consistent view of the content like stream clone. | |||
|
531 | """ | |||
|
532 | if self.maybe_volatile: | |||
|
533 | for f in self.files(): | |||
|
534 | if f.is_volatile: | |||
|
535 | volatiles(vfs.join(f.unencoded_path)) | |||
|
536 | ||||
527 |
|
537 | |||
528 | @attr.s(slots=True, init=False) |
|
538 | @attr.s(slots=True, init=False) | |
529 | class SimpleStoreEntry(BaseStoreEntry): |
|
539 | class SimpleStoreEntry(BaseStoreEntry): |
@@ -714,9 +714,8 def _emit2(repo, entries): | |||||
714 | with util.nogc(): |
|
714 | with util.nogc(): | |
715 | # record the expected size of every file |
|
715 | # record the expected size of every file | |
716 | for k, vfs, e in entries: |
|
716 | for k, vfs, e in entries: | |
|
717 | e.preserve_volatiles(vfs, volatiles) | |||
717 | for f in e.files(): |
|
718 | for f in e.files(): | |
718 | if f.is_volatile: |
|
|||
719 | volatiles(vfs.join(f.unencoded_path)) |
|
|||
720 | file_count += 1 |
|
719 | file_count += 1 | |
721 | totalfilesize += f.file_size(vfs) |
|
720 | totalfilesize += f.file_size(vfs) | |
722 |
|
721 | |||
@@ -777,11 +776,11 def _emit3(repo, entries): | |||||
777 | # make sure we preserve volatile files |
|
776 | # make sure we preserve volatile files | |
778 | for k, vfs, e in entries: |
|
777 | for k, vfs, e in entries: | |
779 | if e.maybe_volatile: |
|
778 | if e.maybe_volatile: | |
|
779 | e.preserve_volatiles(vfs, volatiles) | |||
780 | for f in e.files(): |
|
780 | for f in e.files(): | |
781 | if f.is_volatile: |
|
781 | if f.is_volatile: | |
782 | # record the expected size under lock |
|
782 | # record the expected size under lock | |
783 | f.file_size(vfs) |
|
783 | f.file_size(vfs) | |
784 | volatiles(vfs.join(f.unencoded_path)) |
|
|||
785 |
|
784 | |||
786 | total_entry_count = len(entries) |
|
785 | total_entry_count = len(entries) | |
787 |
|
786 |
General Comments 0
You need to be logged in to leave comments.
Login now