[Fwd: Re: [qbzr] Request for Help with developing for QBzr]

Andrew Bennetts andrew.bennetts at canonical.com
Wed Nov 18 12:04:54 GMT 2009


Alexander Belchenko wrote:
> Dear core devs and Andrew Bennetts in particular,
> 
> Can you suggest us something about the problem below.

I think I see the problem:

[...]
>   File "bzrlib\reconfigure.pyo", line 332, in apply
>   File "bzrlib\remote.pyo", line 501, in initialize
>   File "bzrlib\remote.pyo", line 494, in _vfs_initialize
>   File "bzrlib\remote.pyo", line 540, in open
> AssertionError: <bzrlib.bzrdir.BzrDirMeta1 object at 0x015806D0> is not a RemoteBzrDir

As far as I can tell RemoteRepositoryFormat.initialize can't work with
non-RemoteBzrDir objects, even though it tries to.  If it is passed a
non-RemoteBzrDir, it immediately calls self._vfs_initialize.  The first half of
_vfs_initialize looks fine (it will create the repository from the bzrdir via
non-smart methods), but then if the result is not a RemoteRepository (and I
don't see how it could be, the point of this method is to bypass the Remote*
proxies) it will call self.open, which assumes that the bzrdir is a
RemoteBzrDir — hence the assertion.

We probably are missing a per-repository test that exercises this case, it
probably needs to look something like this:

    repo = self.make_repository('orig')
    repo_fmt = repo._format
    if isinstance(repo_fmt, PreSplitOutRepositoryFormat):
        bzrdir_fmt = repo_fmt._matchingbzrdir
    else:
        bzrdir_fmt = bzrdir.BzrDirMetaFormat1()
	bzrdir_fmt.repository_format = repository.network_format.registry(repo_fmt.network_name())
    a_bzrdir = bzrdir_fmt.initialize('new')
    repo_fmt.initialize(a_bzrdir)

(In case it's not clear, this seems like a reasonable case to support, i.e. I
believe the bug lies in remote.py, not reconfigure.py.)

We probably have tests similar to this that use repo_fmt._matchingbzrdir, but
that won't try non-RemoteBzrDirs with RemoteRepositoryFormat.

Possibly we could add a test for this specific scenario to the reconfigure tests
too, but that's probably unnecessary.

It's late here so I'm not sure what a good fix is, but I think with the help of
a failing test and a good night's sleep one will probably become clear :)

-Andrew.




More information about the bazaar mailing list