##// END OF EJS Templates
streamclone: use backgroundfilecloser (issue4889)...
Gregory Szorc -
r27897:2fdbf22a default
parent child Browse files
Show More
@@ -0,0 +1,48 b''
1 #require serve
2
3 $ hg init server
4 $ cd server
5 $ touch foo
6 $ hg -q commit -A -m initial
7 >>> for i in range(1024):
8 ... with open(str(i), 'wb') as fh:
9 ... fh.write(str(i))
10 $ hg -q commit -A -m 'add a lot of files'
11 $ hg serve -p $HGPORT -d --pid-file=hg.pid
12 $ cat hg.pid >> $DAEMON_PIDS
13 $ cd ..
14
15 Basic clone
16
17 $ hg clone --uncompressed -U http://localhost:$HGPORT clone1
18 streaming all changes
19 1027 files to transfer, 96.3 KB of data
20 transferred 96.3 KB in * seconds (*/sec) (glob)
21 searching for changes
22 no changes found
23
24 Clone with background file closing enabled
25
26 $ hg --debug --config worker.backgroundclose=true --config worker.backgroundcloseminfilecount=1 clone --uncompressed -U http://localhost:$HGPORT clone-background | grep -v adding
27 using http://localhost:$HGPORT/
28 sending capabilities command
29 sending branchmap command
30 streaming all changes
31 sending stream_out command
32 1027 files to transfer, 96.3 KB of data
33 starting 4 threads for background file closing
34 transferred 96.3 KB in * seconds (*/sec) (glob)
35 query 1; heads
36 sending batch command
37 searching for changes
38 all remote heads known locally
39 no changes found
40 sending getbundle command
41 bundle2-input-bundle: with-transaction
42 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
43 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
44 bundle2-input-bundle: 1 parts total
45 checking for updated bookmarks
46 preparing listkeys for "phases"
47 sending listkeys command
48 received listkey for "phases": 58 bytes
@@ -298,7 +298,7 b' def consumev1(repo, fp, filecount, bytec'
298 start = time.time()
298 start = time.time()
299
299
300 with repo.transaction('clone'):
300 with repo.transaction('clone'):
301 if True:
301 with repo.svfs.backgroundclosing(repo.ui, expectedcount=filecount):
302 for i in xrange(filecount):
302 for i in xrange(filecount):
303 # XXX doesn't support '\n' or '\r' in filenames
303 # XXX doesn't support '\n' or '\r' in filenames
304 l = fp.readline()
304 l = fp.readline()
@@ -312,7 +312,8 b' def consumev1(repo, fp, filecount, bytec'
312 repo.ui.debug('adding %s (%s)\n' %
312 repo.ui.debug('adding %s (%s)\n' %
313 (name, util.bytecount(size)))
313 (name, util.bytecount(size)))
314 # for backwards compat, name was partially encoded
314 # for backwards compat, name was partially encoded
315 with repo.svfs(store.decodedir(name), 'w') as ofp:
315 path = store.decodedir(name)
316 with repo.svfs(path, 'w', backgroundclose=True) as ofp:
316 for chunk in util.filechunkiter(fp, limit=size):
317 for chunk in util.filechunkiter(fp, limit=size):
317 handled_bytes += len(chunk)
318 handled_bytes += len(chunk)
318 repo.ui.progress(_('clone'), handled_bytes,
319 repo.ui.progress(_('clone'), handled_bytes,
General Comments 0
You need to be logged in to leave comments. Login now