[issue852] hgwebdir [collections] does not work very well under windows
Patrick Mézard
mercurial-bugs at selenic.com
Sun Dec 2 12:10:23 CST 2007
New submission from Patrick Mézard <pmezard at gmail.com>:
hgwebdir.cgi says:
"""
# [collections]
# /prefix/to/strip/off = /root/of/tree/full/of/repos
#
# collections example: say directory tree /foo contains repos /foo/bar,
# /foo/quux/baz. Give this config section:
# [collections]
# /foo = /foo
# Then repos will list as bar and quux/baz.
"""
Unfortunately, absolute Windows paths cannot be used as ConfigParser keys
because ":" is already a key/value delimiter.
For instance the following patch:
diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -47,14 +47,18 @@ class hgwebdir(object):
self.stripecount = int(cp.get('web', 'stripes'))
if cp.has_section('paths'):
self.repos.extend(cleannames(cp.items('paths')))
+ f = open('collections.txt', 'w')
if cp.has_section('collections'):
for prefix, root in cp.items('collections'):
+ print >>f, 'repo', prefix, root
for path in util.walkrepos(root):
repo = os.path.normpath(path)
name = repo
if name.startswith(prefix):
name = name[len(prefix):]
self.repos.append((name.lstrip(os.sep), repo))
+ f.close()
self.repos.sort()
outputs:
"""
c \docume~1\trick\locals~1\temp\hgtests.cmwcni\test-hgwebdir\webdir=c:\docume~1
[...]
"""
Sure we can rebuild the original path but using filenames as ConfigParser keys
sounds a little unreliable.
----------
messages: 4424
nosy: pmezard
priority: bug
status: unread
title: hgwebdir [collections] does not work very well under windows
topic: hgweb, windows
____________________________________________________
Mercurial issue tracker <mercurial-bugs at selenic.com>
<http://www.selenic.com/mercurial/bts/issue852>
____________________________________________________
More information about the Mercurial-devel
mailing list