Monday, November 26, 2007

why subversion really rocks

Subversion leaps giantly forward. Not only some opensource people are using it, now a lot of large companies try to make the switch. And I do not speak of some old fashioned CVS-users how just try new things: There are companies outside which will abandon their commercial version management systems for subversion.
I think the main reason for this is subversions model of representing version control:
At the end users are most comfortable with the most common computer metaphor:
the file(-system)
Nearly all users now how to copy, rename move and delete files. I think all developers know.
Subversion breaks not with this metaphor, it just enhances it with a new dimension: time. This makes the learning curve so shallow. You do not need anything to now about branches, tags or anything else. Just this: a commit saves your versions into the repository and creates a new revision an update will get changes from your coworkers into your workingcopy.
Of course there are voices against this simple model: some people think it is a problem that svn doesn't support native tags or branches but I think as long as you can map this usecases on your filesystem more people will understand what is happening. So if your branches/tags are just plain directories, it is much easier to grasp than an abstract concept for people who do not work day to day with version control.

Wednesday, November 7, 2007

a small script for searching in subversion repositories..

If you are using subversion for versioncontrol, you might have sometimes the need to search for a string in all files.. here is a small script for doing this without checking the whole repository out.
This script needs only 1 argument: the string to search for.
PLEASE NOTE! change first and second line to match your own Repository.

REPO="svn"
BASEURL="http://svn.collab.net/repos/"
SEARCH=$1
svn ls -R "${BASEURL}${REPO}/trunk/" | while read file;
do
  result=`expr match "$file" '.*/$' | cat`
if [ $result == 0 ]; then
result=`svn cat "${BASEURL}${REPO}/trunk/$file" | grep $SEARCH | cat`
if [ -n "$result" ]; then
echo "${BASEURL}${REPO}/trunk/$file"
fi
fi
done