168 try: |
168 try: |
169 from mercurial.hgweb import webcommands |
169 from mercurial.hgweb import webcommands |
170 |
170 |
171 def _kwweb_changeset(web, req, tmpl): |
171 def _kwweb_changeset(web, req, tmpl): |
172 '''Wraps webcommands.changeset turning off keyword expansion.''' |
172 '''Wraps webcommands.changeset turning off keyword expansion.''' |
173 if kwtools['templater']: |
173 kwtools['templater'].matcher = util.never |
174 kwtools['templater'].matcher = util.never |
|
175 return web.changeset(tmpl, web.changectx(req)) |
174 return web.changeset(tmpl, web.changectx(req)) |
176 |
175 |
177 def _kwweb_filediff(web, req, tmpl): |
176 def _kwweb_filediff(web, req, tmpl): |
178 '''Wraps webcommands.filediff turning off keyword expansion.''' |
177 '''Wraps webcommands.filediff turning off keyword expansion.''' |
179 if kwtools['templater']: |
178 kwtools['templater'].matcher = util.never |
180 kwtools['templater'].matcher = util.never |
|
181 return web.filediff(tmpl, web.filectx(req)) |
179 return web.filediff(tmpl, web.filectx(req)) |
182 |
180 |
183 webcommands.changeset = webcommands.rev = _kwweb_changeset |
181 webcommands.changeset = webcommands.rev = _kwweb_changeset |
184 webcommands.filediff = webcommands.diff = _kwweb_filediff |
182 webcommands.filediff = webcommands.diff = _kwweb_filediff |
185 |
183 |
186 except ImportError: |
184 except ImportError: |
187 from mercurial.hgweb.hgweb_mod import hgweb |
185 from mercurial.hgweb.hgweb_mod import hgweb |
188 |
186 |
189 def _kwweb_do_changeset(self, req): |
187 def _kwweb_do_changeset(self, req): |
190 if kwtools['templater']: |
188 kwtools['templater'].matcher = util.never |
191 kwtools['templater'].matcher = util.never |
|
192 req.write(self.changeset(self.changectx(req))) |
189 req.write(self.changeset(self.changectx(req))) |
193 |
190 |
194 def _kwweb_do_filediff(self, req): |
191 def _kwweb_do_filediff(self, req): |
195 if kwtools['templater']: |
192 kwtools['templater'].matcher = util.never |
196 kwtools['templater'].matcher = util.never |
|
197 req.write(self.filediff(self.filectx(req))) |
193 req.write(self.filediff(self.filectx(req))) |
198 |
194 |
199 hgweb.do_changeset = hgweb.do_rev = _kwweb_do_changeset |
195 hgweb.do_changeset = hgweb.do_rev = _kwweb_do_changeset |
200 hgweb.do_filediff = hgweb.do_diff = _kwweb_do_filediff |
196 hgweb.do_filediff = hgweb.do_diff = _kwweb_do_filediff |
201 |
197 |