Show More
@@ -0,0 +1,207 b'' | |||||
|
1 | ============================= | |||
|
2 | Test distributed obsolescence | |||
|
3 | ============================= | |||
|
4 | ||||
|
5 | This file test various cases where data (changeset, phase, obsmarkers) is | |||
|
6 | added to the repository in a specific order. Usually, this order is unlikely | |||
|
7 | to happen in the local case but can easily happen in the distributed case. | |||
|
8 | ||||
|
9 | $ unset HGUSER | |||
|
10 | $ unset EMAIL | |||
|
11 | $ . $TESTDIR/testlib/obsmarker-common.sh | |||
|
12 | $ cat >> $HGRCPATH << EOF | |||
|
13 | > [experimental] | |||
|
14 | > evolution = all | |||
|
15 | > [phases] | |||
|
16 | > publish = False | |||
|
17 | > [templates] | |||
|
18 | > obsfatesuccessors = "{if(successors, " as ")}{join(successors, ", ")}" | |||
|
19 | > obsfateverb = "{obsfateverb(successors)}" | |||
|
20 | > obsfateoperations = "{if(obsfateoperations(markers), " using {join(obsfateoperations(markers), ", ")}")}" | |||
|
21 | > obsfateusers = "{if(obsfateusers(markers), " by {join(obsfateusers(markers), ", ")}")}" | |||
|
22 | > obsfatedate = "{if(obsfatedate(markers), "{ifeq(min(obsfatedate(markers)), max(obsfatedate(markers)), " (at {min(obsfatedate(markers))|isodate})", " (between {min(obsfatedate(markers))|isodate} and {max(obsfatedate(markers))|isodate})")}")}" | |||
|
23 | > obsfate = "{obsfateverb}{obsfateoperations}{obsfatesuccessors}{obsfateusers}{obsfatedate}; " | |||
|
24 | > [ui] | |||
|
25 | > logtemplate= {rev}:{node|short} {desc} {if(succsandmarkers, "[{succsandmarkers % "{obsfate}"}]")}\n | |||
|
26 | > EOF | |||
|
27 | ||||
|
28 | Check distributed chain building | |||
|
29 | ================================ | |||
|
30 | ||||
|
31 | Test case where a changeset is marked as a successor of another local | |||
|
32 | changeset while the successor has already been obsoleted remotely. | |||
|
33 | ||||
|
34 | The chain of evolution should seamlessly connect and all but the new version | |||
|
35 | (created remotely) should be seen as obsolete. | |||
|
36 | ||||
|
37 | Initial setup | |||
|
38 | ||||
|
39 | $ mkdir distributed-chain-building | |||
|
40 | $ cd distributed-chain-building | |||
|
41 | $ hg init server | |||
|
42 | $ cd server | |||
|
43 | $ cat << EOF >> .hg/hgrc | |||
|
44 | > [ui] | |||
|
45 | > username = server | |||
|
46 | > EOF | |||
|
47 | $ mkcommit ROOT | |||
|
48 | $ mkcommit c_A0 | |||
|
49 | $ hg up 'desc("ROOT")' | |||
|
50 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
51 | $ mkcommit c_A1 | |||
|
52 | created new head | |||
|
53 | $ hg up 'desc("ROOT")' | |||
|
54 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
55 | $ mkcommit c_B0 | |||
|
56 | created new head | |||
|
57 | $ hg debugobsolete `getid 'desc("c_A0")'` `getid 'desc("c_A1")'` | |||
|
58 | obsoleted 1 changesets | |||
|
59 | $ hg log -G --hidden | |||
|
60 | @ 3:e5d7dda7cd28 c_B0 | |||
|
61 | | | |||
|
62 | | o 2:7f6b0a6f5c25 c_A1 | |||
|
63 | |/ | |||
|
64 | | x 1:e1b46f0f979f c_A0 [rewritten as 2:7f6b0a6f5c25 by server (at 1970-01-01 00:00 +0000); ] | |||
|
65 | |/ | |||
|
66 | o 0:e82fb8d02bbf ROOT | |||
|
67 | ||||
|
68 | $ hg debugobsolete | |||
|
69 | e1b46f0f979f52748347ff8729c59f2ef56e6fe2 7f6b0a6f5c25345a83870963efd827c1798a5959 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'server'} | |||
|
70 | $ cd .. | |||
|
71 | ||||
|
72 | duplicate the repo for the client: | |||
|
73 | ||||
|
74 | $ cp -R server client | |||
|
75 | $ cat << EOF >> client/.hg/hgrc | |||
|
76 | > [paths] | |||
|
77 | > default = ../server/ | |||
|
78 | > [ui] | |||
|
79 | > username = client | |||
|
80 | > EOF | |||
|
81 | ||||
|
82 | server side: create new revision on the server (obsoleting another one) | |||
|
83 | ||||
|
84 | $ cd server | |||
|
85 | $ hg up 'desc("ROOT")' | |||
|
86 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
87 | $ mkcommit c_B1 | |||
|
88 | created new head | |||
|
89 | $ hg debugobsolete `getid 'desc("c_B0")'` `getid 'desc("c_B1")'` | |||
|
90 | obsoleted 1 changesets | |||
|
91 | $ hg log -G | |||
|
92 | @ 4:391a2bf12b1b c_B1 | |||
|
93 | | | |||
|
94 | | o 2:7f6b0a6f5c25 c_A1 | |||
|
95 | |/ | |||
|
96 | o 0:e82fb8d02bbf ROOT | |||
|
97 | ||||
|
98 | $ hg log -G --hidden | |||
|
99 | @ 4:391a2bf12b1b c_B1 | |||
|
100 | | | |||
|
101 | | x 3:e5d7dda7cd28 c_B0 [rewritten as 4:391a2bf12b1b by server (at 1970-01-01 00:00 +0000); ] | |||
|
102 | |/ | |||
|
103 | | o 2:7f6b0a6f5c25 c_A1 | |||
|
104 | |/ | |||
|
105 | | x 1:e1b46f0f979f c_A0 [rewritten as 2:7f6b0a6f5c25 by server (at 1970-01-01 00:00 +0000); ] | |||
|
106 | |/ | |||
|
107 | o 0:e82fb8d02bbf ROOT | |||
|
108 | ||||
|
109 | $ hg debugobsolete | |||
|
110 | e1b46f0f979f52748347ff8729c59f2ef56e6fe2 7f6b0a6f5c25345a83870963efd827c1798a5959 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'server'} | |||
|
111 | e5d7dda7cd28e6b3f79437e5b8122a38ece0255c 391a2bf12b1b8b05a72400ae36b26d50a091dc22 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'server'} | |||
|
112 | $ cd .. | |||
|
113 | ||||
|
114 | client side: create a marker between two common changesets | |||
|
115 | (client is not aware of the server activity yet) | |||
|
116 | ||||
|
117 | $ cd client | |||
|
118 | $ hg debugobsolete `getid 'desc("c_A1")'` `getid 'desc("c_B0")'` | |||
|
119 | obsoleted 1 changesets | |||
|
120 | $ hg log -G | |||
|
121 | @ 3:e5d7dda7cd28 c_B0 | |||
|
122 | | | |||
|
123 | o 0:e82fb8d02bbf ROOT | |||
|
124 | ||||
|
125 | $ hg log -G --hidden | |||
|
126 | @ 3:e5d7dda7cd28 c_B0 | |||
|
127 | | | |||
|
128 | | x 2:7f6b0a6f5c25 c_A1 [rewritten as 3:e5d7dda7cd28 by client (at 1970-01-01 00:00 +0000); ] | |||
|
129 | |/ | |||
|
130 | | x 1:e1b46f0f979f c_A0 [rewritten as 2:7f6b0a6f5c25 by server (at 1970-01-01 00:00 +0000); ] | |||
|
131 | |/ | |||
|
132 | o 0:e82fb8d02bbf ROOT | |||
|
133 | ||||
|
134 | $ hg debugobsolete | |||
|
135 | e1b46f0f979f52748347ff8729c59f2ef56e6fe2 7f6b0a6f5c25345a83870963efd827c1798a5959 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'server'} | |||
|
136 | 7f6b0a6f5c25345a83870963efd827c1798a5959 e5d7dda7cd28e6b3f79437e5b8122a38ece0255c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'client'} | |||
|
137 | ||||
|
138 | client side: pull from the server | |||
|
139 | (the new successors should take over) | |||
|
140 | ||||
|
141 | $ hg up 'desc("ROOT")' | |||
|
142 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
143 | $ hg pull | |||
|
144 | pulling from $TESTTMP/distributed-chain-building/server (glob) | |||
|
145 | searching for changes | |||
|
146 | adding changesets | |||
|
147 | adding manifests | |||
|
148 | adding file changes | |||
|
149 | added 1 changesets with 1 changes to 1 files (+1 heads) | |||
|
150 | 1 new obsolescence markers | |||
|
151 | obsoleted 1 changesets | |||
|
152 | (run 'hg heads' to see heads) | |||
|
153 | $ hg log -G | |||
|
154 | o 4:391a2bf12b1b c_B1 | |||
|
155 | | | |||
|
156 | @ 0:e82fb8d02bbf ROOT | |||
|
157 | ||||
|
158 | $ hg log -G --hidden | |||
|
159 | o 4:391a2bf12b1b c_B1 | |||
|
160 | | | |||
|
161 | | x 3:e5d7dda7cd28 c_B0 [rewritten as 4:391a2bf12b1b by server (at 1970-01-01 00:00 +0000); ] | |||
|
162 | |/ | |||
|
163 | | x 2:7f6b0a6f5c25 c_A1 [rewritten as 3:e5d7dda7cd28 by client (at 1970-01-01 00:00 +0000); ] | |||
|
164 | |/ | |||
|
165 | | x 1:e1b46f0f979f c_A0 [rewritten as 2:7f6b0a6f5c25 by server (at 1970-01-01 00:00 +0000); ] | |||
|
166 | |/ | |||
|
167 | @ 0:e82fb8d02bbf ROOT | |||
|
168 | ||||
|
169 | $ hg debugobsolete | |||
|
170 | e1b46f0f979f52748347ff8729c59f2ef56e6fe2 7f6b0a6f5c25345a83870963efd827c1798a5959 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'server'} | |||
|
171 | 7f6b0a6f5c25345a83870963efd827c1798a5959 e5d7dda7cd28e6b3f79437e5b8122a38ece0255c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'client'} | |||
|
172 | e5d7dda7cd28e6b3f79437e5b8122a38ece0255c 391a2bf12b1b8b05a72400ae36b26d50a091dc22 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'server'} | |||
|
173 | ||||
|
174 | server side: receive client push | |||
|
175 | (the other way around, pushing to the server, the obsolete changesets stay | |||
|
176 | obsolete on the server side but the marker is sent out.) | |||
|
177 | ||||
|
178 | $ hg rollback | |||
|
179 | repository tip rolled back to revision 3 (undo pull) | |||
|
180 | $ hg push -f | |||
|
181 | pushing to $TESTTMP/distributed-chain-building/server (glob) | |||
|
182 | searching for changes | |||
|
183 | adding changesets | |||
|
184 | adding manifests | |||
|
185 | adding file changes | |||
|
186 | added 0 changesets with 0 changes to 1 files | |||
|
187 | 1 new obsolescence markers | |||
|
188 | obsoleted 1 changesets | |||
|
189 | $ hg -R ../server/ log -G | |||
|
190 | @ 4:391a2bf12b1b c_B1 | |||
|
191 | | | |||
|
192 | o 0:e82fb8d02bbf ROOT | |||
|
193 | ||||
|
194 | $ hg -R ../server/ log -G --hidden | |||
|
195 | @ 4:391a2bf12b1b c_B1 | |||
|
196 | | | |||
|
197 | | x 3:e5d7dda7cd28 c_B0 [rewritten as 4:391a2bf12b1b by server (at 1970-01-01 00:00 +0000); ] | |||
|
198 | |/ | |||
|
199 | | x 2:7f6b0a6f5c25 c_A1 [rewritten as 3:e5d7dda7cd28 by client (at 1970-01-01 00:00 +0000); ] | |||
|
200 | |/ | |||
|
201 | | x 1:e1b46f0f979f c_A0 [rewritten as 2:7f6b0a6f5c25 by server (at 1970-01-01 00:00 +0000); ] | |||
|
202 | |/ | |||
|
203 | o 0:e82fb8d02bbf ROOT | |||
|
204 | ||||
|
205 | $ hg debugobsolete | |||
|
206 | e1b46f0f979f52748347ff8729c59f2ef56e6fe2 7f6b0a6f5c25345a83870963efd827c1798a5959 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'server'} | |||
|
207 | 7f6b0a6f5c25345a83870963efd827c1798a5959 e5d7dda7cd28e6b3f79437e5b8122a38ece0255c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'client'} |
General Comments 0
You need to be logged in to leave comments.
Login now