# HG changeset patch # User Christian Ebert # Date 1202651868 -3600 # Node ID 5e1faca15e81ce520eff4b316c01322d83a1d57c # Parent db7cc16560d46f86425f3e5e1df361c1a1a2a5a7 (0.9.2compat) web as in default where possible diff -r db7cc16560d4 -r 5e1faca15e81 hgkw/keyword.py --- a/hgkw/keyword.py Sun Feb 10 01:28:16 2008 +0100 +++ b/hgkw/keyword.py Sun Feb 10 14:57:48 2008 +0100 @@ -158,6 +158,48 @@ pass try: + from mercurial.hgweb import webcommands + + def _kwweb_changeset(web, req, tmpl): + '''Wraps webcommands.changeset turning off keyword expansion.''' + try: + _kwtemplater.matcher = util.never + except AttributeError: + pass + return web.changeset(tmpl, web.changectx(req)) + + def _kwweb_filediff(web, req, tmpl): + '''Wraps webcommands.filediff turning off keyword expansion.''' + try: + _kwtemplater.matcher = util.never + except AttributeError: + pass + return web.filediff(tmpl, web.filectx(req)) + + webcommands.changeset = webcommands.rev = _kwweb_changeset + webcommands.filediff = webcommands.diff = _kwweb_filediff + +except ImportError: + from mercurial.hgweb.hgweb_mod import hgweb + + def _kwweb_changeset(self, req): + try: + _kwtemplater.matcher = util.never + except AttributeError: + pass + req.write(self.changeset(self.changectx(req))) + + def _kwweb_filediff(self, req): + try: + _kwtemplater.matcher = util.never + except AttributeError: + pass + req.write(self.filediff(self.filectx(req))) + + hgweb.do_changeset = hgweb.do_rev = _kwweb_changeset + hgweb.do_filediff = hgweb.do_diff = _kwweb_filediff + +try: # templatefilters module introduced in 9f1e6ab76069 from mercurial import templatefilters template_filters = templatefilters.filters