views:

93

answers:

1

I've got a bunch of little projects in a bunch of different directories on a bunch of different computers. I also have a remote server that I can happily bzr+ssh to.

It seems that it should be really easy to (1) put a directory under bzr control ("bzr init ; bzr add"--okay, no worries); (2) place that directory on the remote server ("bzr push" works, of course); (3) convert the whole thing to a shared repository (um...?); (4) make the server have the master copy (um?...); and (5) be able to check it out in standard SVN-style format from somewhere else.

Every tutorial I've seen goes about this in the wrong ("I am the server administrator") direction: it first tells you to wave your magic init-repo wand while logged into the remote server, and then move files over, etc. etc.; but the whole point is that I don't want to do all that busywork a bunch of times.

I've seen people do this the "right" way--four or five lines and it's all set up, starting with a directory full of files on the local machine, and ending with that same directory still there acting as a checkout of a remote shared repository (and as a bonus, doing all the remote work via bzr+ssh so you never have to log in remotely in a separate shell). How do they do it?

+2  A: 

I would say that you have steps (2) and (3) reversed. I also assume that you have sftp access to a directory on the remote machine which will hold the shared repositories, say sftp://rkerr@server/home/source.

I can't test this, but I think it would go something like:
(1) bzr init; bzr add
(2) bzr init-repo --no-trees sftp://rkerr@server/home/source/sharedRepo/
(3) bzr push --remember sftp://rkerr@server/home/source/sharedRepo/branchName
(4) start calling the server version the master copy* :)
(4.5) login elsewhere
(5) bzr checkout sftp://rkerr@server/home/source/sharedRepo/branchName

* Other useful things to do would be to change the *_location properties in .bzr/branch/branch.conf of the initial branch. Really though, the whole point of DVCS is that no branch really needs to be the "master" branch. Setting locations just means that Bazaar can intelligently guess which branch you want to push, merge, pull, etc.

Adam Glauser
That's definitely an improvement over what I'm doing now, thanks! I'd also need to bind to the remote copy after the push, no? (At least if I want the CVS-style "you may not commit unless the server is updated" mode, which in this case I do, as in part I'm doing this for backup purposes.)
Rex Kerr
Yes, you are correct about binding to the server branch. Once the branch is bound, the remote commit must succeed before the local commit succeeds.
Adam Glauser