[PATCH 3 of 5 hgweb-thread-isolation] hgweb: don't access self.repo during request processing

Gregory Szorc gregory.szorc at gmail.com
Wed Sep 9 21:27:28 UTC 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1440287692 25200
#      Sat Aug 22 16:54:52 2015 -0700
# Node ID 41a5871b279b2d1be1008d1f81e6d9d6a7ad2355
# Parent  e78f1d4024ac96b1de3b057a7a30c7692b878b34
hgweb: don't access self.repo during request processing

We want all repository accesses to go through requestcontext.repo
so the request is isolated from the application.

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
@@ -323,9 +323,9 @@ class hgweb(object):
                 if query:
                     raise ErrorResponse(HTTP_NOT_FOUND)
                 if cmd in perms:
                     self.check_perm(rctx, req, perms[cmd])
-                return protocol.call(self.repo, req, cmd)
+                return protocol.call(rctx.repo, req, cmd)
             except ErrorResponse as inst:
                 # A client that sends unbundle without 100-continue will
                 # break if we respond early.
                 if (cmd == 'unbundle' and



More information about the Mercurial-devel mailing list