Archives
Tags
- General (18)
- Food (1)
- Cooking (1)
- Ruby (6)
- Rails (2)
- Svn (2)
- Linux (9)
- Git (1)
- Firefox (8)
- Porn (1)
- Freyja (1)
- Witchhammer (6)
- Music (1)
- Merb (3)
- Poetry (0)
- Bolverk (3)
- Sinatra (1)
- Discogs (1)
- Centos (1)
- Python (1)
- Whinging (2)
- Travel (2)
- Scheme (7)
- Lisp (8)
- Sicp (1)
- Rot13 (1)
- Czech (2)
- Metal (3)
- Passenger (1)
- Fun (5)
- Fractals (2)
- Plt (2)
- Clojure (1)
- Continuations (1)
- Javascript (1)
- Presentation (1)
Resetting your SVN repository to a previous revision
NOTE: See the improved version of this shell script here: http://andrewbuntine.com/articles/2008/11/26/an-improved-shell-script-for-svn-resetting
For the majority of the year, I have been using Git as my preferred version control system. Recently, however, I have been using Subversion on some older projects at work.
One thing I have noticed is that the "revert" command seems to be oddly named. It's more of a svn-merge-and-undo. Maybe it's just me?
In either case, I wrote a little shell script that will act more like the Git-equivelant by allowing you to forcfully revert back to any previous revision of your project. It looks like this:
if [ $# = 3 ] then currdir=`pwd` cd $2 svn update svn merge -rHEAD:$1 $3 svn commit -m "Reverted back to r$1" cd $currdir exit 0 else echo "svnreset needs three arguments!" exit 1 fi
Save it as "svnreset" and call it like this (the period is intentional):
$ svnreset 200 . svn://server/project/trunk
That will reset your project to r200, provided you are currently in the repositories root directory. Note also, the changes will be committed as a new revision, so if you make a mistake, just reset the reset!
I suggest that you create a symlink to /usr/bin so you can just call it straight from the terminal whenever you need it.