[PLUGIN] rsync-push rsync-pull

John Arbash Meinel john at arbash-meinel.com
Tue Jun 21 23:10:28 BST 2005


Well, because I wanted to stay up-to-date on a remote connection, I
looked into the contrib/upload-bzr.dev script, and created a plugin from
that.

The attached scripts should be put into your plugin path. They are meant
to be in their own directory, for the future plugin version which will
load modules.

In the meantime you can do what I do:
mkdir ~/.bzr.conf/plugins
export BZRPLUGINPATH="~/.bzr.conf/plugins"
# Also add the above to .bashrc
cd ~/.bzr.conf/plugins
mkdir bzr_rsync
#copy these to files into that directory
echo "from bzr_rsync import *" >> extra_plugins.py

That will cause them to be loaded using the current plugin code.
Actually, if you do it this way, bzr_rsync can also be a symlink to the
appropriate directory.

Anyway, these provide the following commands:
bzr rsync-pull
bzr rsync-push

They will create the files .bzr/x-rsync-location and .bzr/x-rsync-revision
Which keep track of the last push/pull location and last push/pull revision.

I would love to integrate this better with "bzr pull" that Aaron Bentley
wrote, but the protocols are different. You cannot access branch
information over rsync, but rsync is much faster to download than the
current RemoteBranch code.

And currently there is no "bzr push" to a RemoteBranch.

I have some safety in that I check to make sure you have not committed
to the local directory before I do the rsync-pull, and I make sure you
actually have changes you want to upload before I let you do rsync-push.

But it certainly is possible to lose data if you force an rsync-pull and
have local modifications that get deleted.
Also, if you have created a local modification, and someone else has
already pushed to your remote repository, I do not detect that, so your
rsync will overwrite theirs.

This is really meant as a way for a single developer to keep his code in
a remote repository, and move between machines. rsync-push whenever you
make changes, and rsync-pull before you start.
For myself, I am planning to override "bzr commit" so that it does an
rsync-push afterwards.

I also created a simple command for bzr rsync-pull-bzr, which will
update the current running bzr with either the official sources, or
whatever source you have initialized it to.

Long term, bzr pull is the better way to go, but for the moment, this is
faster, remembers permissions, and allows "bzr push". It just is more
dangerous, as you can lose changes if you are not careful.

John
=:->

PS> These are also available on my bzr repository at:
http://bzr.arbash-meinel.com/plugins/bzr-rsync
as is my other changeset plugins at
http://bzr.arbash-meinel.com/plugins/bzr-changeset

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: rsync_update.py
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20050621/a59bed6d/attachment.diff 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: __init__.py
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20050621/a59bed6d/attachment-0001.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050621/a59bed6d/attachment.pgp 


More information about the bazaar mailing list