SVN Notes

mjf

Many notes based on reading: Version Control with Subversion, by Ben Collins-Sussman et al. Published by O'Reilly in 2004.

Useful Definitions

ACCR = https://accserv.lepp.cornell.edu/svn/

HEAD
The latest version in the repository.
BASE
This is the pristine version originally checked out into the working copy.
COMMITTED
This is the last revision in which an item changed (before or at BASE).
PREV
The revision just before the last revision in which an item changed. (COMMITTED - 1)

Basic Commands

SVN commands Command descriptions Where used
svn stat Show the status of the local files compared to the repository. See the letter codes In working directory
svn update Bring working directory up to date with any changes checked into the repository. See the letter codes In working directory
svn add [file/directory] Add a file or directory from your working copy into the repository. If adding a directory, contents will be added as well unless the --non-recursive (-N) switch is passed. In working directory
svn list repos-location List the contents of a directory in the repository Any location with access to the svn server
svn log [repos-location or file-location] Show log information the contents of the current directory or location specified Any location with access to the svn server
svn diff [location(s)] Examine local changes; Compare the working copy to the repository; or compare repository to repository. Any location with access to the svn server
svn co [repos-location] Checkout a repository file or directory as a working copy. Any location with access to the svn server
svn ci [path] Check into the repository a file or directory from a working copy. "." is the default path if omitted. In working directory
svn import [path] [repos-location] Import into the repository location a file or directory given by path. "." is the default path if omitted. Any location with access to the svn server
svn resolved conflicted_filename Set the status of a conflicted file to resolved and allows checkin. Use only after fixing the conflict! In the directory of the conflicted file.
svn switch [repos-location] Switch a local working copy to a different branch, or update the repository location of your working copy if the directory structure in the repository has changed or been renamed. In the working copy directory you wish to switch.
more to come

Common usage

svn diff --revision PREV:COMMITTED code.f90
Show the last changed committed to code.f90
svn log --revision BASE:HEAD
Show all the commit logs since the local working copy was last updated. (Logs of any changes you may need to merge!)
svn mkdir $ACCR/trunk/newdir
cd newdir
svn co $ACCR/trunk/newdir .
Adds a new directory to the repository, then checks it out into your local directory, making the local directory a working copy.

SVN Update Letter Codes see p28

U
The file was Updated (received changes from the server)
A
The file was Added to the local copy
D
The file was Deleted from the local copy
R
The file was Replaced (locally deleted, then new item added).
G
The file was merGed. Non-conflicting repository changes were merged into the local file.
C
The file has Conflicts. Changes made to the repository directly conflict with changes made locally. These will need to be dealt with and then give the svn resolved command.

SVN Status Letter Codes see p31

L
The file is Locked
M
The file has local content or svn property modifications
?
Unknown file
!
Missing or incomplete
~
Versioned as file and is directory or vice-versa
A
Scheduled for Addition
D
Scheduled for Deletion
C
The file has Conflicts
S
This has been Switched to a branch

Valid XHTML 1.0! Valid CSS!