D2824: hgweb: rewrite path generation for index entries
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe473a032f38a: hgweb: rewrite path generation for index entries (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2824?vs=6890=6953 REVISION DETAIL https://phab.mercurial-scm.org/D2824 AFFECTED FILES mercurial/hgweb/hgwebdir_mod.py CHANGE DETAILS 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 @@ -9,7 +9,6 @@ from __future__ import absolute_import import os -import re import time from ..i18n import _ @@ -161,11 +160,12 @@ except (IOError, error.RepoError): pass -parts = [name] -parts.insert(0, '/' + subdir.rstrip('/')) -if wsgireq.env['SCRIPT_NAME']: -parts.insert(0, wsgireq.env['SCRIPT_NAME']) -url = re.sub(r'/+', '/', '/'.join(parts) + '/') +parts = [ +wsgireq.req.apppath.strip('/'), +subdir.strip('/'), +name.strip('/'), +] +url = '/' + '/'.join(p for p in parts if p) + '/' # show either a directory entry or a repository if directory: To: indygreg, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2824: hgweb: rewrite path generation for index entries
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY I think this code is easier to read. But the real reason to do this is to eliminate a consumer of wsgirequest. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2824 AFFECTED FILES mercurial/hgweb/hgwebdir_mod.py CHANGE DETAILS 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 @@ -9,7 +9,6 @@ from __future__ import absolute_import import os -import re import time from ..i18n import _ @@ -161,11 +160,12 @@ except (IOError, error.RepoError): pass -parts = [name] -parts.insert(0, '/' + subdir.rstrip('/')) -if wsgireq.env['SCRIPT_NAME']: -parts.insert(0, wsgireq.env['SCRIPT_NAME']) -url = re.sub(r'/+', '/', '/'.join(parts) + '/') +parts = [ +wsgireq.req.apppath.strip('/'), +subdir.strip('/'), +name.strip('/'), +] +url = '/' + '/'.join(p for p in parts if p) + '/' # show either a directory entry or a repository if directory: To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel