[PATCH 3 of 8] clone: add an argument to determine if a clone should stream files
Durham Goode
durham at fb.com
Mon May 6 14:36:53 CDT 2013
# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1367429921 25200
# Wed May 01 10:38:41 2013 -0700
# Node ID e5c4416f076c1a99ea99fe83da9a009a15ca33ea
# Parent 4da152c208d0f853bd03781a5d7a9b9cc8716a19
clone: add an argument to determine if a clone should stream files
This adds an argument to wireproto.stream to specify if a streaming clone should stream
file contents. This allows an extension to prevent file contents from being
streamed.
diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -322,13 +322,16 @@
def datafiles(self):
return self._walk('data', True)
+ def topfiles(self):
+ return reversed(self._walk('', False))
+
def walk(self):
'''yields (unencoded, encoded, size)'''
# yield data files first
for x in self.datafiles():
yield x
# yield manifest before changelog
- for x in reversed(self._walk('', False)):
+ for x in self.topfiles():
yield x
def copylist(self):
diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -523,7 +523,7 @@
def _allowstream(ui):
return ui.configbool('server', 'uncompressed', True, untrusted=True)
-def stream(repo, proto):
+def stream(repo, proto, includedatafiles=True):
'''If the server supports streaming clone, it advertises the "stream"
capability with a value representing the version and flags of the repo
it is serving. Client checks to see if it understands the format.
@@ -544,7 +544,10 @@
lock = repo.lock()
try:
repo.ui.debug('scanning\n')
- for name, ename, size in repo.store.walk():
+ walkgen = repo.store.walk()
+ if not includedatafiles:
+ walkgen = repo.store.topfiles()
+ for name, ename, size in walkgen:
if size:
entries.append((name, size))
total_bytes += size
More information about the Mercurial-devel
mailing list