[RFC] Failing to push to existing non-branch directories.
Wouter van Heyst
larstiq at larstiq.dyndns.org
Sat Sep 2 16:41:49 BST 2006
While pushing there are two common cases we decently handle:
1a) The target dir doesn't exist. Create it and happily push everything.
1b) Some parent directories also don't exist. Create them if
--create-prefix is given, complain and bail if not.
2) The target is the same branch, but older. Update it.
Between case 1 and 2 there are several other situations one can
encounter. With Launchpad hosted branches, initial pushes get
interrupted from time to time. When people try to resume, bzr will
loudly fail. Usually some part of the bzrdir hierarchy has been written,
but not enough for bzr to recognize it as a valid branch.
I'm trying to clean up bzr's handling of these alternative situations.
I want to list the different cases that we will want to handle, and get some
feedback on the best way to proceed.
One complicating factor is that Launchpad does not allow you to remove the
branch directory:
https://launchpad.net/products/launchpad-bazaar/+bug/34540
Different situations:
1a) Dir does not exist (pretty obvious, create it, and fill it with the new contents)
1b) Neither do parent directories. (create it only if create_prefix flag is set)
2) Dir exists
2a) Already a Branch present. Also pretty obvious. Just try to update the branch.
2b) Directory is empty. Rather than puking, we probably should act like we created the directory.
There is a race condition of 2 people pushing to the same location. Is it worth worrying about it?
2c) There exists a .bzr/ directory, but it doesn't seem to be valid.
Nuke it? Try to update it in place? Require a flag to avoid race
conditions?
2d) There is no .bzr/ directory, but there are other files present.
1a, 1b, and 2a are what we do already. 2b,c,d are the ones that need to be resolved.
Also, I'm planning on using this code to update 'bzr init' and 'bzr branch' so
that they can also have a '--create-prefix' flag. So we need to consider those
cases as well. (Like for 2d, you don't want to delete the files since you are
probably about to start versioning them if this is a local branch).
Wouter van Heyst
PS> See also:
https://launchpad.net/products/launchpad-bazaar/+bug/53340
https://launchpad.net/products/bzr/+bug/45504
https://launchpad.net/products/bzr/+bug/30576
More information about the bazaar
mailing list