Mercurial > hg-allpaths
comparison tests/groups-modern.t @ 46:e695060c716e
Tests for intended future behaviour of alternative groups and prioritizations
author | Marcin Kasperski <Marcin.Kasperski@mekk.waw.pl> |
---|---|
date | Sun, 25 Sep 2016 09:44:23 +0200 |
parents | cf3fe04cd96b |
children | 00995da9c204 |
comparison
equal
deleted
inserted
replaced
45:237dd8c4fe78 | 46:e695060c716e |
---|---|
1 | 1 |
2 TODO: testing newer group syntax | 2 Let's test group paths, configured with modern syntax. |
3 | |
4 Some locations used during testing: | |
5 | |
6 $ WORK_DIR=${WORK_DIR-`pwd`/work} | |
7 $ rm -rf $WORK_DIR | |
8 | |
9 $ export BASE=$WORK_DIR/base | |
10 $ export REP1=$WORK_DIR/rep1 | |
11 $ export REP2=$WORK_DIR/rep2 | |
12 $ export REP3=$WORK_DIR/rep3 | |
13 $ export REP4=$WORK_DIR/rep4 | |
14 | |
15 First we need appropriate Mercurial configuration file (and variable | |
16 which ensures it is used). | |
17 | |
18 $ export HGRCPATH=$WORK_DIR/hgrc | |
19 $ mkdir -p $HGRCPATH | |
20 | |
21 $ cat > $HGRCPATH/basic.rc << EOF | |
22 > [ui] | |
23 > username = Andy Default <default@nowhere.net> | |
24 > [extensions] | |
25 > mercurial_all_paths = | |
26 > [all_paths] | |
27 > group.odd = remote1 remote3 | |
28 > group.even = remote2 remote4 | |
29 > EOF | |
30 | |
31 We need some repositories to test. | |
32 | |
33 $ hg init "$BASE" | |
34 $ hg init "$REP1" | |
35 $ hg init "$REP2" | |
36 $ hg init "$REP3" | |
37 $ hg init "$REP4" | |
38 | |
39 and configuration of groups: | |
40 | |
41 $ cat > $BASE/.hg/hgrc << EOF | |
42 > [paths] | |
43 > remote1=$REP1 | |
44 > remote2=$REP2 | |
45 > remote3=$REP3 | |
46 > remote4=$REP4 | |
47 > EOF | |
48 | |
49 Let's test pushing | |
50 | |
51 $ cat > $BASE/file.txt << EOF | |
52 > Some text | |
53 > EOF | |
54 | |
55 $ hg --cwd $BASE add | |
56 adding file.txt | |
57 $ hg --cwd $BASE commit -m 'First' | |
58 | |
59 $ hg --cwd $BASE pushall -g odd | |
60 pushing to */rep1 (glob) | |
61 searching for changes | |
62 adding changesets | |
63 adding manifests | |
64 adding file changes | |
65 added 1 changesets with 1 changes to 1 files | |
66 | |
67 pushing to */rep3 (glob) | |
68 searching for changes | |
69 adding changesets | |
70 adding manifests | |
71 adding file changes | |
72 added 1 changesets with 1 changes to 1 files | |
73 | |
74 $ hg --cwd $REP1 log -T '{rev}: {desc}\n' | |
75 0: First | |
76 | |
77 $ hg --cwd $REP2 log -T '{rev}: {desc}\n' | |
78 | |
79 $ hg --cwd $REP3 log -T '{rev}: {desc}\n' | |
80 0: First | |
81 | |
82 $ hg --cwd $REP4 log -T '{rev}: {desc}\n' | |
83 | |
84 | |
85 $ cat >> $BASE/file.txt << EOF | |
86 > More text | |
87 > EOF | |
88 | |
89 $ hg --cwd $BASE commit -m 'Second' | |
90 | |
91 | |
92 $ hg --cwd $BASE pushall --group even | |
93 pushing to */rep2 (glob) | |
94 searching for changes | |
95 adding changesets | |
96 adding manifests | |
97 adding file changes | |
98 added 2 changesets with 2 changes to 1 files | |
99 | |
100 pushing to */rep4 (glob) | |
101 searching for changes | |
102 adding changesets | |
103 adding manifests | |
104 adding file changes | |
105 added 2 changesets with 2 changes to 1 files | |
106 | |
107 $ hg --cwd $REP1 log -T '{rev}: {desc}\n' | |
108 0: First | |
109 | |
110 $ hg --cwd $REP2 log -T '{rev}: {desc}\n' | |
111 1: Second | |
112 0: First | |
113 | |
114 $ hg --cwd $REP3 log -T '{rev}: {desc}\n' | |
115 0: First | |
116 | |
117 $ hg --cwd $REP4 log -T '{rev}: {desc}\n' | |
118 1: Second | |
119 0: First | |
120 | |
121 | |
122 Let's also test pulling | |
123 | |
124 $ hg --cwd $REP1 update | |
125 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
126 | |
127 $ cat > $REP1/rep1.txt << EOF | |
128 > Another text | |
129 > EOF | |
130 | |
131 $ hg --cwd $REP1 add | |
132 adding rep1.txt | |
133 $ hg --cwd $REP1 commit -m "In repo1" | |
134 | |
135 | |
136 $ hg --cwd $REP2 update | |
137 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
138 | |
139 $ cat >> $REP2/file.txt << EOF | |
140 > From repo2… | |
141 > EOF | |
142 | |
143 $ hg --cwd $REP2 commit -m "In repo2" | |
144 | |
145 $ hg --cwd $BASE incomingall --group odd | |
146 comparing with */rep1 (glob) | |
147 searching for changes | |
148 changeset: 1:* (glob) | |
149 tag: tip | |
150 user: Andy Default <default@nowhere.net> | |
151 date: .* (re) | |
152 summary: In repo1 | |
153 | |
154 comparing with */rep3 (glob) | |
155 searching for changes | |
156 no changes found | |
157 | |
158 $ hg --cwd $BASE incomingall --group even | |
159 comparing with */rep2 (glob) | |
160 searching for changes | |
161 changeset: 2:.* (re) | |
162 tag: tip | |
163 user: Andy Default <default@nowhere.net> | |
164 date: .* (re) | |
165 summary: In repo2 | |
166 | |
167 comparing with */rep4 (glob) | |
168 searching for changes | |
169 no changes found | |
170 | |
171 $ hg --cwd $BASE pullall -g odd | |
172 pulling from */rep1 (glob) | |
173 searching for changes | |
174 adding changesets | |
175 adding manifests | |
176 adding file changes | |
177 added 1 changesets with 1 changes to 1 files (+1 heads) | |
178 (run 'hg heads' to see heads, 'hg merge' to merge) | |
179 | |
180 pulling from */rep3 (glob) | |
181 searching for changes | |
182 no changes found | |
183 | |
184 $ hg --cwd $BASE log -T '{rev}: {desc}\n' | |
185 2: In repo1 | |
186 1: Second | |
187 0: First | |
188 | |
189 $ hg --cwd $BASE outgoingall --group odd | |
190 comparing with */rep1 (glob) | |
191 searching for changes | |
192 changeset: 1:* (glob) | |
193 user: Andy Default <default@nowhere.net> | |
194 date: .* (re) | |
195 summary: Second | |
196 | |
197 comparing with */rep3 (glob) | |
198 searching for changes | |
199 changeset: 1:* (glob) | |
200 user: Andy Default <default@nowhere.net> | |
201 date: .* (re) | |
202 summary: Second | |
203 | |
204 changeset: 2:* (glob) | |
205 tag: tip | |
206 parent: 0:* (glob) | |
207 user: Andy Default <default@nowhere.net> | |
208 date: .* (re) | |
209 summary: In repo1 | |
210 | |
211 | |
212 $ hg --cwd $BASE outgoingall --group even | |
213 comparing with */rep2 (glob) | |
214 searching for changes | |
215 changeset: 2:* (glob) | |
216 tag: tip | |
217 parent: 0:* (glob) | |
218 user: Andy Default <default@nowhere.net> | |
219 date: .* (re) | |
220 summary: In repo1 | |
221 | |
222 comparing with */rep4 (glob) | |
223 searching for changes | |
224 changeset: 2:* (glob) | |
225 tag: tip | |
226 parent: 0:* (glob) | |
227 user: Andy Default <default@nowhere.net> | |
228 date: .* (re) | |
229 summary: In repo1 | |
230 | |
231 | |
232 Wrong groups do not work | |
233 | |
234 $ hg --cwd $BASE pullall -g unknown | |
235 abort: No paths defined in section unknown | |
236 [255] | |
237 | |
238 $ hg --cwd $BASE incomingall --group unknown | |
239 abort: No paths defined in section unknown | |
240 [255] | |
241 | |
242 $ hg --cwd $BASE outgoingall --group unknown | |
243 abort: No paths defined in section unknown | |
244 [255] | |
245 | |
246 $ hg --cwd $BASE pushall -g unknown | |
247 abort: No paths defined in section unknown | |
248 [255] | |
249 | |
250 But global access works | |
251 | |
252 $ hg --cwd $BASE pushall | |
253 HMM | |
254 | |
255 $ hg --cwd $BASE pullall | |
256 HMM | |
257 | |
258 Finally let's test that push options work | |
259 | |
260 $ cat > $BASE/br1.txt << EOF | |
261 > Br1 text | |
262 > EOF | |
263 | |
264 $ hg --cwd $BASE branch br1 | |
265 marked working directory as branch br1 | |
266 (branches are permanent and global, did you want a bookmark?) | |
267 $ hg --cwd $BASE add | |
268 adding br1.txt | |
269 $ hg --cwd $BASE commit -m 'Br1' | |
270 | |
271 $ hg --cwd $BASE update default | |
272 2 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
273 $ cat >> $BASE/file.txt << EOF | |
274 > later text | |
275 > EOF | |
276 $ hg --cwd $BASE commit -m 'Normal' | |
277 | |
278 $ hg --cwd $BASE pushall -r default -f -g odd | |
279 pushing to */rep1 (glob) | |
280 searching for changes | |
281 adding changesets | |
282 adding manifests | |
283 adding file changes | |
284 added 1 changesets with 1 changes to 1 files | |
285 | |
286 pushing to */rep3 (glob) | |
287 searching for changes | |
288 adding changesets | |
289 adding manifests | |
290 adding file changes | |
291 added 2 changesets with 2 changes to 2 files | |
292 | |
293 $ hg --cwd $BASE log -T '{rev}: {desc}\n' | |
294 4: Normal | |
295 3: Br1 | |
296 2: In repo1 | |
297 1: Second | |
298 0: First | |
299 | |
300 $ hg --cwd $REP1 log -T '{rev}: {desc}\n' | |
301 2: Normal | |
302 1: In repo1 | |
303 0: First | |
304 | |
305 $ hg --cwd $REP2 log -T '{rev}: {desc}\n' | |
306 2: In repo2 | |
307 1: Second | |
308 0: First | |
309 | |
310 $ hg --cwd $REP3 log -T '{rev}: {desc}\n' | |
311 2: Normal | |
312 1: In repo1 | |
313 0: First | |
314 | |
315 . |