Subversion Notes for CS 270

For more info on subversion, see http://svnbook.red-bean.com/.
  1. FIRST read chapters 1 and 2 in the subversion manual at http://svnbook.red-bean.com/.

  2. Prepare the project directory for which you will be creating a repository. (This step can occur on any machine with network access and with the subversion client svn).

    Suppose you have a project that is currently just an empty directory. For example, after you have created the pa0 subdirectory for programming assignment 0.

         ~/CS270/PA0/
        
    Copy the directory for which you want to make a subversion repository to a new name. This is not strictly necessary, but it is a good way of making a backup.
        % mv ~/CS270/PA0 ~/CS270/PA0.svn
        

  3. Create a subversion repository for your project. (This step must be done while logged into a CS linux machine). [The following instructions were edited 8/31/08. To see the old instructions do a "View Source" in your web browser and look at the commented out text.]
    // creating the repository on a CS unix machine
    // NOTE: Each project will have its own repository.  
    // All the project repositories for CS270 will be in 
    // $HOME/SVNRepositories/CS270_Projects/.
    % cd $HOME
    % mkdir SVNRepositories
    % mkdir SVNRepositories/CS270_Projects
    % svnadmin create $HOME/SVNRepositories/CS270_Projects/PA0
        
    Where $HOME is set to your home directory by default. Type printenv HOME to see the value of the HOME environment variable.

  4. Import the project into the repository. (Go back to your original machine, which has network access).
    // importing project into the repository
    % cd ~/CS270/PA0.svn
    % setenv SVN_SSH 'ssh -l <Your CS username>'
        // if you are using bash do the following:
        % export SVN_SSH='ssh -l <Your CS username>'
    % svn import . svn+ssh://<Machine name>.cs.colostate.edu/<HOME on CS machines>/SVNRepositories/CS270_Projects/PA0 -m "Initial import"
    <Your CS username>@<Machine name>.cs.colostate.edu's password: 
    Adding         README
    
    Committed revision 1.
    
    In the above replace <Your CS username> with your CS linux username, replace <HOME on CS machines> with the full path to your home directory on the CS machines, and replace <Machine name> with the name of some machine in the department (hint: look at the machine you're on right now, or go to www.cs.colostate.edu/~info/machines).

  5. Set up a working directory for the project. (This can be done on any machine with network access).
    // get a working directory for the project
    % cd ..
    % setenv SVN_SSH 'ssh -l <Your CS username>'
        // if you are using bash do the following:
        % export SVN_SSH='ssh -l <Your CS username>'
    // for some reason the below command requires your password three times
    // I have seen this on other subversion servers as well
    % svn co svn+ssh://<Machine name>.cs.colostate.edu/<HOME on CS machines>/SVNRepositories/CS270_Projects/PA0 PA0
    <Your CS username>@<Machine name>.cs.colostate.edu's password: 
    <Your CS username>@<Machine name>.cs.colostate.edu's password: 
    <Your CS username>@<Machine name>.cs.colostate.edu's password: 
    A    PA0/README
    Checked out revision 1.
    
        
  6. Commands you will need while working:

    svn commit
    When you want to save the changes that you have made to anything in the project directory.
    svn add
    To add a file or a subdirectory in a working directory to the repository.
    svn update
    Pull down any changes that have been committed to the repository by your partner.
    svn info
    To check which repository and the revision number this working directory is associated with. This information is most accurate after an svn update.
    svn status
    To obtain file and directory status - added, deleted, merged, ...
    svn diff
    To compare differences between file paths.
    svn log
    To display commit messages for repository.

    Subversion Quick Reference Card


mstrout@cs.colostate.edu .... August 31, 2008