help: shared mainline over ssh

Eric Siegerman lists08-bzr at
Tue Aug 11 15:41:53 BST 2009

On Sun, 2009-08-09 at 22:24 +0200, Emanuele Olivetti wrote:
> I need to set up a repository with shared mainline to let the users
> commit their changes locally when they are offline and pull/push from
> time to time (e.g., once/twice a day) to the mainline to share their
> work.

It sounds as though what you're aiming for is more a "centralized
with local commits" workflow, but without requiring users to type
"commit --local" most of the time or to do the unbind/rebind
dance.  Is that correct?  On the assumption that it is, most of
your plan looks OK, with the following exceptions.

> [after having committed changes locally]
> Then pull
> bzr pull sftp://<login>

If a user has indeed committed local changes, and there are also
new revisions on the mainline waiting to be pulled, this will
fail, complaining that the branches have diverged.  The user will
need to merge instead; then of course, resolve any conflicts,
retest, and commit.  (If there are no local changes, the pull
will succeed.)

One possibility is to have your users use "bzr merge --pull"
instead.  This will pull if possible, but merge if necessary.
The catch is that if it decided to merge, the user has to
resolve/test/commit, but if it decided to pull, they don't; so
they have to look carefully at bzr's output, or follow the merge
command with a "bzr stat", to decide which state they're in.

> and push
> bzr push sftp://<login>
> when you can.

If someone else has pushed changes since the user's last merge or
pull, this will also fail with a branches-diverged complaint.
The user will have to repeat the previous step ("merge --pull" or
whatever).  (This is the classic non-locking-source-control race
condition; it's not unique to bzr by any means.)

As an aside, there's another problem too, but it has nothing to
do with bzr pe se:
> # now I'm on to the server...
> chmod -R g+rwxs,o-rwx .  # the sticky bit will ensure same
> for future files created by other users

Umm, are you *sure* you want to set all the files setgid?  Far
safer would be to do that only for the directories:
    chmod -R g+rwx,o-rwx .
    find . -type d | xargs chmod g+s

Hope this helps.

  - Eric

More information about the bazaar mailing list