[PATCH 2 of 2] keyword: return webcommands directly from wrapper functions

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


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1206879217 -7200
# Node ID b58fd7fe8d80cfb82ae4f40f4cbde1945aaf6fba
# Parent  4246e19f23ecf436207ae2e6d7034a3dd8d959e3
keyword: return webcommands directly from wrapper functions

That way webcommands are demand-imported only when needed.

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -108,8 +108,9 @@
 _patchfile_init = patch.patchfile.__init__
 _patch_diff = patch.diff
 _dispatch_parse = dispatch._parse
-_web_changeset = webcommands.changeset
-_web_filediff = webcommands.filediff
+# webcommands.changeset, webcommands.filediff
+# are returned directly from inside their respective
+# wrapper functions
 
 def _kwpatchfile_init(self, ui, fname, missing=False):
     '''Monkeypatch/wrap patch.patchfile.__init__ to avoid
@@ -133,12 +134,12 @@
 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.'''


More information about the Mercurial-devel mailing list