[PATCH 02 of 10] hgweb: do not pass on repo.ui when recreating a repo
Simon Heimberg
simohe at besonet.ch
Thu Mar 21 20:20:52 CDT 2013
# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1363886208 -3600
# Node ID 00aa259c196fbb9751c11933a3f6581152a44c57
# Parent fb7b2ce309b0d37708414db7db4c7191965ccdac
hgweb: do not pass on repo.ui when recreating a repo
Recreate the repo with the global configuration in repo.baseui. The repo
configuration is reread anyway. And now deleted repo configuration is reset to
the default value.
diff -r fb7b2ce309b0 -r 00aa259c196f mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py Mit Okt 10 21:55:49 2012 +0200
+++ b/mercurial/hgweb/hgweb_mod.py Don Mär 21 18:16:48 2013 +0100
@@ -65,7 +65,9 @@
self.repo = self._getview(self.repo)
self.repo.ui.setconfig('ui', 'report_untrusted', 'off')
+ self.repo.baseui.setconfig('ui', 'report_untrusted', 'off')
self.repo.ui.setconfig('ui', 'nontty', 'true')
+ self.repo.baseui.setconfig('ui', 'nontty', 'true')
hook.redirect(True)
self.mtime = -1
self.size = -1
@@ -101,16 +103,14 @@
return repo.filtered('served')
def refresh(self, request=None):
- if request:
- self.repo.ui.environ = request.env
st = get_stat(self.repo.spath)
# compare changelog size in addition to mtime to catch
# rollbacks made less than a second ago
if st.st_mtime != self.mtime or st.st_size != self.size:
self.mtime = st.st_mtime
self.size = st.st_size
- self.repo = hg.repository(self.repo.ui, self.repo.root)
- self.repo = self._getview(self.repo)
+ r = hg.repository(self.repo.baseui, self.repo.root)
+ self.repo = self._getview(r)
self.maxchanges = int(self.config("web", "maxchanges", 10))
self.stripecount = int(self.config("web", "stripes", 1))
self.maxshortchanges = int(self.config("web", "maxshortchanges",
@@ -119,6 +119,8 @@
self.allowpull = self.configbool("web", "allowpull", True)
encoding.encoding = self.config("web", "encoding",
encoding.encoding)
+ if request:
+ self.repo.ui.environ = request.env
def run(self):
if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
More information about the Mercurial-devel
mailing list