comparison tests/groups-legacy.t @ 40:1c22cd2904eb

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