Comment 1 for bug 486535

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 486535] [NEW] BzrDir._find_or_create_repository KeyError (bzr+ssh + stacking policy?)

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

Matt Nordhoff wrote:
> Public bug reported:
>
>>>> from bzrlib.bzrdir import BzrDir
>>>> br = BzrDir.create_branch_and_repo('bzr+ssh://bazaar.staging.launchpad.net/~mnordhoff/bzr/test/')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/home/ubuntu/co/bzr/bazaar/bzr/bzr.dev/bzrlib/bzrdir.py", line 423, in create_branch_and_repo
> bzrdir._find_or_create_repository(force_new_repo)
> File "/home/ubuntu/co/bzr/bazaar/bzr/bzr.dev/bzrlib/bzrdir.py", line 490, in _find_or_create_repository
> return policy.acquire_repository()[0]
> File "/home/ubuntu/co/bzr/bazaar/bzr/bzr.dev/bzrlib/bzrdir.py", line 3661, in acquire_repository
> possible_transports=[self._bzrdir.root_transport])
> File "/home/ubuntu/co/bzr/bazaar/bzr/bzr.dev/bzrlib/bzrdir.py", line 2442, in require_stacking
> not self.repository_format.supports_external_lookups):
> File "/home/ubuntu/co/bzr/bazaar/bzr/bzr.dev/bzrlib/remote.py", line 500, in supports_external_lookups
> self._ensure_real()
> File "/home/ubuntu/co/bzr/bazaar/bzr/bzr.dev/bzrlib/remote.py", line 586, in _ensure_real
> self._network_name)
> File "/home/ubuntu/co/bzr/bazaar/bzr/bzr.dev/bzrlib/registry.py", line 263, in get
> r = Registry.get(self, format_string)
> File "/home/ubuntu/co/bzr/bazaar/bzr/bzr.dev/bzrlib/registry.py", line 173, in get
> return self._dict[self._get_key_or_default(key)].get_obj()
> File "/home/ubuntu/co/bzr/bazaar/bzr/bzr.dev/bzrlib/registry.py", line 191, in _get_key_or_default
> raise KeyError('Key is None, and no default key is set')
> KeyError: 'Key is None, and no default key is set'
>
> Note: The bzrdir is created just fine (obviously -- it fails on the line
> after that).
>
> It works fine if I pass a format argument.
>
> I can't reproduce this pushing to my own bzr+ssh server. It happens
> consistently on LP, though.

^- So I would assume LP fails because of the stacking policy, which you
almost certainly don't have set up on your own server.

I'm guessing the problem is that '_network_name' is not initialized yet,
so it is passing in None, and there isn't a default for that object.

I would offer that perhaps "create_branch_and_repo" with no format isn't
what you want to be doing. What format would it be creating? Would it be
compatible with whatever else you are doing? Stacking is checking
formats, so that it can make sure that you are allowed to stack the new
format on top of the old format.

 status confirmed
 importance low

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

iEYEARECAAYFAksemlcACgkQJdeBCYSNAAOwRACgofu39nXp1TTWLDHTfY61Hkrq
odEAnA8Ow7xFV/rDnKff/D+6JEytZNuj
=muQa
-----END PGP SIGNATURE-----