31 recurse = {'*': False, '**': True}[roottail] |
31 recurse = {'*': False, '**': True}[roottail] |
32 except KeyError: |
32 except KeyError: |
33 repos.append((prefix, root)) |
33 repos.append((prefix, root)) |
34 continue |
34 continue |
35 roothead = os.path.normpath(os.path.abspath(roothead)) |
35 roothead = os.path.normpath(os.path.abspath(roothead)) |
36 for path in util.walkrepos(roothead, followsym=True, recurse=recurse): |
36 paths = util.walkrepos(roothead, followsym=True, recurse=recurse) |
37 path = os.path.normpath(path) |
37 repos.extend(urlrepos(prefix, roothead, paths)) |
38 name = util.pconvert(path[len(roothead):]).strip('/') |
|
39 if prefix: |
|
40 name = prefix + '/' + name |
|
41 repos.append((name, path)) |
|
42 return repos |
38 return repos |
|
39 |
|
40 def urlrepos(prefix, roothead, paths): |
|
41 """yield url paths and filesystem paths from a list of repo paths |
|
42 |
|
43 >>> list(urlrepos('hg', '/opt', ['/opt/r', '/opt/r/r', '/opt'])) |
|
44 [('hg/r', '/opt/r'), ('hg/r/r', '/opt/r/r'), ('hg/', '/opt')] |
|
45 >>> list(urlrepos('', '/opt', ['/opt/r', '/opt/r/r', '/opt'])) |
|
46 [('r', '/opt/r'), ('r/r', '/opt/r/r'), ('', '/opt')] |
|
47 """ |
|
48 for path in paths: |
|
49 path = os.path.normpath(path) |
|
50 name = util.pconvert(path[len(roothead):]).strip('/') |
|
51 if prefix: |
|
52 name = prefix + '/' + name |
|
53 yield name, path |
43 |
54 |
44 class hgwebdir(object): |
55 class hgwebdir(object): |
45 refreshinterval = 20 |
56 refreshinterval = 20 |
46 |
57 |
47 def __init__(self, conf, baseui=None): |
58 def __init__(self, conf, baseui=None): |