[Commented On] D10852: streamingclone: extract the scanning part from the generation part
baymax (Baymax, Your Personal Patch-care Companion)
phabricator at mercurial-scm.org
Tue Jun 15 14:25:33 UTC 2021
baymax added a comment.
baymax updated this revision to Diff 28574.
✅ refresh by Heptapod after a successful CI run (🐙 💚)
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D10852?vs=28529&id=28574
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D10852/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D10852
AFFECTED FILES
mercurial/streamclone.py
CHANGE DETAILS
diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py
--- a/mercurial/streamclone.py
+++ b/mercurial/streamclone.py
@@ -603,6 +603,47 @@
"""a function for synchronisation during tests"""
+def _v2_walk(repo, includes, excludes, includeobsmarkers):
+ """emit a seris of files information useful to clone a repo
+
+ return (entries, totalfilesize)
+
+ entries is a list of tuple (vfs-key, file-path, file-type, size)
+
+ - `vfs-key`: is a key to the right vfs to write the file (see _makemap)
+ - `name`: file path of the file to copy (to be feed to the vfss)
+ - `file-type`: do this file need to be copied with the source lock ?
+ - `size`: the size of the file (or None)
+ """
+ assert repo._currentlock(repo._lockref) is not None
+ entries = []
+ totalfilesize = 0
+
+ matcher = None
+ if includes or excludes:
+ matcher = narrowspec.match(repo.root, includes, excludes)
+
+ for rl_type, name, ename, size in _walkstreamfiles(repo, matcher):
+ if size:
+ ft = _fileappend
+ if rl_type & store.FILEFLAGS_VOLATILE:
+ ft = _filefull
+ entries.append((_srcstore, name, ft, size))
+ totalfilesize += 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))
+ for name in cacheutil.cachetocopy(repo):
+ if repo.cachevfs.exists(name):
+ totalfilesize += repo.cachevfs.lstat(name).st_size
+ entries.append((_srccache, name, _filefull, None))
+ return entries, totalfilesize
+
+
def generatev2(repo, includes, excludes, includeobsmarkers):
"""Emit content for version 2 of a streaming clone.
@@ -618,32 +659,14 @@
with repo.lock():
- entries = []
- totalfilesize = 0
-
- matcher = None
- if includes or excludes:
- matcher = narrowspec.match(repo.root, includes, excludes)
+ repo.ui.debug(b'scanning\n')
- repo.ui.debug(b'scanning\n')
- for rl_type, name, ename, size in _walkstreamfiles(repo, matcher):
- if size:
- ft = _fileappend
- if rl_type & store.FILEFLAGS_VOLATILE:
- ft = _filefull
- entries.append((_srcstore, name, ft, size))
- totalfilesize += 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))
- for name in cacheutil.cachetocopy(repo):
- if repo.cachevfs.exists(name):
- totalfilesize += repo.cachevfs.lstat(name).st_size
- entries.append((_srccache, name, _filefull, None))
+ entries, totalfilesize = _v2_walk(
+ repo,
+ includes=includes,
+ excludes=excludes,
+ includeobsmarkers=includeobsmarkers,
+ )
chunks = _emit2(repo, entries, totalfilesize)
first = next(chunks)
To: marmoute, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210615/51d527e3/attachment-0002.html>
More information about the Mercurial-patches
mailing list