[PATCH 1 of 3] keyword: fix pychecker warning about shadowed variable

Christian Ebert blacktrash at gmx.net
Thu Feb 7 08:59:39 CST 2008


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1202396180 -3600
# Node ID bd5494d77b1a1ca30ead77eb00a1612b63ec3621
# Parent  b7f44f01a632ab4a59f276de21dc3c5d8f1b8560
keyword: fix pychecker warning about shadowed variable

Also no underscore prefix for restricted switch inside reposetup.

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -116,11 +116,11 @@
         'Header': '{root}/{file},v {node|short} {date|utcdate} {author|user}',
     }
 
-    def __init__(self, ui, repo, inc, exc, restricted):
+    def __init__(self, ui, repo, inc, exc, restrict):
         self.ui = ui
         self.repo = repo
         self.matcher = util.matcher(repo.root, inc=inc, exc=exc)[1]
-        self.restricted = restricted
+        self.restrict = restrict
         self.commitnode = None
         self.path = ''
 
@@ -159,7 +159,7 @@
 
     def expand(self, node, data):
         '''Returns data with keywords expanded.'''
-        if self.restricted or util.binary(data):
+        if self.restrict or util.binary(data):
             return data
         return self.substitute(node, data, self.re_kw.sub)
 
@@ -436,8 +436,8 @@
         return
 
     global _kwtemplater
-    _restricted = hgcmd in restricted.split()
-    _kwtemplater = kwtemplater(ui, repo, inc, exc, _restricted)
+    restrict = hgcmd in restricted.split()
+    _kwtemplater = kwtemplater(ui, repo, inc, exc, restrict)
 
     class kwrepo(repo.__class__):
         def file(self, f, kwmatch=False):
@@ -449,7 +449,7 @@
 
         def wread(self, filename):
             data = super(kwrepo, self).wread(filename)
-            if _restricted and _kwtemplater.matcher(filename):
+            if restrict and _kwtemplater.matcher(filename):
                 return _kwtemplater.shrink(data)
             return data
 


More information about the Mercurial-devel mailing list