RFC: ERROR: Unsupported branch format (improve message)

John Arbash Meinel john at arbash-meinel.com
Thu Mar 22 14:26:50 GMT 2007


Jari Aalto wrote:
> I happened to have very old repository which I hadn't had touched for a
> long time:
> 
>     $ bzr init
>     bzr: ERROR: Unsupported branch format: Bazaar-NG branch, format 0.0.4
> 
> SUGGESTION
> 
> Make the error message read:
> 
>     bzr: ERROR: Unsupported branch format: Bazaar-NG branch, format 0.0.4 
>     bzr: See also command 'bzr upgrare'
> 
> Jari

Well, I would hope it would say "bzr upgrade".

However, this doesn't work all the time. Because *new* branch formats
will give old clients the same error, and 'bzr upgrade' won't help there.

The only format that falls under this is that specific 0.0.4 format.
Which is the only format we don't actually operate with, but we do allow
you to upgrade. (We will warn with other formats, but we still work,
only 0.0.4 requires an upgrade).

It should be pretty easy to do.

The code has 2 checks for whether we don't know anything about the
format, or whether we just don't support it now.

Specifically, in bzrlib/bzrdir.py you can see 'probe_transport' at
around line 1180 is doing:

try:
  return klass._formats[format_string]
except KeyError:
  raise errors.UnknownFormatError(format=format_string)

^ that is the "I don't know anything about this format" error.

And then in BzrDir.open_from_transport we have:


format = BzrDirFormat.find_format(transport)
BzrDir._check_supported(format, _unsupported)
return format.open(transport, _found=True)

And it is in BzrDir._check_supported where we have:

if not allow_unsupported and not format.is_supported():
    # see open_downlevel to open legacy branches.
    raise errors.UnsupportedFormatError(format=format)

So since we already have 2 different errors, we should be able to use
the attached patch.

John
=:->


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: unsupported.diff
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20070322/44561850/attachment-0001.diff 


More information about the bazaar mailing list