Mercurial > hg
annotate tests/test-bookmarks-corner-case.t @ 45347:1aef38d973e8
merge: pass mergeresult obj in _forgetremoved() (API)
Instead of returning a dict of actions and then updating it, let's pass the
object directly and update it there.
This makes `updateactions()` on mergeresult unused and this patch removes that.
After this patch, we have couple of methods left on mergeresult class which
still exposes the internal dict based action storage.
Differential Revision: https://phab.mercurial-scm.org/D8889
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 05 Aug 2020 16:52:51 +0530 |
parents | 7e19b640c53e |
children | 9c4204b7f3e4 |
rev | line source |
---|---|
42322
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
1 ================================ |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
2 Test corner case around bookmark |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
3 ================================ |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
4 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
5 This test file is meant to gather test around bookmark that are specific |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
6 enough to not find a place elsewhere. |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
7 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
8 Test bookmark/changelog race condition |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
9 ====================================== |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
10 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
11 The data from the bookmark file are filtered to only contains bookmark with |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
12 node known to the changelog. If the cache invalidation between these two bits |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
13 goes wrong, bookmark can be dropped. |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
14 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
15 global setup |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
16 ------------ |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
17 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
18 $ cat >> $HGRCPATH << EOF |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
19 > [ui] |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
20 > ssh = "$PYTHON" "$TESTDIR/dummyssh" |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
21 > [server] |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
22 > concurrent-push-mode=check-related |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
23 > EOF |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
24 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
25 Setup |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
26 ----- |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
27 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
28 initial repository setup |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
29 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
30 $ hg init bookrace-server |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
31 $ cd bookrace-server |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
32 $ echo a > a |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
33 $ hg add a |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
34 $ hg commit -m root |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
35 $ echo a >> a |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
36 $ hg bookmark book-A |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
37 $ hg commit -m A0 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
38 $ hg up 'desc(root)' |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
39 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
40 (leaving bookmark book-A) |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
41 $ echo b > b |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
42 $ hg add b |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
43 $ hg bookmark book-B |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
44 $ hg commit -m B0 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
45 created new head |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
46 $ hg up null |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
47 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
48 (leaving bookmark book-B) |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
49 $ hg phase --public --rev 'all()' |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
50 $ hg log -G |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
51 o changeset: 2:c79985706978 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
52 | bookmark: book-B |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
53 | tag: tip |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
54 | parent: 0:6569b5a81c7e |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
55 | user: test |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
56 | date: Thu Jan 01 00:00:00 1970 +0000 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
57 | summary: B0 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
58 | |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
59 | o changeset: 1:39c28d785860 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
60 |/ bookmark: book-A |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
61 | user: test |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
62 | date: Thu Jan 01 00:00:00 1970 +0000 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
63 | summary: A0 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
64 | |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
65 o changeset: 0:6569b5a81c7e |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
66 user: test |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
67 date: Thu Jan 01 00:00:00 1970 +0000 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
68 summary: root |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
69 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
70 $ hg book |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
71 book-A 1:39c28d785860 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
72 book-B 2:c79985706978 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
73 $ cd .. |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
74 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
75 Add new changeset on each bookmark in distinct clones |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
76 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
77 $ hg clone ssh://user@dummy/bookrace-server client-A |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
78 requesting all changes |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
79 adding changesets |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
80 adding manifests |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
81 adding file changes |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
82 added 3 changesets with 3 changes to 2 files (+1 heads) |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
83 new changesets 6569b5a81c7e:c79985706978 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
84 updating to branch default |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
85 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
86 $ hg -R client-A update book-A |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
87 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
88 (activating bookmark book-A) |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
89 $ echo a >> client-A/a |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
90 $ hg -R client-A commit -m A1 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
91 $ hg clone ssh://user@dummy/bookrace-server client-B |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
92 requesting all changes |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
93 adding changesets |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
94 adding manifests |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
95 adding file changes |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
96 added 3 changesets with 3 changes to 2 files (+1 heads) |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
97 new changesets 6569b5a81c7e:c79985706978 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
98 updating to branch default |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
99 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
100 $ hg -R client-B update book-B |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
101 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
102 (activating bookmark book-B) |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
103 $ echo b >> client-B/b |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
104 $ hg -R client-B commit -m B1 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
105 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
106 extension to reproduce the race |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
107 ------------------------------- |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
108 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
109 If two process are pushing we want to make sure the following happens: |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
110 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
111 * process A read changelog |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
112 * process B to its full push |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
113 * process A read bookmarks |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
114 * process A proceed with rest of the push |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
115 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
116 We build a server side extension for this purpose |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
117 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
118 $ cat > bookrace.py << EOF |
42389
055687fe4c47
tests: sort some imports that were previously missed
Augie Fackler <augie@google.com>
parents:
42324
diff
changeset
|
119 > import atexit |
42322
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
120 > import os |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
121 > import time |
42666
cfb774aae660
tests: sort imports in test-bookmarks-corner-case.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
42624
diff
changeset
|
122 > from mercurial import bookmarks, error, extensions |
42507
febf5c8215c1
test: factor out the "wait" logic in bookrace
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42506
diff
changeset
|
123 > |
42508
c4d1807b165f
test: add some assert in the bookrace extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42507
diff
changeset
|
124 > def wait(repo): |
42322
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
125 > if not os.path.exists('push-A-started'): |
42508
c4d1807b165f
test: add some assert in the bookrace extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42507
diff
changeset
|
126 > assert repo._currentlock(repo._lockref) is None |
c4d1807b165f
test: add some assert in the bookrace extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42507
diff
changeset
|
127 > assert repo._currentlock(repo._wlockref) is None |
42430
5b217451a2c2
py3: fix test-bookmarks-corner-case.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
42389
diff
changeset
|
128 > repo.ui.status(b'setting raced push up\n') |
42322
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
129 > with open('push-A-started', 'w'): |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
130 > pass |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
131 > clock = 300 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
132 > while not os.path.exists('push-B-done'): |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
133 > clock -= 1 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
134 > if clock <= 0: |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
135 > raise error.Abort("race scenario timed out") |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
136 > time.sleep(0.1) |
42507
febf5c8215c1
test: factor out the "wait" logic in bookrace
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42506
diff
changeset
|
137 > |
42509
95c2f951e502
bookmarks: actually trigger the race deleting bookmark in the test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42508
diff
changeset
|
138 > def reposetup(ui, repo): |
95c2f951e502
bookmarks: actually trigger the race deleting bookmark in the test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42508
diff
changeset
|
139 > class racedrepo(repo.__class__): |
95c2f951e502
bookmarks: actually trigger the race deleting bookmark in the test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42508
diff
changeset
|
140 > @property |
95c2f951e502
bookmarks: actually trigger the race deleting bookmark in the test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42508
diff
changeset
|
141 > def _bookmarks(self): |
95c2f951e502
bookmarks: actually trigger the race deleting bookmark in the test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42508
diff
changeset
|
142 > wait(self) |
95c2f951e502
bookmarks: actually trigger the race deleting bookmark in the test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42508
diff
changeset
|
143 > return super(racedrepo, self)._bookmarks |
95c2f951e502
bookmarks: actually trigger the race deleting bookmark in the test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42508
diff
changeset
|
144 > repo.__class__ = racedrepo |
95c2f951e502
bookmarks: actually trigger the race deleting bookmark in the test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42508
diff
changeset
|
145 > |
42322
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
146 > def e(): |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
147 > with open('push-A-done', 'w'): |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
148 > pass |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
149 > atexit.register(e) |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
150 > EOF |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
151 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
152 Actual test |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
153 ----------- |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
154 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
155 Start the raced push. |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
156 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
157 $ cat >> bookrace-server/.hg/hgrc << EOF |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
158 > [extensions] |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
159 > bookrace=$TESTTMP/bookrace.py |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
160 > EOF |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
161 $ hg push -R client-A -r book-A >push-output.txt 2>&1 & |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
162 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
163 Wait up to 30 seconds for that push to start. |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
164 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
165 $ clock=30 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
166 $ while [ ! -f push-A-started ] && [ $clock -gt 0 ] ; do |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
167 > clock=`expr $clock - 1` |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
168 > sleep 1 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
169 > done |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
170 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
171 Do the other push. |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
172 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
173 $ cat >> bookrace-server/.hg/hgrc << EOF |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
174 > [extensions] |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
175 > bookrace=! |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
176 > EOF |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
177 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
178 $ hg push -R client-B -r book-B |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
179 pushing to ssh://user@dummy/bookrace-server |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
180 searching for changes |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
181 remote: adding changesets |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
182 remote: adding manifests |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
183 remote: adding file changes |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
184 remote: added 1 changesets with 1 changes to 1 files |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
185 updating bookmark book-B |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
186 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
187 Signal the raced put that we are done (it waits up to 30 seconds). |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
188 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
189 $ touch push-B-done |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
190 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
191 Wait for the raced push to finish (with the remaning of the initial 30 seconds). |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
192 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
193 $ while [ ! -f push-A-done ] && [ $clock -gt 0 ] ; do |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
194 > clock=`expr $clock - 1` |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
195 > sleep 1 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
196 > done |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
197 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
198 Check raced push output. |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
199 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
200 $ cat push-output.txt |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
201 pushing to ssh://user@dummy/bookrace-server |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
202 searching for changes |
42896
7e19b640c53e
sshserver: flush stream after command dispatch
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42685
diff
changeset
|
203 remote: setting raced push up |
42682
e0cf09bc35ef
bookmarks: actual fix for race condition deleting bookmark
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42624
diff
changeset
|
204 remote has heads on branch 'default' that are not known locally: f26c3b5167d1 |
42322
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
205 remote: adding changesets |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
206 remote: adding manifests |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
207 remote: adding file changes |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
208 remote: added 1 changesets with 1 changes to 1 files |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
209 updating bookmark book-A |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
210 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
211 Check result of the push. |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
212 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
213 $ hg -R bookrace-server log -G |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
214 o changeset: 4:9ce3b28c16de |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
215 | bookmark: book-A |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
216 | tag: tip |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
217 | parent: 1:39c28d785860 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
218 | user: test |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
219 | date: Thu Jan 01 00:00:00 1970 +0000 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
220 | summary: A1 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
221 | |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
222 | o changeset: 3:f26c3b5167d1 |
42682
e0cf09bc35ef
bookmarks: actual fix for race condition deleting bookmark
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42624
diff
changeset
|
223 | | bookmark: book-B |
42322
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
224 | | user: test |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
225 | | date: Thu Jan 01 00:00:00 1970 +0000 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
226 | | summary: B1 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
227 | | |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
228 | o changeset: 2:c79985706978 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
229 | | parent: 0:6569b5a81c7e |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
230 | | user: test |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
231 | | date: Thu Jan 01 00:00:00 1970 +0000 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
232 | | summary: B0 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
233 | | |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
234 o | changeset: 1:39c28d785860 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
235 |/ user: test |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
236 | date: Thu Jan 01 00:00:00 1970 +0000 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
237 | summary: A0 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
238 | |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
239 o changeset: 0:6569b5a81c7e |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
240 user: test |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
241 date: Thu Jan 01 00:00:00 1970 +0000 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
242 summary: root |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
243 |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
244 $ hg -R bookrace-server book |
d2c871b78c36
bookmark: add a test for a race condition on push
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
245 book-A 4:9ce3b28c16de |
42682
e0cf09bc35ef
bookmarks: actual fix for race condition deleting bookmark
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42624
diff
changeset
|
246 book-B 3:f26c3b5167d1 |