diff -r c5dfb272ff4f -r 257da73e109f hgkw/keyword.py --- a/hgkw/keyword.py Sun Feb 10 00:32:14 2008 +0100 +++ b/hgkw/keyword.py Sun Feb 10 08:35:55 2008 +0100 @@ -82,6 +82,7 @@ from mercurial import commands, cmdutil, context, dispatch, filelog, revlog from mercurial import patch, localrepo, templater, templatefilters, util +from mercurial.hgweb import webcommands from mercurial.node import * from mercurial.i18n import _ import re, shutil, tempfile, time @@ -116,6 +117,16 @@ kwshrunk = _kwtemplater.shrink(''.join(self.lines)) self.lines = kwshrunk.splitlines(True) +def _kwweb_changeset(web, req, tmpl): + '''Wraps webcommands.changeset turning off keyword expansion.''' + _kwtemplater.matcher = util.never + return web.changeset(tmpl, web.changectx(req)) + +def _kwweb_filediff(web, req, tmpl): + '''Wraps webcommands.filediff turning off keyword expansion.''' + _kwtemplater.matcher = util.never + return web.filediff(tmpl, web.filectx(req)) + def _kwdispatch_parse(ui, args): '''Monkeypatch dispatch._parse to obtain current command and command options (global _cmd, _cmdoptions).''' @@ -123,6 +134,7 @@ _cmd, func, args, options, _cmdoptions = _dispatch_parse(ui, args) return _cmd, func, args, options, _cmdoptions +# dispatch._parse is run before reposetup, so wrap it here dispatch._parse = _kwdispatch_parse @@ -512,6 +524,8 @@ repo.__class__ = kwrepo patch.patchfile.__init__ = _kwpatchfile_init + webcommands.changeset = webcommands.rev = _kwweb_changeset + webcommands.filediff = webcommands.diff = _kwweb_filediff cmdtable = {