[PATCH 1 of 1] hgwebdir: correct name output for path wildcards without prefix (issue2310)
Laurens Holst
laurens.nospam at grauw.nl
Fri Jul 30 14:58:18 CDT 2010
# HG changeset patch
# User Laurens Holst <laurens.hg at grauw.nl>
# Date 1280519631 -7200
# Branch stable
# Node ID 8802d93abcba83baa315395d61d851ec785e86a3
# Parent 52e4ac3e63f780114c5b7613fe0643b305d09789
hgwebdir: correct name output for path wildcards without prefix (issue2310)
When you pass ´*´ or ´**´ to hgweb, without prefixing it ([paths] / = **),
the first character gets stripped from the resulting names.
To test: findrepos([('/', '**')]) yields ('g-stable', 'hg-stable'), etc.
This patch fixes the issue by special casing the situation where root is ´.´.
diff -r 52e4ac3e63f7 -r 8802d93abcba mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py Tue Jul 27 14:40:25 2010 -0400
+++ b/mercurial/hgweb/hgwebdir_mod.py Fri Jul 30 21:53:51 2010 +0200
@@ -35,7 +35,10 @@
roothead = os.path.normpath(os.path.abspath(roothead))
for path in util.walkrepos(roothead, followsym=True, recurse=recurse):
path = os.path.normpath(path)
- name = util.pconvert(path[len(roothead):]).strip('/')
+ if roothead == '.':
+ name = util.pconvert(path)
+ else:
+ name = util.pconvert(path[len(roothead):]).strip('/')
if prefix:
name = prefix + '/' + name
repos.append((name, path))
More information about the Mercurial-devel
mailing list