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 @@ -41,16 +41,14 @@ def urlrepos(prefix, roothead, paths): """yield url paths and filesystem paths from a list of repo paths >>> list(urlrepos('hg', '/opt', ['/opt/r', '/opt/r/r', '/opt'])) - [('hg/r', '/opt/r'), ('hg/r/r', '/opt/r/r'), ('hg/', '/opt')] + [('hg/r', '/opt/r'), ('hg/r/r', '/opt/r/r'), ('hg', '/opt')] >>> list(urlrepos('', '/opt', ['/opt/r', '/opt/r/r', '/opt'])) [('r', '/opt/r'), ('r/r', '/opt/r/r'), ('', '/opt')] """ for path in paths: path = os.path.normpath(path) - name = util.pconvert(path[len(roothead):]).strip('/') - if prefix: - name = prefix + '/' + name - yield name, path + yield (prefix + '/' + + util.pconvert(path[len(roothead):]).lstrip('/')).strip('/'), path class hgwebdir(object): refreshinterval = 20 diff --git a/tests/test-hgwebdir.t b/tests/test-hgwebdir.t --- a/tests/test-hgwebdir.t +++ b/tests/test-hgwebdir.t @@ -99,6 +99,7 @@ rss-log without basedir > rcoll=$root/** > star=* > starstar=** + > astar=webdir/a/* > EOF $ hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \ > -A access-paths.log -E error-paths-2.log @@ -130,6 +131,8 @@ should succeed, slashy names /starstar/webdir/b/ /starstar/webdir/b/d/ /starstar/webdir/c/ + /astar/ + /astar/.hg/patches/ $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=paper' 200 Script output follows @@ -322,6 +325,22 @@ should succeed, slashy names + + astar + unknown + Foo Bar <foo.bar@example.com> + * ago (glob) + + + + + astar/.hg/patches + unknown + Foo Bar <foo.bar@example.com> + * ago (glob) + + + @@ -470,7 +489,7 @@ Test [paths] '*' extension a -est [paths] '**' extension +Test [paths] '**' extension $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/?style=raw' 200 Script output follows @@ -486,6 +505,12 @@ est [paths] '**' extension 200 Script output follows d + +Test [paths] '*' in a repo root + + $ hg id http://localhost:$HGPORT1/astar + 8580ff50825a + $ "$TESTDIR/killdaemons.py" $ cat > paths.conf < [paths]