##// END OF EJS Templates
tests: separate out bookmarks tests from test-share.t...
Martin von Zweigbergk -
r42504:81ece800 default
parent child Browse files
Show More
@@ -8,143 +8,23 b' prepare repo1'
8 $ echo a > a
8 $ echo a > a
9 $ hg commit -A -m'init'
9 $ hg commit -A -m'init'
10 adding a
10 adding a
11 $ echo a >> a
12 $ hg commit -m'change in shared clone'
13 $ echo b > b
14 $ hg commit -A -m'another file'
15 adding b
11
16
12 share it
17 share it
13
18
14 $ cd ..
19 $ cd ..
15 $ hg share repo1 repo2
20 $ hg share repo1 repo2
16 updating working directory
21 updating working directory
17 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
22 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
18
23
19 share shouldn't have a store dir
24 unshare it
20
25
21 $ cd repo2
26 $ cd repo2
22 $ test -d .hg/store
23 [1]
24
25 share shouldn't have a full cache dir, original repo should
26
27 $ hg branches
28 default 0:d3873e73d99e
29 $ hg tags
30 tip 0:d3873e73d99e
31 $ test -d .hg/cache
32 [1]
33 $ ls -1 .hg/wcache || true
34 checkisexec (execbit !)
35 checklink (symlink !)
36 checklink-target (symlink !)
37 manifestfulltextcache (reporevlogstore !)
38 $ ls -1 ../repo1/.hg/cache
39 branch2-served
40 rbc-names-v1
41 rbc-revs-v1
42 tags2-visible
43
44 Some sed versions appends newline, some don't, and some just fails
45
46 $ cat .hg/sharedpath; echo
47 $TESTTMP/repo1/.hg
48
49 trailing newline on .hg/sharedpath is ok
50 $ hg tip -q
51 0:d3873e73d99e
52 $ echo '' >> .hg/sharedpath
53 $ cat .hg/sharedpath
54 $TESTTMP/repo1/.hg
55 $ hg tip -q
56 0:d3873e73d99e
57
58 commit in shared clone
59
60 $ echo a >> a
61 $ hg commit -m'change in shared clone'
62
63 check original
64
65 $ cd ../repo1
66 $ hg log
67 changeset: 1:8af4dc49db9e
68 tag: tip
69 user: test
70 date: Thu Jan 01 00:00:00 1970 +0000
71 summary: change in shared clone
72
73 changeset: 0:d3873e73d99e
74 user: test
75 date: Thu Jan 01 00:00:00 1970 +0000
76 summary: init
77
78 $ hg update
79 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 $ cat a # should be two lines of "a"
81 a
82 a
83
84 commit in original
85
86 $ echo b > b
87 $ hg commit -A -m'another file'
88 adding b
89
90 check in shared clone
91
92 $ cd ../repo2
93 $ hg log
94 changeset: 2:c2e0ac586386
95 tag: tip
96 user: test
97 date: Thu Jan 01 00:00:00 1970 +0000
98 summary: another file
99
100 changeset: 1:8af4dc49db9e
101 user: test
102 date: Thu Jan 01 00:00:00 1970 +0000
103 summary: change in shared clone
104
105 changeset: 0:d3873e73d99e
106 user: test
107 date: Thu Jan 01 00:00:00 1970 +0000
108 summary: init
109
110 $ hg update
111 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
112 $ cat b # should exist with one "b"
113 b
114
115 hg serve shared clone
116
117 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid
118 $ cat hg.pid >> $DAEMON_PIDS
119 $ get-with-headers.py localhost:$HGPORT 'raw-file/'
120 200 Script output follows
121
122
123 -rw-r--r-- 4 a
124 -rw-r--r-- 2 b
125
126
127 Cloning a shared repo via bundle2 results in a non-shared clone
128
129 $ cd ..
130 $ hg clone -q --stream --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/`pwd`/repo2 cloned-via-bundle2
131 $ cat ./cloned-via-bundle2/.hg/requires | grep "shared"
132 [1]
133 $ hg id --cwd cloned-via-bundle2 -r tip
134 c2e0ac586386 tip
135 $ cd repo2
136
137 test unshare command
138
139 $ hg unshare
27 $ hg unshare
140 $ test -d .hg/store
141 $ test -f .hg/sharedpath
142 [1]
143 $ grep shared .hg/requires
144 [1]
145 $ hg unshare
146 abort: this is not a shared repo
147 [255]
148
28
149 check that a change does not propagate
29 check that a change does not propagate
150
30
@@ -156,7 +36,6 b' check that a change does not propagate'
156
36
157 $ cd ..
37 $ cd ..
158
38
159
160 test sharing bookmarks
39 test sharing bookmarks
161
40
162 $ hg share -B repo1 repo3
41 $ hg share -B repo1 repo3
@@ -266,16 +145,6 b' test that commits work'
266 bm3 4:62f4ded848e4
145 bm3 4:62f4ded848e4
267 $ cd ..
146 $ cd ..
268
147
269 non largefiles repos won't enable largefiles
270
271 $ hg share --config extensions.largefiles= repo3 sharedrepo
272 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
273 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
274 updating working directory
275 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
276 $ [ -f sharedrepo/.hg/hgrc ]
277 [1]
278
279 test pushing bookmarks works
148 test pushing bookmarks works
280
149
281 $ hg clone repo3 repo4
150 $ hg clone repo3 repo4
@@ -401,81 +270,3 b' verify bookmark behavior after unshare'
401 bm3 4:62f4ded848e4
270 bm3 4:62f4ded848e4
402 bm4 5:92793bfc8cad
271 bm4 5:92793bfc8cad
403 $ cd ..
272 $ cd ..
404
405 test shared clones using relative paths work
406
407 $ mkdir thisdir
408 $ hg init thisdir/orig
409 $ hg share -U thisdir/orig thisdir/abs
410 $ hg share -U --relative thisdir/abs thisdir/rel
411 $ cat thisdir/rel/.hg/sharedpath
412 ../../orig/.hg (no-eol)
413 $ grep shared thisdir/*/.hg/requires
414 thisdir/abs/.hg/requires:shared
415 thisdir/rel/.hg/requires:relshared
416 thisdir/rel/.hg/requires:shared
417
418 test that relative shared paths aren't relative to $PWD
419
420 $ cd thisdir
421 $ hg -R rel root
422 $TESTTMP/thisdir/rel
423 $ cd ..
424
425 now test that relative paths really are relative, survive across
426 renames and changes of PWD
427
428 $ hg -R thisdir/abs root
429 $TESTTMP/thisdir/abs
430 $ hg -R thisdir/rel root
431 $TESTTMP/thisdir/rel
432 $ mv thisdir thatdir
433 $ hg -R thatdir/abs root
434 abort: .hg/sharedpath points to nonexistent directory $TESTTMP/thisdir/orig/.hg!
435 [255]
436 $ hg -R thatdir/rel root
437 $TESTTMP/thatdir/rel
438
439 test unshare relshared repo
440
441 $ cd thatdir/rel
442 $ hg unshare
443 $ test -d .hg/store
444 $ test -f .hg/sharedpath
445 [1]
446 $ grep shared .hg/requires
447 [1]
448 $ hg unshare
449 abort: this is not a shared repo
450 [255]
451 $ cd ../..
452
453 $ rm -r thatdir
454
455 Demonstrate buggy behavior around requirements validation
456 See comment in localrepo.py:makelocalrepository() for more.
457
458 $ hg init sharenewrequires
459 $ hg share sharenewrequires shareoldrequires
460 updating working directory
461 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
462
463 $ cat >> sharenewrequires/.hg/requires << EOF
464 > missing-requirement
465 > EOF
466
467 We cannot open the repo with the unknown requirement
468
469 $ hg -R sharenewrequires status
470 abort: repository requires features unknown to this Mercurial: missing-requirement!
471 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
472 [255]
473
474 BUG: we don't get the same error when opening the shared repo pointing to it
475
476 $ hg -R shareoldrequires status
477
478 Explicitly kill daemons to let the test exit on Windows
479
480 $ killdaemons.py
481
@@ -157,118 +157,9 b' check that a change does not propagate'
157 $ cd ..
157 $ cd ..
158
158
159
159
160 test sharing bookmarks
161
162 $ hg share -B repo1 repo3
163 updating working directory
164 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
165 $ cd repo1
166 $ hg bookmark bm1
167 $ hg bookmarks
168 * bm1 2:c2e0ac586386
169 $ cd ../repo2
170 $ hg book bm2
171 $ hg bookmarks
172 * bm2 3:0e6e70d1d5f1
173 $ cd ../repo3
174 $ hg bookmarks
175 bm1 2:c2e0ac586386
176 $ hg book bm3
177 $ hg bookmarks
178 bm1 2:c2e0ac586386
179 * bm3 2:c2e0ac586386
180 $ cd ../repo1
181 $ hg bookmarks
182 * bm1 2:c2e0ac586386
183 bm3 2:c2e0ac586386
184
185 check whether HG_PENDING makes pending changes only in relatd
186 repositories visible to an external hook.
187
188 In "hg share" case, another transaction can't run in other
189 repositories sharing same source repository, because starting
190 transaction requires locking store of source repository.
191
192 Therefore, this test scenario ignores checking visibility of
193 .hg/bookmakrs.pending in repo2, which shares repo1 without bookmarks.
194
195 $ cat > $TESTTMP/checkbookmarks.sh <<EOF
196 > echo "@repo1"
197 > hg -R "$TESTTMP/repo1" bookmarks
198 > echo "@repo2"
199 > hg -R "$TESTTMP/repo2" bookmarks
200 > echo "@repo3"
201 > hg -R "$TESTTMP/repo3" bookmarks
202 > exit 1 # to avoid adding new bookmark for subsequent tests
203 > EOF
204
205 $ cd ../repo1
206 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkbookmarks.sh" -q book bmX
207 @repo1
208 bm1 2:c2e0ac586386
209 bm3 2:c2e0ac586386
210 * bmX 2:c2e0ac586386
211 @repo2
212 * bm2 3:0e6e70d1d5f1
213 @repo3
214 bm1 2:c2e0ac586386
215 * bm3 2:c2e0ac586386
216 bmX 2:c2e0ac586386
217 transaction abort!
218 rollback completed
219 abort: pretxnclose hook exited with status 1
220 [255]
221 $ hg book bm1
222
223 FYI, in contrast to above test, bmX is invisible in repo1 (= shared
224 src), because (1) HG_PENDING refers only repo3 and (2)
225 "bookmarks.pending" is written only into repo3.
226
227 $ cd ../repo3
228 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkbookmarks.sh" -q book bmX
229 @repo1
230 * bm1 2:c2e0ac586386
231 bm3 2:c2e0ac586386
232 @repo2
233 * bm2 3:0e6e70d1d5f1
234 @repo3
235 bm1 2:c2e0ac586386
236 bm3 2:c2e0ac586386
237 * bmX 2:c2e0ac586386
238 transaction abort!
239 rollback completed
240 abort: pretxnclose hook exited with status 1
241 [255]
242 $ hg book bm3
243
244 $ cd ../repo1
245
246 test that commits work
247
248 $ echo 'shared bookmarks' > a
249 $ hg commit -m 'testing shared bookmarks'
250 $ hg bookmarks
251 * bm1 3:b87954705719
252 bm3 2:c2e0ac586386
253 $ cd ../repo3
254 $ hg bookmarks
255 bm1 3:b87954705719
256 * bm3 2:c2e0ac586386
257 $ echo 'more shared bookmarks' > a
258 $ hg commit -m 'testing shared bookmarks'
259 created new head
260 $ hg bookmarks
261 bm1 3:b87954705719
262 * bm3 4:62f4ded848e4
263 $ cd ../repo1
264 $ hg bookmarks
265 * bm1 3:b87954705719
266 bm3 4:62f4ded848e4
267 $ cd ..
268
269 non largefiles repos won't enable largefiles
160 non largefiles repos won't enable largefiles
270
161
271 $ hg share --config extensions.largefiles= repo3 sharedrepo
162 $ hg share --config extensions.largefiles= repo2 sharedrepo
272 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
163 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
273 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
164 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
274 updating working directory
165 updating working directory
@@ -276,132 +167,6 b" non largefiles repos won't enable largef"
276 $ [ -f sharedrepo/.hg/hgrc ]
167 $ [ -f sharedrepo/.hg/hgrc ]
277 [1]
168 [1]
278
169
279 test pushing bookmarks works
280
281 $ hg clone repo3 repo4
282 updating to branch default
283 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
284 $ cd repo4
285 $ hg boo bm4
286 $ echo foo > b
287 $ hg commit -m 'foo in b'
288 $ hg boo
289 bm1 3:b87954705719
290 bm3 4:62f4ded848e4
291 * bm4 5:92793bfc8cad
292 $ hg push -B bm4
293 pushing to $TESTTMP/repo3
294 searching for changes
295 adding changesets
296 adding manifests
297 adding file changes
298 added 1 changesets with 1 changes to 1 files
299 exporting bookmark bm4
300 $ cd ../repo1
301 $ hg bookmarks
302 * bm1 3:b87954705719
303 bm3 4:62f4ded848e4
304 bm4 5:92793bfc8cad
305 $ cd ../repo3
306 $ hg bookmarks
307 bm1 3:b87954705719
308 * bm3 4:62f4ded848e4
309 bm4 5:92793bfc8cad
310 $ cd ..
311
312 test behavior when sharing a shared repo
313
314 $ hg share -B repo3 missingdir/repo5
315 updating working directory
316 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
317 $ cd missingdir/repo5
318 $ hg book
319 bm1 3:b87954705719
320 bm3 4:62f4ded848e4
321 bm4 5:92793bfc8cad
322 $ cd ../..
323
324 test what happens when an active bookmark is deleted
325
326 $ cd repo1
327 $ hg boo -d bm3
328 $ hg boo
329 * bm1 3:b87954705719
330 bm4 5:92793bfc8cad
331 $ cd ../repo3
332 $ hg boo
333 bm1 3:b87954705719
334 bm4 5:92793bfc8cad
335 $ cd ..
336
337 verify that bookmarks are not written on failed transaction
338
339 $ cat > failpullbookmarks.py << EOF
340 > """A small extension that makes bookmark pulls fail, for testing"""
341 > from __future__ import absolute_import
342 > from mercurial import (
343 > error,
344 > exchange,
345 > extensions,
346 > )
347 > def _pullbookmarks(orig, pullop):
348 > orig(pullop)
349 > raise error.HookAbort('forced failure by extension')
350 > def extsetup(ui):
351 > extensions.wrapfunction(exchange, '_pullbookmarks', _pullbookmarks)
352 > EOF
353 $ cd repo4
354 $ hg boo
355 bm1 3:b87954705719
356 bm3 4:62f4ded848e4
357 * bm4 5:92793bfc8cad
358 $ cd ../repo3
359 $ hg boo
360 bm1 3:b87954705719
361 bm4 5:92793bfc8cad
362 $ hg --config "extensions.failpullbookmarks=$TESTTMP/failpullbookmarks.py" pull $TESTTMP/repo4
363 pulling from $TESTTMP/repo4
364 searching for changes
365 no changes found
366 adding remote bookmark bm3
367 abort: forced failure by extension
368 [255]
369 $ hg boo
370 bm1 3:b87954705719
371 bm4 5:92793bfc8cad
372 $ hg pull $TESTTMP/repo4
373 pulling from $TESTTMP/repo4
374 searching for changes
375 no changes found
376 adding remote bookmark bm3
377 1 local changesets published
378 $ hg boo
379 bm1 3:b87954705719
380 * bm3 4:62f4ded848e4
381 bm4 5:92793bfc8cad
382 $ cd ..
383
384 verify bookmark behavior after unshare
385
386 $ cd repo3
387 $ hg unshare
388 $ hg boo
389 bm1 3:b87954705719
390 * bm3 4:62f4ded848e4
391 bm4 5:92793bfc8cad
392 $ hg boo -d bm4
393 $ hg boo bm5
394 $ hg boo
395 bm1 3:b87954705719
396 bm3 4:62f4ded848e4
397 * bm5 4:62f4ded848e4
398 $ cd ../repo1
399 $ hg boo
400 * bm1 3:b87954705719
401 bm3 4:62f4ded848e4
402 bm4 5:92793bfc8cad
403 $ cd ..
404
405 test shared clones using relative paths work
170 test shared clones using relative paths work
406
171
407 $ mkdir thisdir
172 $ mkdir thisdir
General Comments 0
You need to be logged in to leave comments. Login now