Working with Subversion

Here we will assume that we do not have any local copy of the project. We will extract the project data from Subversion to create a local copy.

  • Firstly, create a new directory where you will store the local copy of the data contained in your repository:
    mkdir /home/me/work
    cd /home/me/work
  • Then get your files from the repository: this action can be performed by using 'checkout' command:
    svn checkout file:///home/me/svn/ ./
  • Now check that your files are there and you can start working them:
    ls -1 myproject
    myproject/Makfile
    myproject/code/
    myproject/codex1.c
    myproject/code/x2.c
  • After editing a file, it is recommended to check your working copy with your repository's copy just in case somebody else working with you has modified some part of your code:
    svn update # Will update the local copy with changes submitted to the svn repo
  • Finally you will have to commit your changes: this will result in a new revision number of your repository tree.
    svn status # Checks to see if any files are different between local copy and svn repo
    svn commit -m "Message" # Commits the local changes to the svn repo, tagging with the message
When updating your working copy, you should carefully check that there are no conflicts with other changes made by your co-workers. Subvserion will flag any changes that cannot be merged automatically e.g.
svn update
Conflict discovered in 'foo.c'.
Select: (p) postpone, (df) diff-full, (e) edit, (h)elp for more options : p
C foo.c
Updated to revision 2.

The user then has to decide on how to resolve the conflict. In this example we will go for the simplest case and we will imagine that only our copy is the right one, overwriting all the changes that others made:

svn resolve --accept
working foo.cResolved conflicted state of 'foo.c'
svn commit -m "My working copy is OK."

For further details on how to merge differences check here.  

Supported By

File Browser Reference
Department FHERIS
University of Galway
HEA Logo