[merge] make RevisionSpec_revid always return a str

Marien Zwart marienz at gentoo.org
Thu Mar 8 19:36:07 GMT 2007


On Thu, Mar 08, 2007 at 02:10:51PM -0500, John Arbash Meinel wrote:
> So it would be nice to add
> 
> self.assertInHistory(3, rev_id, 'revid:'+rev_id)
> 
> I'm not going to be a stickler for it, because adding 'revid:' makes 
> from_string() very much a user-facing api.

I did not add that because it makes it necessary to do an
isinstance(self.spec, unicode) check in _match_on (because if someone
passes in a str containing non-ascii characters and you call
.encode('utf-8') on it python tries to decode it to unicode with the
default encoding before trying to encode it again using the utf-8
encoding). I thought it would not be a good idea to add such a check
if this is supposed to operate only on unicode objects (the check
would be hiding api violations).

So just to confirm: an explicit isinstance check for unicode before
trying to convert to utf-8 is ok here?

-- 
Marien.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070308/1c961ad3/attachment-0001.pgp 


More information about the bazaar mailing list