[PATCH 1 of 2] keyword: regroup monkey patch code, add underscore prefix

Christian Ebert blacktrash at gmx.net
Sun Mar 30 07:14:29 CDT 2008


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1206878372 -7200
# Node ID 4246e19f23ecf436207ae2e6d7034a3dd8d959e3
# Parent  f08662abdf3f3a4806e39bf64d208ea134857dc4
keyword: regroup monkey patch code, add underscore prefix

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -108,6 +108,8 @@
 _patchfile_init = patch.patchfile.__init__
 _patch_diff = patch.diff
 _dispatch_parse = dispatch._parse
+_web_changeset = webcommands.changeset
+_web_filediff = webcommands.filediff
 
 def _kwpatchfile_init(self, ui, fname, missing=False):
     '''Monkeypatch/wrap patch.patchfile.__init__ to avoid
@@ -128,21 +130,15 @@
     _patch_diff(repo, node1=node1, node2=node2, files=files, match=match,
                 fp=fp, changes=changes, opts=opts)
 
-# monkeypatching hgweb functions changeset and filediff
-# actual monkeypatching is done at the bottom of reposetup()
-
-web_changeset = webcommands.changeset
-web_filediff = webcommands.filediff
-
 def _kwweb_changeset(web, req, tmpl):
     '''Wraps webcommands.changeset turning off keyword expansion.'''
     kwtools['templater'].matcher = util.never
-    return web_changeset(web, req, tmpl)
+    return _web_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(web, req, tmpl)
+    return _web_filediff(web, req, tmpl)
 
 def _kwdispatch_parse(ui, args):
     '''Monkeypatch dispatch._parse to obtain running hg command.'''


More information about the Mercurial-devel mailing list