Tutorial on SVN

From Vlsiwiki
Revision as of 18:34, 13 November 2009 by Mrg (Talk | contribs) (Commit changes to the project)

Jump to: navigation, search

Another thing that is very important, is revision control. YOU SHOULD USE SVN TO MANAGE YOUR REVISIONS. If you do not, you will eventually delete a file by mistake or want to undo an edit and you will be out of luck. SVN can handle binary formats automatically. All of the above source files should be checked into an SVN repository that is either in your personal space or on the group server.


Checking out a project

To access our group SVN server from the mada cluster, you can do this:

svn co file:///mada/users/vlsi/<project>

To access it from outside the cluster, you can access it through ssh like this:

svn co svn+ssh://user@mada0.cse.ucsc.edu/mada/users/vlsi/<project>

To get an SVN client for any machine (Linux, OSX, Windows), you can look at http://subversion.tigris.org/project_packages.html

Now, when you are in the checked out directory, you can execute a number of commands.

Modifying a project

To add new files to a repository:

svn add file.C

and it will remember from where the repository came. Note that if you add a directory, it will add the entire subcontents to SVN. To remove a file from the repository, use:

svn rm file.C

To move a file within the repository, use:

svn mv file.C newfile.C

Updating your copy

If someone else commits changes, you will need to get an updated copy. If you try to commit and it says you are out of date, you also need to do this before you can check in your changes. In the directory type:

svn up

This will give you a status for all of the changes encoded as a character next to each file:

A    file1.C
G    file2.C
C    file3.C

A means it was added, G means changes were merged into your copy, C means there were conflicts. If there were conflicts, see the section on merging.

Commit changes

After you know your modifications (or file addition/removal/moves) are right, you want to add the changes back to the repository so that other people can get them. Before you commit your changes, you must do an "svn up" to get the most recent copy from the repository. If you don't, it will give you a warning that you must update.

To check in all changes, simply do:

svn ci

or for a specific file:

svn ci file.C

Merging conflicts

Binary files

Usually, SVN will recognize files as binary. It does this when it finds a non-printable character in the first part of a file. If this is not the case as with some PDFs, you can set a binary property like this:

svn propset svn:mime-type application/octet-stream path/to/thingy

This will keep full copies of a file rather than incremental changes.