comparison mercurial/hgweb/hgweb_mod.py @ 18826:35fb2ef52a39

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.
author Simon Heimberg <simohe@besonet.ch>
date Thu, 21 Mar 2013 18:16:48 +0100
parents 013fcd112f13
children f02045645d12
comparison
equal deleted inserted replaced
18825:f0564402d059 18826:35fb2ef52a39
63 else: 63 else:
64 self.repo = repo 64 self.repo = repo
65 65
66 self.repo = self._getview(self.repo) 66 self.repo = self._getview(self.repo)
67 self.repo.ui.setconfig('ui', 'report_untrusted', 'off') 67 self.repo.ui.setconfig('ui', 'report_untrusted', 'off')
68 self.repo.baseui.setconfig('ui', 'report_untrusted', 'off')
68 self.repo.ui.setconfig('ui', 'nontty', 'true') 69 self.repo.ui.setconfig('ui', 'nontty', 'true')
70 self.repo.baseui.setconfig('ui', 'nontty', 'true')
69 hook.redirect(True) 71 hook.redirect(True)
70 self.mtime = -1 72 self.mtime = -1
71 self.size = -1 73 self.size = -1
72 self.reponame = name 74 self.reponame = name
73 self.archives = 'zip', 'gz', 'bz2' 75 self.archives = 'zip', 'gz', 'bz2'
99 return repo.filtered(viewconfig) 101 return repo.filtered(viewconfig)
100 else: 102 else:
101 return repo.filtered('served') 103 return repo.filtered('served')
102 104
103 def refresh(self, request=None): 105 def refresh(self, request=None):
104 if request:
105 self.repo.ui.environ = request.env
106 st = get_stat(self.repo.spath) 106 st = get_stat(self.repo.spath)
107 # compare changelog size in addition to mtime to catch 107 # compare changelog size in addition to mtime to catch
108 # rollbacks made less than a second ago 108 # rollbacks made less than a second ago
109 if st.st_mtime != self.mtime or st.st_size != self.size: 109 if st.st_mtime != self.mtime or st.st_size != self.size:
110 self.mtime = st.st_mtime 110 self.mtime = st.st_mtime
111 self.size = st.st_size 111 self.size = st.st_size
112 self.repo = hg.repository(self.repo.ui, self.repo.root) 112 r = hg.repository(self.repo.baseui, self.repo.root)
113 self.repo = self._getview(self.repo) 113 self.repo = self._getview(r)
114 self.maxchanges = int(self.config("web", "maxchanges", 10)) 114 self.maxchanges = int(self.config("web", "maxchanges", 10))
115 self.stripecount = int(self.config("web", "stripes", 1)) 115 self.stripecount = int(self.config("web", "stripes", 1))
116 self.maxshortchanges = int(self.config("web", "maxshortchanges", 116 self.maxshortchanges = int(self.config("web", "maxshortchanges",
117 60)) 117 60))
118 self.maxfiles = int(self.config("web", "maxfiles", 10)) 118 self.maxfiles = int(self.config("web", "maxfiles", 10))
119 self.allowpull = self.configbool("web", "allowpull", True) 119 self.allowpull = self.configbool("web", "allowpull", True)
120 encoding.encoding = self.config("web", "encoding", 120 encoding.encoding = self.config("web", "encoding",
121 encoding.encoding) 121 encoding.encoding)
122 if request:
123 self.repo.ui.environ = request.env
122 124
123 def run(self): 125 def run(self):
124 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."): 126 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
125 raise RuntimeError("This function is only intended to be " 127 raise RuntimeError("This function is only intended to be "
126 "called while running as a CGI script.") 128 "called while running as a CGI script.")