Make restrict entirely a kwtemplater attribute
authorChristian Ebert <blacktrash@gmx.net>
Sun, 10 Feb 2008 00:32:14 +0100
changeset 396 c5dfb272ff4f
parent 395 9c51c755118b
child 398 257da73e109f
Make restrict entirely a kwtemplater attribute
hgkw/keyword.py
--- a/hgkw/keyword.py	Sun Feb 10 00:15:03 2008 +0100
+++ b/hgkw/keyword.py	Sun Feb 10 00:32:14 2008 +0100
@@ -141,11 +141,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 = ''
 
@@ -451,8 +451,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):
@@ -464,7 +463,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