A Subversion Command Line Tip


*Update* I Forgot a line in my magic script posted below. It actually does a revert now.

I got in a disagreement with a buddy of mine from work. “Use the command line!”, he urged.

“The command line is for fools who don’t want to understand modern tools!”, I insisted. “We’re in the year 2009 and and it makes no sense not to appreciate modern tools with decent UIs!”

The discussion was about using the command versus a GUI for subversion and it went something like that. I think half way through he uttered something like, “yo mama!” and I was like, “…is a very pleasant person.” I lost the argument. Lost not by giving in but by the mere fact that I was wrong. To this day I thank my buddy for his kind remark regarding my mother. I also thank him for reminding me to use the command line with Subversion. That brings me to my tip of the day. If you’re like me then you’re probably sitting in front of a Mac Pro reading the internet (yes, people do attempt to read the entire internet from time to time… though it’s worse when you try to read the internet over a 56K connection) and enjoying a can of Pabst Blue Ribbon. You’re also probably helplessly hooked on the command line for Subversion work.

One thing I hate about subversion on the command line is how a revert doesn’t completely revert. It leaves remnants. It also does nothing about files you intended to delete prior to the revert. Tonight I wrote a bash script to perform better clean up. I’ll post back with more detail on why I use the command line even though I have Idea installed. For now see my one-liner bash file below:

svnfulrevert.sh

#!/bin/sh

svn revert -R .
svn st | awk '{ if($1=="!") system("svn revert $1" $2); else if($1=="?") system("rm -frd $1" $2); }'

Brought to you by:
the guy that reminded me that it has been over a month since my last worthwhile post.

Co-sponsored by:
the lady who was doing 32mph on Rte 30. Driving behind her gave me time to mull over why my site has been inactive lately.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s