# HG changeset patch # User Bryan O'Sullivan # Date 1248301710 25200 # Node ID fb5562afc263caf75b33ed9a48f98e26b8f67991 # Parent 061eeb602354616cffb061cb2ea779cbeb7f0f96# Parent f6eb03027411ad3edca21c4701c11ccdd11de97e Merge with crew-stable diff -r 061eeb602354 -r fb5562afc263 mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py Wed Jul 22 23:12:54 2009 +0200 +++ b/mercurial/hgweb/hgwebdir_mod.py Wed Jul 22 15:28:30 2009 -0700 @@ -6,7 +6,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2, incorporated herein by reference. -import os, time +import os, re, time from mercurial.i18n import _ from mercurial import ui, hg, util, templater from mercurial import error, encoding @@ -225,7 +225,9 @@ parts.insert(0, req.env['PATH_INFO'].rstrip('/')) if req.env['SCRIPT_NAME']: parts.insert(0, req.env['SCRIPT_NAME']) - url = ('/'.join(parts).replace("//", "/")) + '/' + m = re.match('((?:https?://)?)(.*)', '/'.join(parts)) + # squish repeated slashes out of the path component + url = m.group(1) + re.sub('/+', '/', m.group(2)) + '/' # update time with local timezone try: diff -r 061eeb602354 -r fb5562afc263 tests/test-hgwebdir --- a/tests/test-hgwebdir Wed Jul 22 23:12:54 2009 +0200 +++ b/tests/test-hgwebdir Wed Jul 22 15:28:30 2009 -0700 @@ -88,7 +88,8 @@ $root=$root EOF -hg serve -p $HGPORT2 -d --pid-file=hg.pid --webdir-conf collections.conf \ +hg serve --config web.baseurl=http://hg.example.com:8080/ -p $HGPORT2 -d \ + --pid-file=hg.pid --webdir-conf collections.conf \ -A access-collections.log -E error-collections.log cat hg.pid >> $DAEMON_PIDS diff -r 061eeb602354 -r fb5562afc263 tests/test-hgwebdir.out --- a/tests/test-hgwebdir.out Wed Jul 22 23:12:54 2009 +0200 +++ b/tests/test-hgwebdir.out Wed Jul 22 15:28:30 2009 -0700 @@ -311,10 +311,10 @@ 200 Script output follows -/a/ -/a/.hg/patches/ -/b/ -/c/ +http://hg.example.com:8080/a/ +http://hg.example.com:8080/a/.hg/patches/ +http://hg.example.com:8080/b/ +http://hg.example.com:8080/c/ 200 Script output follows