comparison tests/test-share.t @ 31133:23080c03a604

share: add --relative flag to store a relative path to the source Storing a relative path the source repository is useful when exporting repositories over the network or when they're located on external drives where the mountpoint isn't always fixed. Currently, Mercurial interprets paths in `.hg/shared` relative to $PWD. I suspect this is very much unintentional, and you have to manually edit `.hg/shared` in order to trigger this behaviour. However, on the off chance that someone might rely on it, I added a new capability called 'relshared'. In addition, this makes earlier versions of Mercurial fail with a graceful error. I should note that I haven't tested this patch on Windows.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Mon, 13 Feb 2017 14:05:24 +0100
parents 0332b8fafd05
children ecbd378d9a7e
comparison
equal deleted inserted replaced
31132:bbdd712e9adb 31133:23080c03a604
356 * bm1 3:b87954705719 356 * bm1 3:b87954705719
357 bm3 4:62f4ded848e4 357 bm3 4:62f4ded848e4
358 bm4 5:92793bfc8cad 358 bm4 5:92793bfc8cad
359 $ cd .. 359 $ cd ..
360 360
361 test shared clones using relative paths work
362
363 $ mkdir thisdir
364 $ hg init thisdir/orig
365 $ hg share -U thisdir/orig thisdir/abs
366 $ hg share -U --relative thisdir/abs thisdir/rel
367 $ cat thisdir/rel/.hg/sharedpath
368 ../../orig/.hg (no-eol)
369 $ grep shared thisdir/*/.hg/requires
370 thisdir/abs/.hg/requires:shared
371 thisdir/rel/.hg/requires:shared
372 thisdir/rel/.hg/requires:relshared
373
374 test that relative shared paths aren't relative to $PWD
375
376 $ cd thisdir
377 $ hg -R rel root
378 $TESTTMP/thisdir/rel
379 $ cd ..
380
381 now test that relative paths really are relative, survive across
382 renames and changes of PWD
383
384 $ hg -R thisdir/abs root
385 $TESTTMP/thisdir/abs
386 $ hg -R thisdir/rel root
387 $TESTTMP/thisdir/rel
388 $ mv thisdir thatdir
389 $ hg -R thatdir/abs root
390 abort: .hg/sharedpath points to nonexistent directory $TESTTMP/thisdir/orig/.hg!
391 [255]
392 $ hg -R thatdir/rel root
393 $TESTTMP/thatdir/rel
394 $ rm -r thatdir
395
361 Explicitly kill daemons to let the test exit on Windows 396 Explicitly kill daemons to let the test exit on Windows
362 397
363 $ killdaemons.py 398 $ killdaemons.py
364 399