[PATCH] keyword: reduce pylint warnings by renaming some variables

Christian Ebert blacktrash at gmx.net
Tue Feb 9 13:10:48 UTC 2010


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1265720361 -3600
# Node ID b00ebfc05c5cc3a16d1af60c76be5edfcd41ef71
# Parent  d216fa04e48a2aeeae138b8d4995ff25fbd771c2
keyword: reduce pylint warnings by renaming some variables

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -163,26 +163,26 @@
         Caveat: localrepository._link fails on Windows.'''
         return self.match(path) and not 'l' in flagfunc(path)
 
-    def overwrite(self, node, expand, files):
+    def overwrite(self, node, kwexpand, candidates):
         '''Overwrites selected files expanding/shrinking keywords.'''
         ctx = self.repo[node]
         mf = ctx.manifest()
         if node is not None:     # commit
-            files = [f for f in ctx.files() if f in mf]
+            candidates = [f for f in ctx.files() if f in mf]
             notify = self.ui.debug
         else:                    # kwexpand/kwshrink
             notify = self.ui.note
-        candidates = [f for f in files if self.iskwfile(f, ctx.flags)]
+        candidates = [f for f in candidates if self.iskwfile(f, ctx.flags)]
         if candidates:
             self.restrict = True # do not expand when reading
-            msg = (expand and _('overwriting %s expanding keywords\n')
+            msg = (kwexpand and _('overwriting %s expanding keywords\n')
                    or _('overwriting %s shrinking keywords\n'))
             for f in candidates:
                 fp = self.repo.file(f)
                 data = fp.read(mf[f])
                 if util.binary(data):
                     continue
-                if expand:
+                if kwexpand:
                     if node is None:
                         ctx = self.repo.filectx(f, fileid=mf[f]).changectx()
                     data, found = self.substitute(data, f, ctx,
@@ -259,7 +259,7 @@
         raise util.Abort(_('[keyword] patterns cannot match'))
     raise util.Abort(_('no [keyword] patterns configured'))
 
-def _kwfwrite(ui, repo, expand, *pats, **opts):
+def _kwfwrite(ui, repo, kwexpand, *pats, **opts):
     '''Selects files and passes them to kwtemplater.overwrite.'''
     if repo.dirstate.parents()[1] != nullid:
         raise util.Abort(_('outstanding uncommitted merge'))
@@ -272,7 +272,7 @@
     try:
         wlock = repo.wlock()
         lock = repo.lock()
-        kwt.overwrite(None, expand, status[6])
+        kwt.overwrite(None, kwexpand, status[6])
     finally:
         release(lock, wlock)
 
@@ -397,18 +397,18 @@
     status = _status(ui, repo, kwt, *pats, **opts)
     cwd = pats and repo.getcwd() or ''
     modified, added, removed, deleted, unknown, ignored, clean = status
-    files = []
+    tracked = []
     if not (opts.get('unknown') or opts.get('untracked')) or opts.get('all'):
-        files = sorted(modified + added + clean)
+        tracked = sorted(modified + added + clean)
     wctx = repo[None]
-    kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)]
+    kwfiles = [f for f in tracked if kwt.iskwfile(f, wctx.flags)]
     kwunknown = [f for f in unknown if kwt.iskwfile(f, wctx.flags)]
     if not opts.get('ignore') or opts.get('all'):
         showfiles = kwfiles, kwunknown
     else:
         showfiles = [], []
     if opts.get('all') or opts.get('ignore'):
-        showfiles += ([f for f in files if f not in kwfiles],
+        showfiles += ([f for f in tracked if f not in kwfiles],
                       [f for f in unknown if f not in kwunknown])
     for char, filenames in zip('KkIi', showfiles):
         fmt = (opts.get('all') or ui.verbose) and '%s %%s\n' % char or '%s\n'



More information about the Mercurial-devel mailing list