# HG changeset patch # User Mads Kiilerich # Date 1297728250 -3600 # Node ID 8ed91088acbb8e6f4fd86f5f7f3165a0947e112d # Parent f947d9a4c45c89e669a7bfc1912520a3368efd0d hgweb: make paths wildcards expanding in a repo root match repo correctly There was a trailing '/' too much when the wildcard part expanded to nothing. The consequence was that the repo was announced but didn't work. diff -r f947d9a4c45c -r 8ed91088acbb mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py Tue Feb 15 01:04:10 2011 +0100 +++ b/mercurial/hgweb/hgwebdir_mod.py Tue Feb 15 01:04:10 2011 +0100 @@ -41,16 +41,14 @@ """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 -r f947d9a4c45c -r 8ed91088acbb tests/test-hgwebdir.t --- a/tests/test-hgwebdir.t Tue Feb 15 01:04:10 2011 +0100 +++ b/tests/test-hgwebdir.t Tue Feb 15 01:04:10 2011 +0100 @@ -99,6 +99,7 @@ > 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 @@ /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 @@ + + 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 @@ 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 @@ 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]