Show More
@@ -1,59 +1,59 | |||
|
1 | 1 | import os |
|
2 | 2 | import os.path |
|
3 | 3 | from mercurial import hg, ui |
|
4 | 4 | from mercurial.util import walkrepos, set, frozenset |
|
5 | 5 | from os import mkdir, chdir |
|
6 | 6 | from os.path import join as pjoin |
|
7 | 7 | |
|
8 | 8 | u = ui.ui() |
|
9 | 9 | sym = hasattr(os, 'symlink') and hasattr(os.path, 'samestat') |
|
10 | 10 | |
|
11 | 11 | hg.repository(u, 'top1', create=1) |
|
12 | 12 | mkdir('subdir') |
|
13 | 13 | chdir('subdir') |
|
14 | 14 | hg.repository(u, 'sub1', create=1) |
|
15 | 15 | chdir('sub1') |
|
16 | 16 | hg.repository(u, 'inside_sub1', create=1) |
|
17 | 17 | chdir('.hg') |
|
18 | 18 | hg.repository(u, 'patches', create=1) |
|
19 | 19 | chdir(os.path.pardir) |
|
20 | 20 | chdir(os.path.pardir) |
|
21 | 21 | mkdir('subsubdir') |
|
22 | 22 | chdir('subsubdir') |
|
23 | 23 | hg.repository(u, 'subsub1', create=1) |
|
24 | 24 | chdir(os.path.pardir) |
|
25 | 25 | if sym: |
|
26 | 26 | os.symlink(os.path.pardir, 'circle') |
|
27 | 27 | os.symlink(pjoin('subsubdir', 'subsub1'), 'subsub1') |
|
28 | 28 | |
|
29 | 29 | def runtest(): |
|
30 | 30 | reposet = frozenset(walkrepos('.', followsym=True)) |
|
31 | 31 | if sym and (len(reposet) != 5): |
|
32 | 32 | print "reposet = %r" % (reposet,) |
|
33 |
|
|
|
33 | print "Found %d repositories when I should have found 5" % (len(reposet),) | |
|
34 | 34 | if (not sym) and (len(reposet) != 4): |
|
35 | 35 | print "reposet = %r" % (reposet,) |
|
36 |
|
|
|
36 | print "Found %d repositories when I should have found 4" % (len(reposet),) | |
|
37 | 37 | sub1set = frozenset((pjoin('.', 'sub1'), |
|
38 | 38 | pjoin('.', 'circle', 'subdir', 'sub1'))) |
|
39 | 39 | if len(sub1set & reposet) != 1: |
|
40 | 40 | print "sub1set = %r" % (sub1set,) |
|
41 | 41 | print "reposet = %r" % (reposet,) |
|
42 |
|
|
|
42 | print "sub1set and reposet should have exactly one path in common." | |
|
43 | 43 | sub2set = frozenset((pjoin('.', 'subsub1'), |
|
44 | 44 | pjoin('.', 'subsubdir', 'subsub1'))) |
|
45 | 45 | if len(sub2set & reposet) != 1: |
|
46 | 46 | print "sub2set = %r" % (sub2set,) |
|
47 | 47 | print "reposet = %r" % (reposet,) |
|
48 |
|
|
|
48 | print "sub1set and reposet should have exactly one path in common." | |
|
49 | 49 | sub3 = pjoin('.', 'circle', 'top1') |
|
50 | 50 | if sym and not (sub3 in reposet): |
|
51 | 51 | print "reposet = %r" % (reposet,) |
|
52 |
|
|
|
52 | print "Symbolic links are supported and %s is not in reposet" % (sub3,) | |
|
53 | 53 | |
|
54 | 54 | runtest() |
|
55 | 55 | if sym: |
|
56 | 56 | # Simulate not having symlinks. |
|
57 | 57 | del os.path.samestat |
|
58 | 58 | sym = False |
|
59 | 59 | runtest() |
General Comments 0
You need to be logged in to leave comments.
Login now