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