by Sophie Engle on Aug 2013
You may occasionally need to use SVN via the command line (like, for example, when you test your code remotely on the lab computers). This guide goes through how to create a working copy and keep it updated with your SVN repository, or do a one-time export of your SVN repository for testing purposes.
The first step is to decide how much of your SVN repository to checkout and create a working copy for. You can checkout your entire repository or just a particular subfolder. For example, if I were checking out my entire repository, I would use:
Otherwise, if I wanted to just checkout a working copy of all my CS 212 code, I would use:
After you decide which part of the repository you want, use the
svn checkout command (or
svn co for short) to create a working copy of that repository on your local computer.
svn co https://www.cs.usfca.edu/svn/sjengle/cs212 cs212
The arguments are always the remote directory that you want to checkout first, followed by the local directory.
If you do not want to try and keep a working copy synchronized with your repository on the lab computers, you can export a temporary copy of your SVN repository for testing purposes. First, create a temporary directory for your files and change to that directory:
[sjengle@hrn23501 ~]$ mkdir temp [sjengle@hrn23501 ~]$ cd temp [sjengle@hrn23501 temp]$ pwd /home/sjengle/temp
Now, we will use the
svn export command to export a temporary copy of your SVN repository. For example:
[sjengle@hrn23501 temp]$ svn export https://www.cs.usfca.edu/svn/sjengle/cs212/homework05 A homework05 A homework05/.classpath A homework05/.project A homework05/src A homework05/src/PrimeFinder.java A homework05/log4j.properties A homework05/.settings A homework05/.settings/org.eclipse.jdt.core.prefs Exported revision 387. [sjengle@hrn23501 temp]$ ls homework05
Just make sure you change the path you are exporting to the directory or file you want to retrieve from SVN.
cd into the directory and test your code or make changes. Remember, though, this is NOT a working copy. Any changes you make to your code will not be reflected in SVN.
When done, delete the temporary copy. For example:
[sjengle@hrn23501 homework05]$ cd .. [sjengle@hrn23501 temp]$ ls homework05 [sjengle@hrn23501 temp]$ rm -rf homework05/ [sjengle@hrn23501 temp]$ cd .. [sjengle@hrn23501 ~]$ rmdir temp
Just be careful when removing directories and files using the command-line. It is easy to irrecoverably delete all your files.