changeset 20399:74daabdf5ab5

fix_bytesmod: fix defects in fix_bytesmod so it produces working code Prior to this change, the fixer did not always add the py3kcompat import to files, and did not manage to blacklist itself.
author Augie Fackler <raf@durin42.com>
date Tue, 04 Feb 2014 18:09:20 -0500
parents 2bc520bd0ce0
children f0137d994c83
files contrib/hgfixes/fix_bytesmod.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/hgfixes/fix_bytesmod.py	Thu Feb 06 02:19:38 2014 +0100
+++ b/contrib/hgfixes/fix_bytesmod.py	Tue Feb 04 18:09:20 2014 -0500
@@ -33,9 +33,10 @@
               '''
 
     def transform(self, node, results):
-        if self.filename in blacklist:
-            return
-        elif self.filename == 'mercurial/util.py':
+        for bfn in blacklist:
+            if self.filename.endswith(bfn):
+                return
+        if not self.filename.endswith('mercurial/py3kcompat.py'):
             touch_import('.', 'py3kcompat', node=node)
 
         formatstr = results['formatstr'].clone()
@@ -60,4 +61,3 @@
 
         call = Call(Name('bytesformatter', prefix=' '), args)
         return call
-