Content tagged with "bazaar"

Bazaar DVCS upload plugin Post on Oct 26, 2010

I've known that I needed to move to a DVCS for a while, but, being busy as usual, I haven't had the time to try out one of the few popular systems. Recently I have been faced with a recurring challenge: managing Wordpress template and plugin customizations on client sites where I don't have shell access.

The first couple I didn't weren't a really big deal, just jump in and edit some files, upload via FTP, no problem. But, as usual, it started to bite me in the ass: more changes were being requested, and it was often easier to edit the files online through the Wordpress admin interface than locally and then upload, rinse and repeat.

So, I received a request from a client to work on a site from a couple months ago. It became clear to me that I was losing my mind: were the local files most recent, or were the remote files most recent? I couldn't take it any more. I was bound to find a bloody VCS that would work over FTP.

Turns out it's Bazaar

Not to be confused with 'bizarre'.

Bazaar is a version control system written in Python (yay!), and while it doesn't have the functionality built right in, there's a little plugin called Bazaar Upload which installs in seconds (python setup.py install) and works like a dream.

Workflow

I learned what I needed to know about Bazaar in about 5 minutes. Just a quick tutorial from their documentation and I was up and running. Here's the rundown (by the way, I'm using Unix Utils in Windows):

// change to an existing wordpress directory locally
$ cd wordpress
// set up bazaar in the current folder
$ bzr init
Created a standalone tree (format: 2a)

// add some files to the repo (let's say the theme)
$ bzr add wp-content/themes/some-theme
adding wp-content
adding wp-content/themes
...
// now commit the files to the repo
$ bzr commit -m "Added only the files I want to keep track of"
Committing to: C:/wamp/www/wordpress/
added wp-content/
added wp-content/themes
added ...
Committed revision 1.

// now the fun part: send the files we've changed to 
//our production environment, make sure you have 
//the bzr_upload plugin installed
$ bzr upload sftp://aaron@someproject.com/~/public_html/new-site
// Asks for authentication...
Uploading wp-content
Uploading...

// alternatively, we can use ftp also, but notice 
// the path is different
$ bzr upload ftp://aaron@someproject.com/new-site
// Asks for authentication
Uploading wp-content
Uploading ...

// A note on sftp vs ftp: sftp uses the SSH protocol so it logs
// you into the ~ (home) folder of your web server, so you specify
// the path like you would in a unix environment.  Ftp logs you
// in as if you were the ftp user, so the path may be different

Now, the next time you make a change to a file, you just

$ bzr upload
... and it remembers the last place you asked it send files.

Done and done.

Awesome! The end.