Show More
@@ -206,7 +206,8 b' def generatev1(repo):' | |||
|
206 | 206 | # partially encode name over the wire for backwards compat |
|
207 | 207 | yield '%s\0%d\n' % (store.encodedir(name), size) |
|
208 | 208 | if size <= 65536: |
|
209 |
|
|
|
209 | with svfs(name, 'rb') as fp: | |
|
210 | yield fp.read(size) | |
|
210 | 211 | else: |
|
211 | 212 | for chunk in util.filechunkiter(svfs(name), limit=size): |
|
212 | 213 | yield chunk |
@@ -50,3 +50,43 b' Clone with background file closing enabl' | |||
|
50 | 50 | preparing listkeys for "phases" |
|
51 | 51 | sending listkeys command |
|
52 | 52 | received listkey for "phases": 58 bytes |
|
53 | ||
|
54 | ||
|
55 | Stream clone while repo is changing: | |
|
56 | ||
|
57 | $ mkdir changing | |
|
58 | $ cd changing | |
|
59 | ||
|
60 | extension for delaying the server process so we reliably can modify the repo | |
|
61 | while cloning | |
|
62 | ||
|
63 | $ cat > delayer.py <<EOF | |
|
64 | > import time | |
|
65 | > from mercurial import extensions, scmutil | |
|
66 | > def __call__(orig, self, path, *args, **kwargs): | |
|
67 | > if path == 'data/f1.i': | |
|
68 | > time.sleep(2) | |
|
69 | > return orig(self, path, *args, **kwargs) | |
|
70 | > extensions.wrapfunction(scmutil.vfs, '__call__', __call__) | |
|
71 | > EOF | |
|
72 | ||
|
73 | prepare repo with small and big file to cover both code paths in emitrevlogdata | |
|
74 | ||
|
75 | $ hg init repo | |
|
76 | $ touch repo/f1 | |
|
77 | $ $TESTDIR/seq.py 50000 > repo/f2 | |
|
78 | $ hg -R repo ci -Aqm "0" | |
|
79 | $ hg -R repo serve -p $HGPORT1 -d --pid-file=hg.pid --config extensions.delayer=delayer.py | |
|
80 | $ cat hg.pid >> $DAEMON_PIDS | |
|
81 | ||
|
82 | clone while modifying the repo between stating file with write lock and | |
|
83 | actually serving file content | |
|
84 | ||
|
85 | $ hg clone -q --uncompressed -U http://localhost:$HGPORT1 clone & | |
|
86 | $ sleep 1 | |
|
87 | $ echo >> repo/f1 | |
|
88 | $ echo >> repo/f2 | |
|
89 | $ hg -R repo ci -m "1" | |
|
90 | $ wait | |
|
91 | $ hg -R clone id | |
|
92 | 000000000000 |
General Comments 0
You need to be logged in to leave comments.
Login now