Mercurial > public > mercurial-scm > hg
diff mercurial/hgweb/request.py @ 36859:422be99519e5
hgweb: remove support for short query string based aliases (BC)
Form data exposed by hgweb is post-processed to expand certain
shortcuts. For example, URLs with "?cs=@" is essentially expanded to
"?cmd=changeset&node=@". And the URL router treats this the same
as "/changeset/@".
These shortcuts were initially added in 2005 in 34cb3957d875 and
964baa35faf8. They have rarely been touched in the last decade (just
moving code around a bit).
We have almost no test coverage of this feature. AFAICT no templates
reference URLs of this form. I even looked at the initial version
of paper and coal from ~2008 and they use the "/command/params" URL
form and not these shortcuts.
Furthermore, I couldn't even get some shortcuts to work! For example,
"?sl=@" attempts to do a revision search instead of showing shortlog
starting at revision @. Maybe I'm just doing it wrong?
Because this is ancient, mostly untested code, there is a migration
path to something better, and because anyone passionate enough to
preserve URLs can install URL redirects, let's nuke the feature.
.. bc::
Query string shorts in hgweb like ``?cs=@`` have been removed. Use
URLs of the form ``/:cmd`` instead.
Differential Revision: https://phab.mercurial-scm.org/D2773
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 09 Mar 2018 17:10:36 -0800 |
parents | 01f6bba64424 |
children | a88d68dc3ee8 |
line wrap: on
line diff
--- a/mercurial/hgweb/request.py Sat Mar 10 11:07:53 2018 -0800 +++ b/mercurial/hgweb/request.py Fri Mar 09 17:10:36 2018 -0800 @@ -27,37 +27,6 @@ util, ) -shortcuts = { - 'cl': [('cmd', ['changelog']), ('rev', None)], - 'sl': [('cmd', ['shortlog']), ('rev', None)], - 'cs': [('cmd', ['changeset']), ('node', None)], - 'f': [('cmd', ['file']), ('filenode', None)], - 'fl': [('cmd', ['filelog']), ('filenode', None)], - 'fd': [('cmd', ['filediff']), ('node', None)], - 'fa': [('cmd', ['annotate']), ('filenode', None)], - 'mf': [('cmd', ['manifest']), ('manifest', None)], - 'ca': [('cmd', ['archive']), ('node', None)], - 'tags': [('cmd', ['tags'])], - 'tip': [('cmd', ['changeset']), ('node', ['tip'])], - 'static': [('cmd', ['static']), ('file', None)] -} - -def normalize(form): - # first expand the shortcuts - for k in shortcuts: - if k in form: - for name, value in shortcuts[k]: - if value is None: - value = form[k] - form[name] = value - del form[k] - # And strip the values - bytesform = {} - for k, v in form.iteritems(): - bytesform[pycompat.bytesurl(k)] = [ - pycompat.bytesurl(i.strip()) for i in v] - return bytesform - @attr.s(frozen=True) class parsedrequest(object): """Represents a parsed WSGI request. @@ -258,7 +227,7 @@ self.run_once = wsgienv[r'wsgi.run_once'] self.env = wsgienv self.req = parserequestfromenv(wsgienv, inp) - self.form = normalize(self.req.querystringdict) + self.form = self.req.querystringdict self._start_response = start_response self.server_write = None self.headers = []