ShiftEleven

SVN Overview

First and foremost, this blog is for me. It's kind of a collection of things that I'm learning and want to learn. So for me, I'm going to start with the basics of SVN(Subversion).

I first used CVS(Client Version System) and it does it's job. There are somethings I wish that were easier. That's where SVN comes in. A lot of the commands are the same. svn add or svn commit is not that much different from that of cvs add or cvs commit, unless you get to some of the other features.

svn add allows you to put a --force parameter along with your add. This will recursively add all the files for a given directory. Even if files have already been added in a given directory, those will be skipped and only the new ones will be added.

The other thing that I love is svn move file_old file_new. Finally, it's easy to move files. No need to delete a file from the repository and add it back to the repository with a new name like in CVS. Now don't get me wrong, if you watch the output of this SVN command, you will see that it will do something like this:

D old_fileA new_file

So what's the difference? Isn't this just a shortcut then really? Well, no. SVN keeps track that the newly added file is actually apart of the deleted file. And it's not just files, directories also can be moved and copied.

Finally, there is svn resolved. So let's say that two people have checked out some code. Person A makes some changes and submits it. Person B also has it checked out and makes some changes to the same files. SVN will attempt to merge the files if it can do it safely, which by the way has been pretty good; no complaints yet. But sometimes there are conflicts which arise when the code cannot safely be merged. So Person A commits his/her changes back to the repository. Now Person B commits his/her changes. Upon doing so, he/she should see a message something like:

C same_file

It is up to Person B to resolve this conflict because his/her code will not be able to go into the repository until that happens. SVN will create a few extra files; same_file.mine, same_file.rXX, same_file.rXY, for when you want to see what you did, what the code was like before you edited it, and what the code is like now that someone made changes to it. So Person B merges the code so that all is well in the world. All he/she has to do now is run svn resolved same_file and the conflict will be removed so that the file can now be put in the repository. The other nice thing that this does is remove those extra files that SVN created when it found the conflict.

While this is an overview, nothing beats the comprehensive list of commands.

Comments

comments powered by Disqus