Mercurial > hg
annotate tests/test-clone-uncompressed.t @ 31975:76169296e52f
obsolescence: add test for the "branch replacement" logic during push, case A2
Mercurial checks for the introduction of new heads on push. Evolution comes
into play to detect if existing branches on the server are being replaced by
some of the new one we push.
The current code for this logic is very basic (eg: issue4354) and was poorly
tested. We have a better implementation coming in the evolve extension fixing
these issues and with more serious tests coverage. In the process of upstreaming
this improved logic, we start with adding the test case that are already passing
with the current implementation. Once they are all in, we'll upstream the better
implementation and the extra test case.
See inline documentation for details about the test case added in this
changeset.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Thu, 13 Apr 2017 16:23:01 +0200 |
parents | e7a35f18d91f |
children | 33b7283a3828 |
rev | line source |
---|---|
27897
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 #require serve |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 |
28389
9ab45fbe045e
bdiff: (pure) support array.array arrays (issue5130)
timeless <timeless@mozdev.org>
parents:
27897
diff
changeset
|
3 Initialize repository |
9ab45fbe045e
bdiff: (pure) support array.array arrays (issue5130)
timeless <timeless@mozdev.org>
parents:
27897
diff
changeset
|
4 the status call is to check for issue5130 |
9ab45fbe045e
bdiff: (pure) support array.array arrays (issue5130)
timeless <timeless@mozdev.org>
parents:
27897
diff
changeset
|
5 |
27897
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
6 $ hg init server |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
7 $ cd server |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
8 $ touch foo |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
9 $ hg -q commit -A -m initial |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
10 >>> for i in range(1024): |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
11 ... with open(str(i), 'wb') as fh: |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
12 ... fh.write(str(i)) |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
13 $ hg -q commit -A -m 'add a lot of files' |
28389
9ab45fbe045e
bdiff: (pure) support array.array arrays (issue5130)
timeless <timeless@mozdev.org>
parents:
27897
diff
changeset
|
14 $ hg st |
27897
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
15 $ hg serve -p $HGPORT -d --pid-file=hg.pid |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
16 $ cat hg.pid >> $DAEMON_PIDS |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
17 $ cd .. |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
18 |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
19 Basic clone |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
20 |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 $ hg clone --uncompressed -U http://localhost:$HGPORT clone1 |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
22 streaming all changes |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
23 1027 files to transfer, 96.3 KB of data |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
24 transferred 96.3 KB in * seconds (*/sec) (glob) |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
25 searching for changes |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
26 no changes found |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
27 |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
28 Clone with background file closing enabled |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
29 |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
30 $ hg --debug --config worker.backgroundclose=true --config worker.backgroundcloseminfilecount=1 clone --uncompressed -U http://localhost:$HGPORT clone-background | grep -v adding |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
31 using http://localhost:$HGPORT/ |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
32 sending capabilities command |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
33 sending branchmap command |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
34 streaming all changes |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
35 sending stream_out command |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
36 1027 files to transfer, 96.3 KB of data |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
37 starting 4 threads for background file closing |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
38 transferred 96.3 KB in * seconds (*/sec) (glob) |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
39 query 1; heads |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
40 sending batch command |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
41 searching for changes |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
42 all remote heads known locally |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
43 no changes found |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
44 sending getbundle command |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
45 bundle2-input-bundle: with-transaction |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
46 bundle2-input-part: "listkeys" (params: 1 mandatory) supported |
29064
9dc27a334fb1
bundle2: properly request phases during getbundle
Mike Hommey <mh@glandium.org>
parents:
28518
diff
changeset
|
47 bundle2-input-part: total payload size 58 |
27897
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
48 bundle2-input-part: "listkeys" (params: 1 mandatory) supported |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
49 bundle2-input-bundle: 1 parts total |
2fdbf22a1b63
streamclone: use backgroundfilecloser (issue4889)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
50 checking for updated bookmarks |
28517
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
51 |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
52 |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
53 Stream clone while repo is changing: |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
54 |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
55 $ mkdir changing |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
56 $ cd changing |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
57 |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
58 extension for delaying the server process so we reliably can modify the repo |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
59 while cloning |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
60 |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
61 $ cat > delayer.py <<EOF |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
62 > import time |
31252
e7a35f18d91f
vfs: use 'vfs' module directly in 'test-clone-uncompressed'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
29064
diff
changeset
|
63 > from mercurial import extensions, vfs |
28517
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
64 > def __call__(orig, self, path, *args, **kwargs): |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
65 > if path == 'data/f1.i': |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
66 > time.sleep(2) |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
67 > return orig(self, path, *args, **kwargs) |
31252
e7a35f18d91f
vfs: use 'vfs' module directly in 'test-clone-uncompressed'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
29064
diff
changeset
|
68 > extensions.wrapfunction(vfs.vfs, '__call__', __call__) |
28517
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
69 > EOF |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
70 |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
71 prepare repo with small and big file to cover both code paths in emitrevlogdata |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
72 |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
73 $ hg init repo |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
74 $ touch repo/f1 |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
75 $ $TESTDIR/seq.py 50000 > repo/f2 |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
76 $ hg -R repo ci -Aqm "0" |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
77 $ hg -R repo serve -p $HGPORT1 -d --pid-file=hg.pid --config extensions.delayer=delayer.py |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
78 $ cat hg.pid >> $DAEMON_PIDS |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
79 |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
80 clone while modifying the repo between stating file with write lock and |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
81 actually serving file content |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
82 |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
83 $ hg clone -q --uncompressed -U http://localhost:$HGPORT1 clone & |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
84 $ sleep 1 |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
85 $ echo >> repo/f1 |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
86 $ echo >> repo/f2 |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
87 $ hg -R repo ci -m "1" |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
88 $ wait |
95163ababeb8
tests: add test of stream clone of repo that is changing
Mads Kiilerich <madski@unity3d.com>
parents:
28389
diff
changeset
|
89 $ hg -R clone id |
28518
aa440c3d7c5d
streamclone: fix error when store files grow while stream cloning
Mads Kiilerich <madski@unity3d.com>
parents:
28517
diff
changeset
|
90 000000000000 |