Patchwork D2784: hgweb: expose repo name on parsedrequest

login
register
mail settings
Submitter phabricator
Date March 12, 2018, 9:33 p.m.
Message ID <59451b7993a5183ea043f5fe1d6f10fa@localhost.localdomain>
Download mbox | patch
Permalink /patch/29364/
State Not Applicable
Headers show

Comments

phabricator - March 12, 2018, 9:33 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8ddb5c354906: hgweb: expose repo name on parsedrequest (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2784?vs=6845&id=6920

REVISION DETAIL
  https://phab.mercurial-scm.org/D2784

AFFECTED FILES
  mercurial/hgweb/hgweb_mod.py
  mercurial/hgweb/request.py

CHANGE DETAILS




To: indygreg, #hg-reviewers, durin42
Cc: mercurial-devel

Patch

diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py
--- a/mercurial/hgweb/request.py
+++ b/mercurial/hgweb/request.py
@@ -144,6 +144,8 @@ 
     # Whether there is a path component to this request. This can be true
     # when ``dispatchpath`` is empty due to REPO_NAME muckery.
     havepathinfo = attr.ib()
+    # The name of the repository being accessed.
+    reponame = attr.ib()
     # Raw query string (part after "?" in URL).
     querystring = attr.ib()
     # multidict of query string parameters.
@@ -282,6 +284,7 @@ 
                          apppath=apppath,
                          dispatchparts=dispatchparts, dispatchpath=dispatchpath,
                          havepathinfo='PATH_INFO' in env,
+                         reponame=env.get('REPO_NAME'),
                          querystring=querystring,
                          qsparams=qsparams,
                          headers=headers,
diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -141,7 +141,7 @@ 
             if typ in allowed or self.configbool('web', 'allow%s' % typ):
                 yield {'type': typ, 'extension': spec[2], 'node': nodeid}
 
-    def templater(self, wsgireq, req):
+    def templater(self, req):
         # determine scheme, port and server name
         # this is needed to create absolute urls
         logourl = self.config('web', 'logourl')
@@ -159,17 +159,18 @@ 
         # figure out which style to use
 
         vars = {}
-        styles, (style, mapfile) = getstyle(wsgireq.req, self.config,
+        styles, (style, mapfile) = getstyle(req, self.config,
                                             self.templatepath)
         if style == styles[0]:
             vars['style'] = style
 
         sessionvars = webutil.sessionvars(vars, '?')
 
         if not self.reponame:
             self.reponame = (self.config('web', 'name', '')
-                             or wsgireq.env.get('REPO_NAME')
-                             or req.apppath or self.repo.root)
+                             or req.reponame
+                             or req.apppath
+                             or self.repo.root)
 
         def websubfilter(text):
             return templatefilters.websub(text, self.websubtable)
@@ -372,7 +373,7 @@ 
         # process the web interface request
 
         try:
-            tmpl = rctx.templater(wsgireq, req)
+            tmpl = rctx.templater(req)
             ctype = tmpl('mimetype', encoding=encoding.encoding)
             ctype = templater.stringify(ctype)