Short "f" for "filename" iteration variable decodefilter
authorChristian Ebert <blacktrash@gmx.net>
Thu, 14 Dec 2006 16:27:30 +0100
branchdecodefilter
changeset 13 d6c0f391a662
parent 12 d9c4fc735963
child 14 b60345141aa5
Short "f" for "filename" iteration variable
hgkw/pretxnkw.py
--- a/hgkw/pretxnkw.py	Thu Dec 14 16:25:12 2006 +0100
+++ b/hgkw/pretxnkw.py	Thu Dec 14 16:27:30 2006 +0100
@@ -34,20 +34,19 @@
 
     re_kwcheck = re.compile(r'[$]Hg: (.*?),v.*?\$')
 
-    for filename in files:
+    for f in files:
 
-        data = repo.wfile(filename).read()
+        data = repo.wfile(f).read()
 
         # check for keywords with incorrect filename
         # eg. if you forgot to update filename manually after "hg mv"
         invalids = [m for m in map(str, re_kwcheck.findall(data))
-                if m != filename]
+                if m != f]
         if invalids:
             invalids = ['%sHg: %s,v$' % ('$', i) for i in invalids]
             ui.warn(_('%d invalid keyword filenames in file %s:\n'
                 '%s\nplease correct to %sHg: %s,v$\n'
-                % (len(invalids), filename, ', '.join(invalids), '$', filename)
-                ))
+                % (len(invalids), f, ', '.join(invalids), '$', f)))
             return True
 
         # substitute <Dollar>(Hg|Id): <basename>,v.*<Dollar>
@@ -55,9 +54,9 @@
 
         if kwct:
             # backup file and write with expanded keyword
-            ui.note(_('expanding keywords in %s\n' % filename))
-            absname = repo.wjoin(filename)
+            ui.note(_('expanding keywords in %s\n' % f))
+            absname = repo.wjoin(f)
             util.copyfile(absname, absname+'~')
-            repo.wfile(filename, 'w').write(data)
+            repo.wfile(f, 'w').write(data)
 
     return False