[PATCH stable] hgwebdir: allow pure relative globs in paths

Mads Kiilerich mads at kiilerich.com
Wed Jul 21 15:22:43 CDT 2010


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1279743748 -7200
# Node ID fdc1a7a17bf0d1aa8ff6fd67977d4161cb1ed06a
# Parent  a51cc1debab83e5b1b79d5176cce2561c668e4a0
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?

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
@@ -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('/')
diff --git a/tests/test-hgwebdir b/tests/test-hgwebdir
--- a/tests/test-hgwebdir
+++ b/tests/test-hgwebdir
@@ -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 \
diff --git a/tests/test-hgwebdir.out b/tests/test-hgwebdir.out
--- a/tests/test-hgwebdir.out
+++ b/tests/test-hgwebdir.out
@@ -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>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</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>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</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>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</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>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</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>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</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>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</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>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</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>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</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>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
+<td class="age">seconds ago</td>
+<td class="indexlinks"></td>
+</tr>
+
 </table>
 </div>
 </div>


More information about the Mercurial-devel mailing list