changeset 6416:c0476a6df325

keyword: regroup monkey patch code, underscore prefix private vars
author Christian Ebert <blacktrash@gmx.net>
date Mon, 31 Mar 2008 11:08:52 +0200
parents 69d1946a1d02
children 13fafd8cc4a1
files hgext/keyword.py
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/keyword.py	Mon Mar 31 00:01:27 2008 +0200
+++ b/hgext/keyword.py	Mon Mar 31 11:08:52 2008 +0200
@@ -108,6 +108,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
@@ -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 _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(web, req, tmpl)
+    return _webcommands_filediff(web, req, tmpl)
 
 def _kwdispatch_parse(ui, args):
     '''Monkeypatch dispatch._parse to obtain running hg command.'''
@@ -151,6 +147,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