Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/hgwebdir_mod.py @ 13403:8ed91088acbb
hgweb: make paths wildcards expanding in a repo root match repo correctly
There was a trailing '/' too much when the wildcard part expanded to nothing.
The consequence was that the repo was announced but didn't work.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Tue, 15 Feb 2011 01:04:10 +0100 |
parents | f947d9a4c45c |
children | b391c0c9be61 |
comparison
equal
deleted
inserted
replaced
13402:f947d9a4c45c | 13403:8ed91088acbb |
---|---|
39 | 39 |
40 def urlrepos(prefix, roothead, paths): | 40 def urlrepos(prefix, roothead, paths): |
41 """yield url paths and filesystem paths from a list of repo paths | 41 """yield url paths and filesystem paths from a list of repo paths |
42 | 42 |
43 >>> list(urlrepos('hg', '/opt', ['/opt/r', '/opt/r/r', '/opt'])) | 43 >>> list(urlrepos('hg', '/opt', ['/opt/r', '/opt/r/r', '/opt'])) |
44 [('hg/r', '/opt/r'), ('hg/r/r', '/opt/r/r'), ('hg/', '/opt')] | 44 [('hg/r', '/opt/r'), ('hg/r/r', '/opt/r/r'), ('hg', '/opt')] |
45 >>> list(urlrepos('', '/opt', ['/opt/r', '/opt/r/r', '/opt'])) | 45 >>> list(urlrepos('', '/opt', ['/opt/r', '/opt/r/r', '/opt'])) |
46 [('r', '/opt/r'), ('r/r', '/opt/r/r'), ('', '/opt')] | 46 [('r', '/opt/r'), ('r/r', '/opt/r/r'), ('', '/opt')] |
47 """ | 47 """ |
48 for path in paths: | 48 for path in paths: |
49 path = os.path.normpath(path) | 49 path = os.path.normpath(path) |
50 name = util.pconvert(path[len(roothead):]).strip('/') | 50 yield (prefix + '/' + |
51 if prefix: | 51 util.pconvert(path[len(roothead):]).lstrip('/')).strip('/'), path |
52 name = prefix + '/' + name | |
53 yield name, path | |
54 | 52 |
55 class hgwebdir(object): | 53 class hgwebdir(object): |
56 refreshinterval = 20 | 54 refreshinterval = 20 |
57 | 55 |
58 def __init__(self, conf, baseui=None): | 56 def __init__(self, conf, baseui=None): |