Content tagged with "svn"

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.

svn command line commit wierdness and Windows XP Post on Sep 29, 2009

I thought I was entering into Windows twilight zone, svn wouldn't let me commit on my XP console. Turns out it doesn't like single quotes, so this wouldn't work:

svn ci -m 'This is my message'

I had to do this:

svn ci -m "Windows XP sucks bobo bigtime"

Hope that helps someone keep from pulling their hair out...

Aaron

Delete svn directories Post on Jan 09, 2009

Every once in a while we find the need to hack out a bunch of .svn directories, a good example is borrowing a javascript plugin (with 500 nested folders) from a project already committed to a subversion repository. It can be (and really, is) quite painful to go through and remove all those little .svn folders so you can potentially commit the newly-coveted javascript morsel into your new project (if this sounds hackish, it probably is, there must be a better way).

My new favorite hack

rm -rf `find . -type d -name .svn`

Found it here.

Cheers

Global svn ignore Post on Jan 07, 2009

I have had the recent annoyance of having svn status reveal every .pyc file in my projects. I usually use eclipse for developing in python/django, but on my old (fluxbox-revived) laptop, eclipse is too much of a hog to run so I settle on gedit (awesome) and the command-line svn, which works just about as great.

The only thing I couldn't figure out is how to get svn to ignore my *.pyc files, and I tried propset and a bunch of other stuff.

Finally

I changed a line in my ~/.subversion/config file, I think it was global-ignore and added *.pyc to the end.

My next svn status? Pretty as can be, and free of pyc files.