From 10593de67b7174f4804e2766cd919f6531901ae2 Mon Sep 17 00:00:00 2001 From: Thomas Arendsen Hein Date: Thu, 12 Oct 2006 17:06:51 +0200 Subject: [PATCH] Keep session variables when linking from hgwebdir's index to repositories. --- mercurial/hgweb/hgwebdir_mod.py | 13 +++++++++++++ templates/gitweb/map | 2 +- templates/map | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py index c04321ea9d..6d329f3bfd 100644 --- a/mercurial/hgweb/hgwebdir_mod.py +++ b/mercurial/hgweb/hgwebdir_mod.py @@ -90,6 +90,18 @@ class hgwebdir(object): "node": nodeid, "url": url} def entries(sortcolumn="", descending=False, **map): + def sessionvars(**map): + fields = [] + if req.form.has_key('style'): + style = req.form['style'][0] + if style != get('web', 'style', ''): + fields.append(('style', style)) + + separator = url[-1] == '?' and ';' or '?' + for name, value in fields: + yield dict(name=name, value=value, separator=separator) + separator = ';' + rows = [] parity = 0 for name, path in self.repos: @@ -123,6 +135,7 @@ class hgwebdir(object): description_sort=description.upper() or "unknown", lastchange=d, lastchange_sort=d[1]-d[0], + sessionvars=sessionvars, archives=archivelist(u, "tip", url)) if (not sortcolumn or (sortcolumn, descending) == self.repos_sorted): diff --git a/templates/gitweb/map b/templates/gitweb/map index 2f65ba4f23..7414579ce1 100644 --- a/templates/gitweb/map +++ b/templates/gitweb/map @@ -49,7 +49,7 @@ shortlog = shortlog.tmpl shortlogentry = '#date|age# ago#author##desc|strip|firstline|escape#changeset | manifest' filelogentry = '#date|age# ago#desc|strip|firstline|escape#file | annotate #rename%filelogrename#' archiveentry = ' | #type|escape# ' -indexentry = '#name|escape##description##contact|obfuscate##lastchange|age# ago #archives%archiveentry#' +indexentry = '#name|escape##description##contact|obfuscate##lastchange|age# ago #archives%archiveentry#' index = index.tmpl urlparameter = '#separator##name#=#value|urlescape#' hiddenformentry = '' diff --git a/templates/map b/templates/map index 8b653e140f..9aa1b6d70f 100644 --- a/templates/map +++ b/templates/map @@ -46,7 +46,7 @@ filediffparent = 'parent #rev#: