[MERGE][Bug #129791] Error output is sometimes malformed

John Arbash Meinel john at arbash-meinel.com
Thu Aug 23 16:16:27 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aaron Bentley wrote:
> Daniel Watkins wrote:
>> Attached is a bundle which adds quotes around filenames when at the end
>> of a sentence in an error (to avoid the current directory being referred
>> to as ..).
>>  class InvalidRevisionId(BzrError):
> 
>> -    _fmt = "Invalid revision-id {%(revision_id)s} in %(branch)s"
>> +    _fmt = "Invalid revision-id \"{%(revision_id)s}\" in \"%(branch)s\""
> 
> bb:resubmit
> 
> Quoting the revision_id is overkill.  The {} are already provided as
> delimiters.
> 
> 
>> -    _fmt = "The file id %(file_id)s is not present in the tree %(tree)s."
>> +    _fmt = "The file id \"%(file_id)s\" is not present in the tree \"%(tree)s\"."
> 
> Are you sure that tree isn't something like WorkingTree("foo/bar/baz")
> already?  Also, it would be nicer to convert it to a single-quoted
> string, so that double-quotes can appear with no escaping.
> 
>> -    _fmt = ("The file id %(file_id)r is not present in the repository"
>> -            " %(repository)r")
>> +    _fmt = ("The file id \"%(file_id)r\" is not present in the repository"
>> +            " \"%(repository)r\"")
> 
> I'm pretty sure that repositories always show as Repository("foo/bar/baz")
> 
>> @@ -468,17 +468,17 @@
> 
>>  class NotADirectory(PathError):
> 
>> -    _fmt = "%(path)r is not a directory %(extra)s"
>> +    _fmt = "\"%(path)r\" is not a directory %(extra)s"
> 
> This is already quoted, because %r is used.  It doesn't hurt to manually
> quote it, but change it to %s please.
> 
> 
>>  class NotInWorkingDirectory(PathError):
> 
>> -    _fmt = "%(path)r is not in the working directory %(extra)s"
>> +    _fmt = "\"%(path)r\" is not in the working directory %(extra)s"
> 
> %r => %s, " -> '

I'm hoping you mean:
_fmt = '"%(path)s" is not in the working directory %(extra)s'

And not
_fmt = "'%(path)s' is not in the working directory %(extra)s"

The former is preferred simply because Windows cmd.exe does not recognize ' as
being a special character. So:

  bzr commit -m 'test this out'
tries a message of "'test" and the files "this" and "out'"

Also appropriate for things like:
   cd 'path to'
versus
   cd "path to"

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGzaTKJdeBCYSNAAMRAl37AJ0Y3Pfa3pzQb6w1DTCJfeZfqVvviQCeLcss
kEDO4ezDJtUB4xYjwTWUmY8=
=jyC7
-----END PGP SIGNATURE-----



More information about the bazaar mailing list