[PATCH] fix_bytesmod: fix defects in fix_bytesmod so it produces working code
Augie Fackler
raf at durin42.com
Tue Feb 4 17:12:54 CST 2014
# HG changeset patch
# User Augie Fackler <raf at durin42.com>
# Date 1391555360 18000
# Tue Feb 04 18:09:20 2014 -0500
# Node ID 2c37f5dfb5a0c5af03aaca625ab792064956e188
# Parent 384236e0642279ab6a93d72e2ad6d9b74fb5108c
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.
diff --git a/contrib/hgfixes/fix_bytesmod.py b/contrib/hgfixes/fix_bytesmod.py
--- a/contrib/hgfixes/fix_bytesmod.py
+++ b/contrib/hgfixes/fix_bytesmod.py
@@ -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
-
More information about the Mercurial-devel
mailing list