comparison mercurial/hgweb/hgwebdir_mod.py @ 10675:3c05ecffe20d stable

hgweb: make code to join url path simpler Now SCRIPT_NAME never contains http://host:port part, we don't need to care about '://'.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 11 Mar 2010 00:28:31 +0900
parents 6d87c20cd7a8
children 13341047d517 99bc18d1ab0f
comparison
equal deleted inserted replaced
10674:6d87c20cd7a8 10675:3c05ecffe20d
227 parts = [name] 227 parts = [name]
228 if 'PATH_INFO' in req.env: 228 if 'PATH_INFO' in req.env:
229 parts.insert(0, req.env['PATH_INFO'].rstrip('/')) 229 parts.insert(0, req.env['PATH_INFO'].rstrip('/'))
230 if req.env['SCRIPT_NAME']: 230 if req.env['SCRIPT_NAME']:
231 parts.insert(0, req.env['SCRIPT_NAME']) 231 parts.insert(0, req.env['SCRIPT_NAME'])
232 m = re.match('((?:https?://)?)(.*)', '/'.join(parts)) 232 url = re.sub(r'/+', '/', '/'.join(parts) + '/')
233 # squish repeated slashes out of the path component
234 url = m.group(1) + re.sub('/+', '/', m.group(2)) + '/'
235 233
236 # update time with local timezone 234 # update time with local timezone
237 try: 235 try:
238 r = hg.repository(self.ui, path) 236 r = hg.repository(self.ui, path)
239 d = (get_mtime(r.spath), util.makedate()[1]) 237 d = (get_mtime(r.spath), util.makedate()[1])