hgwebdir: allow pure relative globs in paths
This allows the (to me, in some setups) obvious configuration:
[paths]
/ = *
or
/ = **
Relative paths used to work with [collections] even though it isn't documented.
Perhaps it should be documented?
--- a/mercurial/hgweb/hgwebdir_mod.py Thu Jul 22 15:26:26 2010 -0400
+++ b/mercurial/hgweb/hgwebdir_mod.py Wed Jul 21 22:22:28 2010 +0200
@@ -32,7 +32,7 @@
except KeyError:
repos.append((prefix, root))
continue
- roothead = os.path.normpath(roothead)
+ 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('/')
--- a/tests/test-hgwebdir Thu Jul 22 15:26:26 2010 -0400
+++ b/tests/test-hgwebdir Wed Jul 21 22:22:28 2010 +0200
@@ -65,6 +65,8 @@
b=$root/b
coll=$root/*
rcoll=$root/**
+star=*
+starstar=**
EOF
hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
--- a/tests/test-hgwebdir.out Thu Jul 22 15:26:26 2010 -0400
+++ b/tests/test-hgwebdir.out Wed Jul 21 22:22:28 2010 +0200
@@ -46,6 +46,15 @@
/rcoll/b/
/rcoll/b/d/
/rcoll/c/
+/star/webdir/a/
+/star/webdir/a/.hg/patches/
+/star/webdir/b/
+/star/webdir/c/
+/starstar/webdir/a/
+/starstar/webdir/a/.hg/patches/
+/starstar/webdir/b/
+/starstar/webdir/b/d/
+/starstar/webdir/c/
200 Script output follows
@@ -165,6 +174,78 @@
<td class="indexlinks"></td>
</tr>
+<tr class="parity1">
+<td><a href="/star/webdir/a/?style=paper">star/webdir/a</a></td>
+<td>unknown</td>
+<td>Foo Bar <foo.bar@example.com></td>
+<td class="age">seconds ago</td>
+<td class="indexlinks"></td>
+</tr>
+
+<tr class="parity0">
+<td><a href="/star/webdir/a/.hg/patches/?style=paper">star/webdir/a/.hg/patches</a></td>
+<td>unknown</td>
+<td>Foo Bar <foo.bar@example.com></td>
+<td class="age">seconds ago</td>
+<td class="indexlinks"></td>
+</tr>
+
+<tr class="parity1">
+<td><a href="/star/webdir/b/?style=paper">star/webdir/b</a></td>
+<td>unknown</td>
+<td>Foo Bar <foo.bar@example.com></td>
+<td class="age">seconds ago</td>
+<td class="indexlinks"></td>
+</tr>
+
+<tr class="parity0">
+<td><a href="/star/webdir/c/?style=paper">star/webdir/c</a></td>
+<td>unknown</td>
+<td>Foo Bar <foo.bar@example.com></td>
+<td class="age">seconds ago</td>
+<td class="indexlinks"></td>
+</tr>
+
+<tr class="parity1">
+<td><a href="/starstar/webdir/a/?style=paper">starstar/webdir/a</a></td>
+<td>unknown</td>
+<td>Foo Bar <foo.bar@example.com></td>
+<td class="age">seconds ago</td>
+<td class="indexlinks"></td>
+</tr>
+
+<tr class="parity0">
+<td><a href="/starstar/webdir/a/.hg/patches/?style=paper">starstar/webdir/a/.hg/patches</a></td>
+<td>unknown</td>
+<td>Foo Bar <foo.bar@example.com></td>
+<td class="age">seconds ago</td>
+<td class="indexlinks"></td>
+</tr>
+
+<tr class="parity1">
+<td><a href="/starstar/webdir/b/?style=paper">starstar/webdir/b</a></td>
+<td>unknown</td>
+<td>Foo Bar <foo.bar@example.com></td>
+<td class="age">seconds ago</td>
+<td class="indexlinks"></td>
+</tr>
+
+<tr class="parity0">
+<td><a href="/starstar/webdir/b/d/?style=paper">starstar/webdir/b/d</a></td>
+<td>unknown</td>
+<td>Foo Bar <foo.bar@example.com></td>
+<td class="age">seconds ago</td>
+<td class="indexlinks"></td>
+</tr>
+
+<tr class="parity1">
+<td><a href="/starstar/webdir/c/?style=paper">starstar/webdir/c</a></td>
+<td>unknown</td>
+<td>Foo Bar <foo.bar@example.com></td>
+<td class="age">seconds ago</td>
+<td class="indexlinks"></td>
+</tr>
+
</table>
</div>
</div>