Upload your websites with bzr-upload
I was lucky enough to be able to attend the Bazaar Sprint back in March, mostly thanks to Canonical sponsoring my entire trip across the globe ![]()
The sprint was interesting in all sorts of ways, and it got me working on several projects (some of which I'll talk about in future posts), but there was one in particular that amazed me how fast it was put together. Bzr-upload.
It all started one night, while sitting across the table from Vincent Ladeuil, the guy who basically wrote transports in Bazaar, and I started complaining about how I had to work around bazaar to make it fit into my daily work flow (doing web development).
The problem was simple: bzr doesn't update the working tree (the actual files) remotely, so there was no simple way for me to upload the websites I worked on a daily basis.
Long story short, Vincent asked some questions, sat down, wrote tests, wrote code to work with those tests (TDD, FTW), and after some fiddling, we can now upload websites (and anything else, actually) using bzr's knowledge of what we've changed, and it's solid transport libraries (ftp, sftp).
So... how does this work? Simple.
Assuming you already have bzr installed, fire up a terminal and do:
bzr checkout lp:bzr-upload ~/.bazaar/plugins/upload
Now that we have the plugin installed, go to the branch containing your website, and with a simple:
beuno@beuno-laptop:/mywebsite$ bzr upload sftp://beuno@host/path/to/http
No uploaded revision id found, switching to full upload
Uploading bar
Uploading foo
Done!
Did more work?
beuno@beuno-laptop:/mywebsite$ bzr ci -m'Random bug fix'
Committing to: /mywebsite/
modified foo
Committed revision 2.
beuno@beuno-laptop:/mywebsite$ bzr upload
Using saved location: sftp://beuno@host/path/to/http
Uploading foo
That's it!
bzr-upload will remember the last revision you uploaded, and make sure it only sends what you've changed.
Project's page: https://launchpad.net/bzr-upload
Comments, feedback, patches, etc are very welcome.
Pages
Categories
Blogroll
Archive
- March 2013
- February 2013
- October 2012
- June 2012
- May 2012
- April 2012
- February 2012
- December 2011
- November 2011
- October 2011
- June 2011
- May 2011
- April 2011
- March 2011
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- April 2010
- March 2010
- February 2010
- November 2009
- October 2009
- July 2009
- June 2009
- May 2009
- February 2009
- January 2009
- December 2008
- November 2008
- September 2008
- August 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
June 21st, 2008 - 05:08
Can you get bzr commit to automatically do the upload for you?
AFAIR if you have a bzr checkout or use bzr bind, then bzr commit will push your changes to the remote repository (just not update the working dir). Is there any way to hook into that?
Currently I maintain my “work” home page with Subversion, with a post-commit hook that updates a checkout the web server uses. IOW I can push all my changes online with a single command (svn commit).
June 21st, 2008 - 06:03
Fantastic, amazing and wonderful. Phenomenal and incredible. Happy Happy. Joy Joy.
June 21st, 2008 - 07:32
This sounds a lot like bzr-push-and-update, which is what I use now:
https://launchpad.net/bzr-push-and-update
Except that bzr-upload is entirely client side, from what I understand? The above plugin requires bzr to be installed on the computer you’re pushing to.
Sounds great! It would mean I can use bzr for some other sites I manage too, ones that are on shared hosts that don’t have bzr.
June 21st, 2008 - 07:44
This looks very cool. Nice to not have to then log into the server and update bzr on that side.
My one question though is how does this work in a distributed development team? If my co-worker updates and uploads, and I then update and upload, does it upload history as well as the changes?
June 21st, 2008 - 17:11
Does this upload a .bzr folder? Be nice if it didn’t for some places where I don’t want people seeing my code.
June 21st, 2008 - 19:10
Marius:
It doesn’t upload on commit, but maybe you can open a bug requesting it
Rick:
It doesn’t upload history, just the last revision that was uploaded. This means that if you already uploaded that revision, it won’t upload anything for your co-worker. Of course, that means your repositories ahve to be more or less in-sync.
Mez:
It doesn’t. That was one of my main concerns, *just* uploading the files.
August 12th, 2008 - 12:06
Hi Martin,
Huge thanks and congratulations to both you and Vincent! This plugin is a great step in the right direction for web developers.
I sometimes have to transfer working files to a remote host either through scp or even through Remote Desktop. I am not sure if it is in the spirit of this plugin, but I imagine the core algorithms would be the same, to have some kind of plugin that just exports the files between 2 revisions. I suppose it would be different than this because it would be more like “bzr export-files -r ..130 ../my-checkout-directory” or something like that.
I unfortunately don’t know Pearl at all (used to try it a bit for some CGI scripts, but that’s it) so I am pretty useless at this. Maybe sometime I will learn but in the meantime, would you or Vincent be interested in taking on something like this? Perhaps you already know of something that does that?
Again, great work! Thank You and Vincent for taking the time to actually write this plugin.
August 12th, 2008 - 12:20
Greg, you can’t currently upload individual files or tarballs, but it sounds like a nice thing to have.
Could you file a bug on the project requesting it, with as much details as possible?
September 1st, 2008 - 02:34
Thank you so much for this plugin, it is going to make my life so much easier.
April 22nd, 2009 - 10:42
Great!!!
December 17th, 2009 - 00:14
I have a question: how is
bzr upload sftp://beuno@host/path/to/http
different from
rsync -av –delete beuno@host/path/to/http
??
Is it just that you don’t need rsync server running remotely, and can use ftp?
December 17th, 2009 - 00:17
Yes, that’s exactly it.