[MERGE][0.14] Allow 'bzr push' to push onto existing dir

John Arbash Meinel john at arbash-meinel.com
Wed Feb 7 19:31:20 GMT 2007


Robert Collins wrote:
> Robert Collins has voted +1 (conditional).
> Status is now: Conditionally approved
> Comment:
> I think perhaps that alexanders error indicates a bug though - it may be
> that --use-existing prevents the code path for reuse of a bzrdir control
> dir working correctly - or may be in the wrong order.
> 

I can reproduce Alexander's problem if I do:

mkdir -p ~/tmp/test-push/.bzr
./bzr push --use-existing ~/tmp/test-push/

Because there is a '.bzr' directory, but there isn't a valid BzrDir
there. (BzrDirFormat.initialize() expects to be able to create the .bzr
directory)

I'm thinking 3 things

1) If the target directory has a .bzr but we can't understand it, I
really don't want to continue. If we can't even read the
.bzr/branch-format file, it really is an unknown. So I have the feeling
it is correct to error out.

2) We could come up with a better error message, though I'm not sure
where it should be. It seems like BzrDirFormat.initialize() should trap
FileExists, and raise something that gives the user more information.
Because otherwise we don't really know why FileExists was being raised.
(I suppose we could inspect the exception and re-raise in builtins.py)

3) Because of 1, there is still a window during 'bzr push' that a ^C
will leave the target a bit broken. It is a lot smaller now, because it
is just the time while BzrDir is initializing the target.

I suppose one possibility would be to have BzrDir.initialize() create a
temporary directory (.bzr-initialize.XXXXX) which then gets renamed into
place. Without .XXXX (random data) you would have the same problem, just
moved to .bzr-initialize, though I would feel better about nuking an
intermediate that we know is incomplete.


I think that the current code is still better than existing, so I'd like
to get it merged. Since I think I've tracked down the problem to
something we can deal with later, I'm going to go ahead and submit. I'll
be happy to update as we decide what to do.

John
=:->



More information about the bazaar mailing list