Mercurial > hg
comparison tests/test-share.t @ 42313:81ece800576a
tests: separate out bookmarks tests from test-share.t
Differential Revision: https://phab.mercurial-scm.org/D6384
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 15 May 2019 11:38:45 -0700 |
parents | e4ac7e63c213 |
children | 69883775b27d |
comparison
equal
deleted
inserted
replaced
42312:2b77183ac477 | 42313:81ece800576a |
---|---|
155 c2e0ac586386 tip | 155 c2e0ac586386 tip |
156 | 156 |
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 |
275 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | 166 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
276 $ [ -f sharedrepo/.hg/hgrc ] | 167 $ [ -f sharedrepo/.hg/hgrc ] |
277 [1] | 168 [1] |
278 | |
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 | 169 |
405 test shared clones using relative paths work | 170 test shared clones using relative paths work |
406 | 171 |
407 $ mkdir thisdir | 172 $ mkdir thisdir |
408 $ hg init thisdir/orig | 173 $ hg init thisdir/orig |