##// END OF EJS Templates
store: make `walk` return an entry for phase if requested so...
marmoute -
r51405:a32d739b default
parent child Browse files
Show More
@@ -145,7 +145,7 b' def onetimesetup(ui):'
145 145 )
146 146
147 147 # don't clone filelogs to shallow clients
148 def _walkstreamfiles(orig, repo, matcher=None):
148 def _walkstreamfiles(orig, repo, matcher=None, phase=False):
149 149 if state.shallowremote:
150 150 # if we are shallow ourselves, stream our local commits
151 151 if shallowutil.isenabled(repo):
@@ -200,7 +200,7 b' def onetimesetup(ui):'
200 200 _(b"Cannot clone from a shallow repo to a full repo.")
201 201 )
202 202 else:
203 for x in orig(repo, matcher):
203 for x in orig(repo, matcher, phase=phase):
204 204 yield x
205 205
206 206 extensions.wrapfunction(streamclone, b'_walkstreamfiles', _walkstreamfiles)
@@ -685,7 +685,7 b' class basicstore:'
685 685 details=file_details,
686 686 )
687 687
688 def top_entries(self) -> Generator[BaseStoreEntry, None, None]:
688 def top_entries(self, phase=False) -> Generator[BaseStoreEntry, None, None]:
689 689 files = reversed(self._walk(b'', False))
690 690
691 691 changelogs = collections.defaultdict(dict)
@@ -725,11 +725,18 b' class basicstore:'
725 725 target_id=b'',
726 726 details=file_details,
727 727 )
728 if phase and self.vfs.exists(b'phaseroots'):
729 yield SimpleStoreEntry(
730 entry_path=b'phaseroots',
731 is_volatile=True,
732 )
728 733
729 def walk(self, matcher=None) -> Generator[BaseStoreEntry, None, None]:
734 def walk(
735 self, matcher=None, phase=False
736 ) -> Generator[BaseStoreEntry, None, None]:
730 737 """return files related to data storage (ie: revlogs)
731 738
732 yields (file_type, unencoded, size)
739 yields instance from BaseStoreEntry subclasses
733 740
734 741 if a matcher is passed, storage files of only those tracked paths
735 742 are passed with matches the matcher
@@ -737,7 +744,7 b' class basicstore:'
737 744 # yield data files first
738 745 for x in self.data_entries(matcher):
739 746 yield x
740 for x in self.top_entries():
747 for x in self.top_entries(phase=phase):
741 748 yield x
742 749
743 750 def copylist(self):
@@ -241,8 +241,8 b' def allowservergeneration(repo):'
241 241
242 242
243 243 # This is it's own function so extensions can override it.
244 def _walkstreamfiles(repo, matcher=None):
245 return repo.store.walk(matcher)
244 def _walkstreamfiles(repo, matcher=None, phase=False):
245 return repo.store.walk(matcher, phase=phase)
246 246
247 247
248 248 def generatev1(repo):
@@ -679,7 +679,8 b' def _v2_walk(repo, includes, excludes, i'
679 679 if includes or excludes:
680 680 matcher = narrowspec.match(repo.root, includes, excludes)
681 681
682 for entry in _walkstreamfiles(repo, matcher):
682 phase = not repo.publishing()
683 for entry in _walkstreamfiles(repo, matcher, phase=phase):
683 684 for f in entry.files():
684 685 file_size = f.file_size(repo.store.vfs)
685 686 if file_size:
@@ -688,10 +689,6 b' def _v2_walk(repo, includes, excludes, i'
688 689 ft = _filefull
689 690 entries.append((_srcstore, f.unencoded_path, ft, file_size))
690 691 totalfilesize += file_size
691 for name in _walkstreamfullstorefiles(repo):
692 if repo.svfs.exists(name):
693 totalfilesize += repo.svfs.lstat(name).st_size
694 entries.append((_srcstore, name, _filefull, None))
695 692 if includeobsmarkers and repo.svfs.exists(b'obsstore'):
696 693 totalfilesize += repo.svfs.lstat(b'obsstore').st_size
697 694 entries.append((_srcstore, b'obsstore', _filefull, None))
General Comments 0
You need to be logged in to leave comments. Login now