Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/hgwebdir_mod.py @ 9723:a235644a0b93
hgweb: use a tuple-list instead of dictionary for append-only store
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Thu, 05 Nov 2009 15:01:00 +0100 |
parents | 8635b33eaade |
children | 40ef3bf3e04a |
comparison
equal
deleted
inserted
replaced
9722:4d9dea174b84 | 9723:a235644a0b93 |
---|---|
18 | 18 |
19 def cleannames(items): | 19 def cleannames(items): |
20 return [(util.pconvert(name).strip('/'), path) for name, path in items] | 20 return [(util.pconvert(name).strip('/'), path) for name, path in items] |
21 | 21 |
22 def findrepos(paths): | 22 def findrepos(paths): |
23 repos = {} | 23 repos = [] |
24 for prefix, root in cleannames(paths): | 24 for prefix, root in cleannames(paths): |
25 roothead, roottail = os.path.split(root) | 25 roothead, roottail = os.path.split(root) |
26 # "foo = /bar/*" makes every subrepo of /bar/ to be | 26 # "foo = /bar/*" makes every subrepo of /bar/ to be |
27 # mounted as foo/subrepo | 27 # mounted as foo/subrepo |
28 # and "foo = /bar/**" also recurses into the subdirectories, | 28 # and "foo = /bar/**" also recurses into the subdirectories, |
29 # remember to use it without working dir. | 29 # remember to use it without working dir. |
30 try: | 30 try: |
31 recurse = {'*': False, '**': True}[roottail] | 31 recurse = {'*': False, '**': True}[roottail] |
32 except KeyError: | 32 except KeyError: |
33 repos[prefix] = root | 33 repos.append((prefix, root)) |
34 continue | 34 continue |
35 roothead = os.path.normpath(roothead) | 35 roothead = os.path.normpath(roothead) |
36 for path in util.walkrepos(roothead, followsym=True, recurse=recurse): | 36 for path in util.walkrepos(roothead, followsym=True, recurse=recurse): |
37 path = os.path.normpath(path) | 37 path = os.path.normpath(path) |
38 name = util.pconvert(path[len(roothead):]).strip('/') | 38 name = util.pconvert(path[len(roothead):]).strip('/') |
39 if prefix: | 39 if prefix: |
40 name = prefix + '/' + name | 40 name = prefix + '/' + name |
41 repos[name] = path | 41 repos.append((name, path)) |
42 return repos.items() | 42 return repos |
43 | 43 |
44 class hgwebdir(object): | 44 class hgwebdir(object): |
45 refreshinterval = 20 | 45 refreshinterval = 20 |
46 | 46 |
47 def __init__(self, conf, baseui=None): | 47 def __init__(self, conf, baseui=None): |