diff --git a/hgext/remotefilelog/remotefilelogserver.py b/hgext/remotefilelog/remotefilelogserver.py --- a/hgext/remotefilelog/remotefilelogserver.py +++ b/hgext/remotefilelog/remotefilelogserver.py @@ -145,7 +145,7 @@ def onetimesetup(ui): ) # don't clone filelogs to shallow clients - def _walkstreamfiles(orig, repo, matcher=None): + def _walkstreamfiles(orig, repo, matcher=None, phase=False): if state.shallowremote: # if we are shallow ourselves, stream our local commits if shallowutil.isenabled(repo): @@ -200,7 +200,7 @@ def onetimesetup(ui): _(b"Cannot clone from a shallow repo to a full repo.") ) else: - for x in orig(repo, matcher): + for x in orig(repo, matcher, phase=phase): yield x extensions.wrapfunction(streamclone, b'_walkstreamfiles', _walkstreamfiles) diff --git a/mercurial/store.py b/mercurial/store.py --- a/mercurial/store.py +++ b/mercurial/store.py @@ -685,7 +685,7 @@ class basicstore: details=file_details, ) - def top_entries(self) -> Generator[BaseStoreEntry, None, None]: + def top_entries(self, phase=False) -> Generator[BaseStoreEntry, None, None]: files = reversed(self._walk(b'', False)) changelogs = collections.defaultdict(dict) @@ -725,11 +725,18 @@ class basicstore: target_id=b'', details=file_details, ) + if phase and self.vfs.exists(b'phaseroots'): + yield SimpleStoreEntry( + entry_path=b'phaseroots', + is_volatile=True, + ) - def walk(self, matcher=None) -> Generator[BaseStoreEntry, None, None]: + def walk( + self, matcher=None, phase=False + ) -> Generator[BaseStoreEntry, None, None]: """return files related to data storage (ie: revlogs) - yields (file_type, unencoded, size) + yields instance from BaseStoreEntry subclasses if a matcher is passed, storage files of only those tracked paths are passed with matches the matcher @@ -737,7 +744,7 @@ class basicstore: # yield data files first for x in self.data_entries(matcher): yield x - for x in self.top_entries(): + for x in self.top_entries(phase=phase): yield x def copylist(self): diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py --- a/mercurial/streamclone.py +++ b/mercurial/streamclone.py @@ -241,8 +241,8 @@ def allowservergeneration(repo): # This is it's own function so extensions can override it. -def _walkstreamfiles(repo, matcher=None): - return repo.store.walk(matcher) +def _walkstreamfiles(repo, matcher=None, phase=False): + return repo.store.walk(matcher, phase=phase) def generatev1(repo): @@ -679,7 +679,8 @@ def _v2_walk(repo, includes, excludes, i if includes or excludes: matcher = narrowspec.match(repo.root, includes, excludes) - for entry in _walkstreamfiles(repo, matcher): + phase = not repo.publishing() + for entry in _walkstreamfiles(repo, matcher, phase=phase): for f in entry.files(): file_size = f.file_size(repo.store.vfs) if file_size: @@ -688,10 +689,6 @@ def _v2_walk(repo, includes, excludes, i ft = _filefull entries.append((_srcstore, f.unencoded_path, ft, file_size)) totalfilesize += file_size - for name in _walkstreamfullstorefiles(repo): - if repo.svfs.exists(name): - totalfilesize += repo.svfs.lstat(name).st_size - entries.append((_srcstore, name, _filefull, None)) if includeobsmarkers and repo.svfs.exists(b'obsstore'): totalfilesize += repo.svfs.lstat(b'obsstore').st_size entries.append((_srcstore, b'obsstore', _filefull, None))