Changeset 994 in tailor


Ignore:
Timestamp:
11/14/05 03:18:51 (8 years ago)
Author:
Brendan Cully <brendan@…>
Hash name:
20051114021851-0ae3a-a4e72c281dd07ac93669dd21e99236aaf758ee6a
Message:

Ensure str() doesn't get handed a unicode changeset

I don't do a lot of python, so I may be misdiagnosing this bug, but I
get a UnicodeEncodeError? at Tailorizer.applyable on the debug line
when tailorizing a source with non-ascii log messages on a UTF-8
terminal. It appears that str() expects a str function it calls to
return a plain (not unicode) string. Could possibly be an OS X issue.

The particular test was tailorizing the bzr repository from bzr to git
or hglib, with changeset messages apparently in macroman, on a UTF-8
terminal. This problem is made more annoying by the fact that bzr no
longer seems to be able to resume (_b undefined in the upgrade path).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vcpx/changes.py

    r912 r994  
    143143 
    144144    def __str__(self): 
     145        import codecs 
     146 
    145147        s = [] 
    146148        s.append('Revision: %s' % self.revision) 
     
    157159                s.append('%s: %s' % (ak, ','.join(entries))) 
    158160        s.append('Log: %s' % self.log) 
    159         return '\n'.join(s) 
     161        s = '\n'.join(s) 
     162        if isinstance(s, unicode): 
     163            s = s.encode('ascii', 'replace') 
     164        return s 
    160165 
    161166    def applyPatch(self, working_dir, patch_options="-p1"): 
Note: See TracChangeset for help on using the changeset viewer.