[MERGE] Perform creation of BzrDirMetaFormat1 control directories using an RPC where possible. (Robert Collins)
andrew.bennetts at canonical.com
Thu Feb 19 04:39:07 GMT 2009
Robert Collins wrote:
> This changes creation of .bzr control directories on smart transports to
> use the existing RPC when possible.
> This drops 13 round trips of initial-push use cases, dropping the
> ratchet for initial push scenarios and also adds a close-to-the-code
> unit test to make sure this specific case doesn't regress.
> === modified file 'bzrlib/bzrdir.py'
> @@ -1707,7 +1707,29 @@
> def initialize_on_transport(self, transport):
> """Initialize a new bzrdir in the base directory of a Transport."""
> - # Since we don't have a .bzr directory, inherit the
> + try:
> + # can we hand off the request to the smart server rather than using
> + # vfs calls?
> + client_medium = transport.get_smart_medium()
> + except errors.NoSmartMedium:
> + return self._initialize_on_transport_vfs(transport)
> + else:
Hmm. Will this work right over vfs-only HTTP? Perhaps this needs to do a
similar dance to probe_transport, which checks client_medium.should_probe()
etc... Not that writing to non-smart HTTP is a very useful thing to do, but
it'd be good to check that this case still gets a sane error.
The “tweak” I want is:
a) verify that an attempt to initialize_on_transport with a plain HTTP server
gives a sane error, and
b) add a NEWS entry for the improvement :)
More information about the bazaar