[merge] make RevisionSpec_revid always return a str
John Arbash Meinel
john at arbash-meinel.com
Thu Mar 8 19:58:37 GMT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Marien Zwart wrote:
> 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?
>
It is what I would do. Other people are allowed to give differing
opinions, though.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF8GrtJdeBCYSNAAMRAvRIAKCVx54sH1kSzcxez73GAh/iVTNmMgCfaEDQ
m/BPBOHEVbSlsIv+qWuCr2Y=
=vvAA
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list