[MERGE] Accept ..\ as a path in revision specifiers
John Arbash Meinel
john at arbash-meinel.com
Sun Aug 26 20:04:23 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Daniel Watkins wrote:
> On Sat, 2007-08-25 at 20:26 +0200, Lukáš Lalinský wrote:
>> (And another patch that removed usage of %r in error messages will
>> follow. I think 'No namespace registered for string: "\bzr.dev"' would
>> look much nicer and the u must be really confusing to people who don't
>> know Python.)
> My fix for bug #129791 should have got a lot of these (though I wasn't
> aiming for them specifically so I won't have got all of them).
>
Just as a quick comment on this. I haven't looked over your bundle, but one of
the reasons to use '%r' instead of '%s' is because of non-ascii characters. I
don't know if any of the changes you made are affected by this or not.
One of my original goals was to have paths printed in Unicode if possible, and
fall back to URL if we couldn't encode them properly. (All paths can be escaped
into URLs which are 7-bit strings, but seeing:
http://host/myféåtüré
Is probably better for people than
http://host/myf%C3%A9%C3%A5t%C3%BCr%C3%A9
(That is what urlutils.unescape_for_display() tries to do)
Anyway, as I said, I haven't looked at your patch closely, but if you have
class Test(object):
def __str__(self):
return 'Foo is not a valid path %s' % (u'påth',)
t = Test()
str(t)
You get a UnicodeEncodeError, because it tries to cast the returned Unicode
object into a plain string (and obviously cannot do that)
If you change it to '%r' you get:
"Foo is not a valid path u'p\\xe5th'"
Which is a bit ugly, but it is better than a traceback.
Just something to be careful about when you are changing %r => %s, since they
have more effect than just showing things differently.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFG0c63JdeBCYSNAAMRAifbAJ45tj2NhyGd0Tf1msKRL2yhcwjQGACfUESV
NcRScFZtQRhNwnAE7klEPtM=
=12uO
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list