Rename kwx to kwtools
authorChristian Ebert <blacktrash@gmx.net>
Fri, 15 Feb 2008 17:57:45 +0100
changeset 416 b69dca43ef08
parent 415 d1026365eff6
child 418 3d882f14f23a
child 423 7d1aeda2d0cc
Rename kwx to kwtools
hgkw/keyword.py
--- a/hgkw/keyword.py	Fri Feb 15 17:54:58 2008 +0100
+++ b/hgkw/keyword.py	Fri Feb 15 17:57:45 2008 +0100
@@ -104,7 +104,7 @@
 
 
 # make keyword tools accessible
-kwx = { 'templater': None, 'hgcmd': None }
+kwtools = {'templater': None, 'hgcmd': None}
 
 # store originals of monkeypatches
 _patchfile_init = patch.patchfile.__init__
@@ -116,7 +116,7 @@
     rejects or conflicts due to expanded keywords in working dir.'''
     _patchfile_init(self, ui, fname, missing=missing)
     # shrink keywords read from working dir
-    kwt = kwx['templater']
+    kwt = kwtools['templater']
     self.lines = kwt.shrinklines(self.fname, self.lines)
 
 def _kw_diff(repo, node1=None, node2=None, files=None, match=util.always,
@@ -124,26 +124,26 @@
     '''Monkeypatch patch.diff to avoid expansion except when
     comparing against working dir.'''
     if node2 is not None:
-        kwx['templater'].matcher = util.never
+        kwtools['templater'].matcher = util.never
     elif node1 is not None and node1 != repo.changectx().node():
-        kwx['templater'].restrict = True
+        kwtools['templater'].restrict = True
     _patch_diff(repo, node1=node1, node2=node2, files=files, match=match,
                 fp=fp, changes=changes, opts=opts)
 
 def _kwweb_changeset(web, req, tmpl):
     '''Wraps webcommands.changeset turning off keyword expansion.'''
-    kwx['templater'].matcher = util.never
+    kwtools['templater'].matcher = util.never
     return web.changeset(tmpl, web.changectx(req))
 
 def _kwweb_filediff(web, req, tmpl):
     '''Wraps webcommands.filediff turning off keyword expansion.'''
-    kwx['templater'].matcher = util.never
+    kwtools['templater'].matcher = util.never
     return web.filediff(tmpl, web.filectx(req))
 
 def _kwdispatch_parse(ui, args):
     '''Monkeypatch dispatch._parse to obtain running hg command.'''
     cmd, func, args, options, cmdoptions = _dispatch_parse(ui, args)
-    kwx['hgcmd'] = cmd
+    kwtools['hgcmd'] = cmd
     return cmd, func, args, options, cmdoptions
 
 # dispatch._parse is run before reposetup, so wrap it here
@@ -169,7 +169,7 @@
         self.ui = ui
         self.repo = repo
         self.matcher = util.matcher(repo.root, inc=inc, exc=exc)[1]
-        self.restrict = kwx['hgcmd'] in restricted.split()
+        self.restrict = kwtools['hgcmd'] in restricted.split()
 
         kwmaps = self.ui.configitems('keywordmaps')
         if kwmaps: # override default templates
@@ -275,7 +275,7 @@
     '''
     def __init__(self, opener, path):
         super(kwfilelog, self).__init__(opener, path)
-        self.kwt = kwx['templater']
+        self.kwt = kwtools['templater']
         self.path = path
 
     def read(self, node):
@@ -308,7 +308,7 @@
 
 def _kwfwrite(ui, repo, expand, *pats, **opts):
     '''Selects files and passes them to kwtemplater.overwrite.'''
-    kwt = kwx['templater']
+    kwt = kwtools['templater']
     status = _status(ui, repo, kwt, *pats, **opts)
     modified, added, removed, deleted, unknown, ignored, clean = status
     if modified or added or removed or deleted:
@@ -419,7 +419,7 @@
     keyword expansion.
     That is, files matched by [keyword] config patterns but not symlinks.
     '''
-    kwt = kwx['templater']
+    kwt = kwtools['templater']
     status = _status(ui, repo, kwt, *pats, **opts)
     modified, added, removed, deleted, unknown, ignored, clean = status
     files = modified + added + clean
@@ -460,7 +460,7 @@
     files configured at all for keyword substitution.'''
 
     try:
-        if (not repo.local() or kwx['hgcmd'] in nokwcommands.split()
+        if (not repo.local() or kwtools['hgcmd'] in nokwcommands.split()
             or '.hg' in util.splitpath(repo.root)
             or repo._url.startswith('bundle:')):
             return
@@ -476,7 +476,7 @@
     if not inc:
         return
 
-    kwx['templater'] = kwt = kwtemplater(ui, repo, inc, exc)
+    kwtools['templater'] = kwt = kwtemplater(ui, repo, inc, exc)
 
     class kwrepo(repo.__class__):
         def file(self, f):