Show More
@@ -1,57 +1,60 | |||||
1 | from __future__ import absolute_import |
|
1 | from __future__ import absolute_import | |
2 |
|
2 | |||
3 | import os |
|
3 | import os | |
4 | import sys |
|
4 | import sys | |
5 | import time |
|
5 | import time | |
6 | from mercurial import ( |
|
6 | from mercurial import ( | |
7 | commands, |
|
7 | commands, | |
8 | hg, |
|
8 | hg, | |
9 | ui as uimod, |
|
9 | ui as uimod, | |
10 | util, |
|
10 | util, | |
11 | ) |
|
11 | ) | |
12 |
|
12 | |||
13 | TESTDIR = os.environ["TESTDIR"] |
|
13 | TESTDIR = os.environ["TESTDIR"] | |
14 | BUNDLEPATH = os.path.join(TESTDIR, 'bundles', 'test-no-symlinks.hg') |
|
14 | BUNDLEPATH = os.path.join(TESTDIR, 'bundles', 'test-no-symlinks.hg') | |
15 |
|
15 | |||
16 | # only makes sense to test on os which supports symlinks |
|
16 | # only makes sense to test on os which supports symlinks | |
17 | if not getattr(os, "symlink", False): |
|
17 | if not getattr(os, "symlink", False): | |
18 | sys.exit(80) # SKIPPED_STATUS defined in run-tests.py |
|
18 | sys.exit(80) # SKIPPED_STATUS defined in run-tests.py | |
19 |
|
19 | |||
20 | u = uimod.ui.load() |
|
20 | u = uimod.ui.load() | |
21 | # hide outer repo |
|
21 | # hide outer repo | |
22 | hg.peer(u, {}, '.', create=True) |
|
22 | hg.peer(u, {}, '.', create=True) | |
23 |
|
23 | |||
24 |
# |
|
24 | # unbundle with symlink support | |
25 | hg.clone(u, {}, BUNDLEPATH, 'test0') |
|
25 | hg.peer(u, {}, 'test0', create=True) | |
26 |
|
26 | |||
27 | repo = hg.repository(u, 'test0') |
|
27 | repo = hg.repository(u, 'test0') | |
|
28 | commands.unbundle(u, repo, BUNDLEPATH, update=True) | |||
28 |
|
29 | |||
29 | # wait a bit, or the status call wont update the dirstate |
|
30 | # wait a bit, or the status call wont update the dirstate | |
30 | time.sleep(1) |
|
31 | time.sleep(1) | |
31 | commands.status(u, repo) |
|
32 | commands.status(u, repo) | |
32 |
|
33 | |||
33 | # now disable symlink support -- this is what os.symlink would do on a |
|
34 | # now disable symlink support -- this is what os.symlink would do on a | |
34 | # non-symlink file system |
|
35 | # non-symlink file system | |
35 | def symlink_failure(src, dst): |
|
36 | def symlink_failure(src, dst): | |
36 | raise OSError(1, "Operation not permitted") |
|
37 | raise OSError(1, "Operation not permitted") | |
37 | os.symlink = symlink_failure |
|
38 | os.symlink = symlink_failure | |
38 | def islink_failure(path): |
|
39 | def islink_failure(path): | |
39 | return False |
|
40 | return False | |
40 | os.path.islink = islink_failure |
|
41 | os.path.islink = islink_failure | |
41 |
|
42 | |||
42 | # dereference links as if a Samba server has exported this to a |
|
43 | # dereference links as if a Samba server has exported this to a | |
43 | # Windows client |
|
44 | # Windows client | |
44 | for f in 'test0/a.lnk', 'test0/d/b.lnk': |
|
45 | for f in 'test0/a.lnk', 'test0/d/b.lnk': | |
45 | os.unlink(f) |
|
46 | os.unlink(f) | |
46 | fp = open(f, 'wb') |
|
47 | fp = open(f, 'wb') | |
47 | fp.write(util.readfile(f[:-4])) |
|
48 | fp.write(util.readfile(f[:-4])) | |
48 | fp.close() |
|
49 | fp.close() | |
49 |
|
50 | |||
50 | # reload repository |
|
51 | # reload repository | |
51 | u = uimod.ui.load() |
|
52 | u = uimod.ui.load() | |
52 | repo = hg.repository(u, 'test0') |
|
53 | repo = hg.repository(u, 'test0') | |
53 | commands.status(u, repo) |
|
54 | commands.status(u, repo) | |
54 |
|
55 | |||
55 |
# try |
|
56 | # try unbundling a repo which contains symlinks | |
56 | u = uimod.ui.load() |
|
57 | u = uimod.ui.load() | |
57 | hg.clone(u, {}, BUNDLEPATH, 'test1') |
|
58 | ||
|
59 | repo = hg.repository(u, 'test1', create=True) | |||
|
60 | commands.unbundle(u, repo, BUNDLEPATH, update=True) |
@@ -1,16 +1,12 | |||||
1 | requesting all changes |
|
|||
2 | adding changesets |
|
1 | adding changesets | |
3 | adding manifests |
|
2 | adding manifests | |
4 | adding file changes |
|
3 | adding file changes | |
5 | added 1 changesets with 4 changes to 4 files |
|
4 | added 1 changesets with 4 changes to 4 files | |
6 | new changesets d326ae2d01ee |
|
5 | new changesets d326ae2d01ee | |
7 | updating to branch default |
|
|||
8 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
6 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
9 | requesting all changes |
|
|||
10 | adding changesets |
|
7 | adding changesets | |
11 | adding manifests |
|
8 | adding manifests | |
12 | adding file changes |
|
9 | adding file changes | |
13 | added 1 changesets with 4 changes to 4 files |
|
10 | added 1 changesets with 4 changes to 4 files | |
14 | new changesets d326ae2d01ee |
|
11 | new changesets d326ae2d01ee | |
15 | updating to branch default |
|
|||
16 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
12 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
General Comments 0
You need to be logged in to leave comments.
Login now