Mercurial > hg
changeset 6776:39319a457dda
merge with mpm
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Sat, 28 Jun 2008 09:28:01 +0200 |
parents | 54ccf41761c9 (diff) f67d1468ac50 (current diff) |
children | 44c5157474e7 |
files | mercurial/hgweb/hgweb_mod.py |
diffstat | 10 files changed, 40 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Fri Jun 27 18:28:45 2008 -0500 +++ b/mercurial/hgweb/hgweb_mod.py Sat Jun 28 09:28:01 2008 +0200 @@ -16,21 +16,6 @@ from request import wsgirequest import webcommands, protocol, webutil -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)] -} - class hgweb(object): def __init__(self, repo, name=None): if isinstance(repo, str): @@ -104,16 +89,6 @@ self.refresh() - # expand form shortcuts - - for k in shortcuts.iterkeys(): - if k in req.form: - for name, value in shortcuts[k]: - if value is None: - value = req.form[k] - req.form[name] = value - del req.form[k] - # work with CGI variables to create coherent structure # use SCRIPT_NAME, PATH_INFO and QUERY_STRING as well as our REPO_NAME
--- a/mercurial/hgweb/request.py Fri Jun 27 18:28:45 2008 -0500 +++ b/mercurial/hgweb/request.py Sat Jun 28 09:28:01 2008 +0200 @@ -9,6 +9,31 @@ import socket, cgi, errno from common import ErrorResponse, statusmessage +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 expand(form): + for k in shortcuts.iterkeys(): + if k in form: + for name, value in shortcuts[k]: + if value is None: + value = form[k] + form[name] = value + del form[k] + return form + class wsgirequest(object): def __init__(self, wsgienv, start_response): version = wsgienv['wsgi.version'] @@ -21,7 +46,7 @@ self.multiprocess = wsgienv['wsgi.multiprocess'] self.run_once = wsgienv['wsgi.run_once'] self.env = wsgienv - self.form = cgi.parse(self.inp, self.env, keep_blank_values=1) + self.form = expand(cgi.parse(self.inp, self.env, keep_blank_values=1)) self._start_response = start_response self.server_write = None self.headers = []
--- a/templates/coal/changeset.tmpl Fri Jun 27 18:28:45 2008 -0500 +++ b/templates/coal/changeset.tmpl Sat Jun 28 09:28:01 2008 +0200 @@ -9,8 +9,8 @@ <img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a> </div> <ul> - <li><a href="{url}shortlog{sessionvars%urlparameter}">log</a></li> - <li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li> + <li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> + <li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> </ul> <ul>
--- a/templates/coal/fileannotate.tmpl Fri Jun 27 18:28:45 2008 -0500 +++ b/templates/coal/fileannotate.tmpl Sat Jun 28 09:28:01 2008 +0200 @@ -10,8 +10,8 @@ <img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a> </div> <ul> -<li><a href="{url}shortlog/{sessionvars%urlparameter}">log</a></li> -<li><a href="{url}graph/{sessionvars%urlparameter}">graph</a></li> +<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> +<li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> </ul>
--- a/templates/coal/filediff.tmpl Fri Jun 27 18:28:45 2008 -0500 +++ b/templates/coal/filediff.tmpl Sat Jun 28 09:28:01 2008 +0200 @@ -10,8 +10,8 @@ <img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a> </div> <ul> -<li><a href="{url}shortlog/{sessionvars%urlparameter}">log</a></li> -<li><a href="{url}graph/{sessionvars%urlparameter}">graph</a></li> +<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> +<li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> </ul> <ul>
--- a/templates/coal/filelog.tmpl Fri Jun 27 18:28:45 2008 -0500 +++ b/templates/coal/filelog.tmpl Sat Jun 28 09:28:01 2008 +0200 @@ -15,8 +15,8 @@ <img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a> </div> <ul> -<li><a href="{url}shortlog/{sessionvars%urlparameter}">log</a></li> -<li><a href="{url}graph/{sessionvars%urlparameter}">graph</a></li> +<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> +<li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> </ul> <ul>
--- a/templates/coal/filerevision.tmpl Fri Jun 27 18:28:45 2008 -0500 +++ b/templates/coal/filerevision.tmpl Sat Jun 28 09:28:01 2008 +0200 @@ -10,8 +10,8 @@ <img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a> </div> <ul> -<li><a href="{url}shortlog/{sessionvars%urlparameter}">log</a></li> -<li><a href="{url}graph/{sessionvars%urlparameter}">graph</a></li> +<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> +<li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> </ul> <ul>
--- a/templates/coal/graph.tmpl Fri Jun 27 18:28:45 2008 -0500 +++ b/templates/coal/graph.tmpl Sat Jun 28 09:28:01 2008 +0200 @@ -15,7 +15,7 @@ <img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a> </div> <ul> -<li><a href="{url}shortlog{sessionvars%urlparameter}">log</a></li> +<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> <li class="active">graph</li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> </ul>
--- a/templates/coal/manifest.tmpl Fri Jun 27 18:28:45 2008 -0500 +++ b/templates/coal/manifest.tmpl Sat Jun 28 09:28:01 2008 +0200 @@ -10,8 +10,8 @@ <img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a> </div> <ul> -<li><a href="{url}shortlog/{sessionvars%urlparameter}">log</a></li> -<li><a href="{url}graph/{sessionvars%urlparameter}">graph</a></li> +<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> +<li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> </ul> <ul>
--- a/templates/coal/shortlog.tmpl Fri Jun 27 18:28:45 2008 -0500 +++ b/templates/coal/shortlog.tmpl Sat Jun 28 09:28:01 2008 +0200 @@ -15,7 +15,7 @@ </div> <ul> <li class="active">log</li> -<li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li> +<li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> </ul> <ul>