| 1 |
#require symlink |
| 2 |
|
| 3 |
Create extension that can disable symlink support: |
| 4 |
|
| 5 |
$ cat > nolink.py <<EOF |
| 6 |
> from mercurial import extensions, merge, util |
| 7 |
> def setflags(orig, f, l, x): |
| 8 |
> pass |
| 9 |
> def checklink(orig, path): |
| 10 |
> return False |
| 11 |
> def extsetup(ui): |
| 12 |
> merge.MAYBE_USE_RUST_UPDATE = False |
| 13 |
> extensions.wrapfunction(util, 'setflags', setflags) |
| 14 |
> extensions.wrapfunction(util, 'checklink', checklink) |
| 15 |
> EOF |
| 16 |
|
| 17 |
$ hg init unix-repo |
| 18 |
$ cd unix-repo |
| 19 |
$ echo foo > a |
| 20 |
$ ln -s a b |
| 21 |
$ hg ci -Am0 |
| 22 |
adding a |
| 23 |
adding b |
| 24 |
$ cd .. |
| 25 |
|
| 26 |
Simulate a checkout shared on NFS/Samba: |
| 27 |
|
| 28 |
$ hg clone -q unix-repo shared |
| 29 |
$ cd shared |
| 30 |
$ rm b |
| 31 |
$ echo foo > b |
| 32 |
$ hg --config extensions.n=$TESTTMP/nolink.py status --debug |
| 33 |
ignoring suspect symlink placeholder "b" |
| 34 |
|
| 35 |
Make a clone using placeholders: |
| 36 |
|
| 37 |
$ hg --config extensions.n=$TESTTMP/nolink.py clone . ../win-repo |
| 38 |
updating to branch default |
| 39 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 40 |
$ cd ../win-repo |
| 41 |
$ cat b |
| 42 |
a (no-eol) |
| 43 |
$ hg --config extensions.n=$TESTTMP/nolink.py st --debug |
| 44 |
|
| 45 |
Empty placeholder: |
| 46 |
|
| 47 |
$ rm b |
| 48 |
$ touch b |
| 49 |
$ hg --config extensions.n=$TESTTMP/nolink.py st --debug |
| 50 |
ignoring suspect symlink placeholder "b" |
| 51 |
|
| 52 |
Write binary data to the placeholder: |
| 53 |
|
| 54 |
>>> open('b', 'w').write('this is a binary\0') and None |
| 55 |
$ hg --config extensions.n=$TESTTMP/nolink.py st --debug |
| 56 |
ignoring suspect symlink placeholder "b" |
| 57 |
|
| 58 |
Write a long string to the placeholder: |
| 59 |
|
| 60 |
>>> open('b', 'w').write('this' * 1000) and None |
| 61 |
$ hg --config extensions.n=$TESTTMP/nolink.py st --debug |
| 62 |
ignoring suspect symlink placeholder "b" |
| 63 |
|
| 64 |
Commit shouldn't succeed: |
| 65 |
|
| 66 |
$ hg --config extensions.n=$TESTTMP/nolink.py ci -m1 |
| 67 |
nothing changed |
| 68 |
[1] |
| 69 |
|
| 70 |
Write a valid string to the placeholder: |
| 71 |
|
| 72 |
>>> open('b', 'w').write('this') and None |
| 73 |
$ hg --config extensions.n=$TESTTMP/nolink.py st --debug |
| 74 |
M b |
| 75 |
$ hg --config extensions.n=$TESTTMP/nolink.py ci -m1 |
| 76 |
$ hg manifest tip --verbose |
| 77 |
644 a |
| 78 |
644 @ b |
| 79 |
|
| 80 |
$ cd .. |