Adapt to new webcommands with "clean" monkey patches
authorChristian Ebert <blacktrash@gmx.net>
Mon, 31 Mar 2008 11:03:23 +0200
changeset 436 ca455dfc5c80
parent 430 15a4c3d86501
child 437 7219104a7cfc
Adapt to new webcommands with "clean" monkey patches
hgkw/keyword.py
--- a/hgkw/keyword.py	Sun Mar 23 13:34:56 2008 +0100
+++ b/hgkw/keyword.py	Mon Mar 31 11:03:23 2008 +0200
@@ -110,6 +110,8 @@
 _patchfile_init = patch.patchfile.__init__
 _patch_diff = patch.diff
 _dispatch_parse = dispatch._parse
+_webcommands_changeset = webcommands.changeset
+_webcommands_filediff = webcommands.filediff
 
 def _kwpatchfile_init(self, ui, fname, missing=False):
     '''Monkeypatch/wrap patch.patchfile.__init__ to avoid
@@ -133,12 +135,12 @@
 def _kwweb_changeset(web, req, tmpl):
     '''Wraps webcommands.changeset turning off keyword expansion.'''
     kwtools['templater'].matcher = util.never
-    return web.changeset(tmpl, web.changectx(req))
+    return _webcommands_changeset(web, req, tmpl)
 
 def _kwweb_filediff(web, req, tmpl):
     '''Wraps webcommands.filediff turning off keyword expansion.'''
     kwtools['templater'].matcher = util.never
-    return web.filediff(tmpl, web.filectx(req))
+    return _webcommands_filediff(web, req, tmpl)
 
 def _kwdispatch_parse(ui, args):
     '''Monkeypatch dispatch._parse to obtain running hg command.'''
@@ -147,6 +149,7 @@
     return cmd, func, args, options, cmdoptions
 
 # dispatch._parse is run before reposetup, so wrap it here
+# all other actual monkey patching is done at end of reposetup
 dispatch._parse = _kwdispatch_parse