changeset 6071:127c973e4499

keyword: make restrict entirely a kwtemplater attribute
author Christian Ebert <blacktrash@gmx.net>
date Sun, 10 Feb 2008 01:53:19 +0100
parents 5fd126d1adf8
children e521ec1ad985
files hgext/keyword.py
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/keyword.py	Sat Feb 09 22:50:53 2008 +0100
+++ b/hgext/keyword.py	Sun Feb 10 01:53:19 2008 +0100
@@ -139,11 +139,11 @@
         'Header': '{root}/{file},v {node|short} {date|utcdate} {author|user}',
     }
 
-    def __init__(self, ui, repo, inc, exc, restrict):
+    def __init__(self, ui, repo, inc, exc, hgcmd):
         self.ui = ui
         self.repo = repo
         self.matcher = util.matcher(repo.root, inc=inc, exc=exc)[1]
-        self.restrict = restrict
+        self.restrict = hgcmd in restricted.split()
         self.commitnode = None
         self.path = ''
 
@@ -449,8 +449,7 @@
         if node1 is not None and node1 != repo.changectx().node():
             hgcmd = 'diff1'
 
-    restrict = hgcmd in restricted.split()
-    _kwtemplater = kwtemplater(ui, repo, inc, exc, restrict)
+    _kwtemplater = kwtemplater(ui, repo, inc, exc, hgcmd)
 
     class kwrepo(repo.__class__):
         def file(self, f, kwmatch=False):
@@ -462,7 +461,7 @@
 
         def wread(self, filename):
             data = super(kwrepo, self).wread(filename)
-            if restrict and _kwtemplater.matcher(filename):
+            if _kwtemplater.restrict and _kwtemplater.matcher(filename):
                 return _kwtemplater.shrink(data)
             return data