[PATCH 2 of 2] Fix hgwebdir collections when the baseurl option is set

Emanuele Aina em at nerd.ocracy.org
Fri May 2 15:00:47 CDT 2008


# HG changeset patch
# User Emanuele Aina <em at nerd.ocracy.org>
# Date 1209758366 -7200
# Node ID de264004e9d092efb9aacab00da381dcacc0e812
# Parent  13944d98e6c15ffee2f442d888ebf6cf7402e770
Fix hgwebdir collections when the baseurl option is set

diff -r 13944d98e6c1 -r de264004e9d0 mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py	Fri May 02 21:57:52 2008 +0200
+++ b/mercurial/hgweb/hgwebdir_mod.py	Fri May 02 21:59:26 2008 +0200
@@ -6,7 +6,7 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-import os
+import os, re
 from mercurial.i18n import gettext as _
 from mercurial.repo import RepoError
 from mercurial import ui, hg, util, templater, templatefilters
@@ -164,6 +164,7 @@
 
             rows = []
             parity = paritygen(self.stripecount)
+            slashes=re.compile('(?<!:)//+')
             for name, path in self.repos:
                 if not name.startswith(subdir):
                     continue
@@ -186,7 +187,7 @@
                     parts.insert(0, req.env['PATH_INFO'].rstrip('/'))
                 if req.env['SCRIPT_NAME']:
                     parts.insert(0, req.env['SCRIPT_NAME'])
-                url = ('/'.join(parts).replace("//", "/")) + '/'
+                url = slashes.sub('/', '/'.join(parts) + '/')
 
                 # update time with local timezone
                 try:




More information about the Mercurial-devel mailing list