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
Did more work?
beuno@beuno-laptop:/mywebsite$ bzr ci -m'Random bug fix'
Committing to: /mywebsite/
Committed revision 2.
beuno@beuno-laptop:/mywebsite$ bzr upload
Using saved location: sftp://beuno@host/path/to/http
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.