[MERGE] Make cmd_branch check the destination before doing any I/O on the source.

John Arbash Meinel john at arbash-meinel.com
Thu Jul 6 15:06:56 BST 2006


Michael Ellerman wrote:
> Hi list,
> 
> This rearranges some logic in cmd_branch so that we check the destination
> before doing any I/O on the source branch. This is nice for branching
> from a remote to a local branch on slow links, if there's something wrong
> with the destination you find out quickly. A test is included.
> 
> cheers
> 

Good but not great. The reason we connect to the remote branch first is
that we don't want to create the local directory if the user types the
wrong remote path. Which is probably more common than a user running
into a local error.

Probably it would be okay if we removed the directory if we failed to
connect to the remote branch.

Otherwise you probably tend to get this:

$ bzr branch http://boo/bar
bzr: ERROR: Could not connect to http://boo/bar

*Oops it is foo bar

$ bzr branch http://foo/bar
bzr: ERROR: Target directory 'bar' already exists

* grumble grumble
$ ls bar
$ ls -a bar
* there is nothing there (grumble)

$ rm bar
$ rmdir bar
$ bzr branch http://foo/bar


(grumble added for effect, but I do think it would be more frustrating)

So probably the simplest fix is to just delete the directory if we fail
to branch (we already have a delete_tree() in the case that the revision
doesn't exist in the source branch).
And then add a test that run_bzr('branch', 'non-existant') doesn't
create the target directory.

Also, I would like to see the test use 'run_bzr()' instead of 'runbzr()'.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060706/7b291cda/attachment.pgp 


More information about the bazaar mailing list