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

Aaron Bentley aaron.bentley at utoronto.ca
Thu Aug 23 15:57:34 BST 2007


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

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, " -> '

>  class DirectoryNotEmpty(PathError):
>  
> -    _fmt = "Directory not empty: %(path)r%(extra)s"
> +    _fmt = "Directory not empty: \"%(path)r\"%(extra)s"

%r => %s, " -> '


>  
>  
>  class ReadingCompleted(BzrError):
> @@ -495,22 +495,22 @@
>  
>  class ResourceBusy(PathError):
>  
> -    _fmt = "Device or resource busy: %(path)r%(extra)s"
> +    _fmt = "Device or resource busy: \"%(path)r\"%(extra)s"

%r => %s, " -> '

>  class PermissionDenied(PathError):
>  
> -    _fmt = "Permission denied: %(path)r%(extra)s"
> +    _fmt = "Permission denied: \"%(path)r\"%(extra)s"

%r => %s, " -> '

>  class InvalidURL(PathError):
>  
> -    _fmt = "Invalid url supplied to transport: %(path)r%(extra)s"
> +    _fmt = "Invalid url supplied to transport: \"%(path)r\"%(extra)s"

%r => %s, " -> '

> @@ -556,7 +556,7 @@
>  
>  class PathNotChild(PathError):
>  
> -    _fmt = "Path %(path)r is not a child of path %(base)r%(extra)s"
> +    _fmt = "Path \"%(path)r\" is not a child of path \"%(base)r\"%(extra)s"

%r => %s, " -> '

> @@ -572,7 +572,7 @@
>  
>  class InvalidNormalization(PathError):
>  
> -    _fmt = "Path %(path)r is not unicode normalized"
> +    _fmt = "Path \"%(path)r\" is not unicode normalized"

%r => %s, " -> '


Etc, etc, etc.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGzaBe0F+nu1YWqI0RAhCpAJwIIf1K1mG5yyHPLdUQyhS5ib+YSgCfXtTZ
lMUrjqA4frBRdLT0U1haqa4=
=E/T4
-----END PGP SIGNATURE-----



More information about the bazaar mailing list