Patchwork fix_bytesmod: fix defects in fix_bytesmod so it produces working code

login
register
mail settings
Submitter Augie Fackler
Date Feb. 4, 2014, 11:12 p.m.
Message ID <2c37f5dfb5a0c5af03aa.1391555574@augie-macbookair>
Download mbox | patch
Permalink /patch/3477/
State Accepted
Headers show

Comments

Augie Fackler - Feb. 4, 2014, 11:12 p.m.
# HG changeset patch
# User Augie Fackler <raf@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.
Matt Mackall - Feb. 5, 2014, 12:03 a.m.
On Tue, 2014-02-04 at 18:12 -0500, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <raf@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

Queued for default, thanks.
Augie Fackler - Feb. 8, 2014, 9:18 p.m.
On Tue, Feb 04, 2014 at 06:03:28PM -0600, Matt Mackall wrote:
> On Tue, 2014-02-04 at 18:12 -0500, Augie Fackler wrote:
> > # HG changeset patch
> > # User Augie Fackler <raf@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
>
> Queued for default, thanks.

Did you drop this for some reason? Not seeing it in main.

>
> --
> Mathematics is the supreme nostalgia of our time.
>
>
Matt Mackall - Feb. 9, 2014, 10:32 p.m.
On Sat, 2014-02-08 at 16:18 -0500, Augie Fackler wrote:
> On Tue, Feb 04, 2014 at 06:03:28PM -0600, Matt Mackall wrote:
> > On Tue, 2014-02-04 at 18:12 -0500, Augie Fackler wrote:
> > > # HG changeset patch
> > > # User Augie Fackler <raf@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
> >
> > Queued for default, thanks.
> 
> Did you drop this for some reason? Not seeing it in main.

Got lost while trying to fix up test-module-imports failures. Requeued,
thanks.

Patch

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
-