Subversion is a version control program intended as a direct replacement for CVS, the concurrent versioning system. It's a new program that fixes several things that were considered broken or awkward in CVS.
Create a request to create a repository, e.g.,cs105/2007/fall. If you want to provide students access to parts of the repository, then you need to include that information in the request. The result will be a top level repository and a file to hold the ACL info.
To create each subdirectory you need to run:
The format of the ACL is unforgiving...
"svnadmin create /cs/cs105/2007/fall/svn/REPOSITORYNAME"
Before running
example ACL file:
[groups]
team1 = lskywalker, hsolo
team2 = c3po, r2d2
graders = yoda, kenobi
# an ACL for a repository is indicated using [repositoryname:/path]
# # access is granted with "user=r" or "user=rw"
# # use "@group=r" or "@group=rw" to give access to an entire group
#
# [repository1:/]
# @team1 = rw
# @graders = r
#
# [repository2:/]
# @team2 = rw
# @graders = r
#
# # if a path is specified, then the ACL applies to
# [repository2:/deathstarplans]
# leia=rw
# c3po=
# # although leia doensn't have access to the rest of it, she does have access to /deathstarplans
# # Note that c3po can't access /deathstarplans
#
#
# # if no repository is specified, then the entry applies for all repositories
# # so this gives dvader read access to all of them
# [/]
# dvader = r
#
To create a working copy so you can make changes to the documents in the repository, you need to check out the directory they are in:
% svn checkout file:///home/user/repos working
This checks out the documents in the /home/user/repos repository and puts them into a folder called working in the current directory. You can then edit these files and check them back in to confirm your changes.
Some repositories are made available via a web sever, in which case file:///... would be replaced by a http://... or https://... URL.
First, you will want to check what exactly you have changed using the following command:
% svn status
For a good discussion of status codes, see here. After reviewing the changes you have made, use the following command:
% svn commit -m "Comment about update" If you leave out the -m message, subversion will try to open an editor in which you can create your comment.
To create a working copy so you can make changes to the documents in the repository, you need to check out the directory they are in:
% svn checkout file:///home/user/repos working
This checks out the documents in the /home/user/repos repository and puts them into a folder called working in the current directory. You can then edit these files and check them back in to confirm your changes.
Some repositories are made available via a web sever, in which case file:///... would be replaced by a http://... or https://... URL.
First, you will want to check what exactly you have changed using the following command:
% svn status
For a good discussion of status codes, see here. After reviewing the changes you have made, use the following command:
% svn commit -m "Comment about update" If you leave out the -m message, subversion will try to open an editor in which you can create your comment.
% svn add <file>
This command will add a file into the repository and begin storing versioning information for it. (It will appear in the central repository only at the next svn commit) To create another copy of a file or directory already in the repository, use:
% svn copy <oldname> <newname>
To rename (or place in a different directory) a file in the repository, use:
% svn move <oldname> <newname>
% svn delete <file>
This will remove a file from version control and delete it in your working copy. If the repository contains versioning information for the file, it will remain. (And if you ask subversion for a version of the repository as it was before the deletion, the files will reappear.)
% svn revert <filename> will revert to the most recently checked-in version of a file.
% svn log <filename>
to view all log entries of checkins in which that file is changed. From there,
% svn co -r <rev> <filename> will revert to revision number <rev> of the file.
% svn diff <filename>
This command will enumerate each line in your working copy that is different from the version in the repository.
Resolving conflicts is one of the more confounding aspects of using SVN. Luckily, there is a very good treatment of the subject here. The gist of it is that when the version of a file in the repository and the version in your working copy have overlapping changes, you will not be allowed to check the file back in (it will have a C as its status code).
In your file, you may find lines composed of '<', '=', or '>' characters with revision numbers (or .mine) after them. These conflict markers designate where your version of the file overlaps with the previous revisions. You should remove these markers as well making the desired changes to the file before attempting to resubmit it.
This lets subversion know that you have resolved the conflict. From here, you are free to submit again. Also, you can revert the file and then check back in without having to run svn resolved.
You can simply delete the working directory if you no longer need it (after saving your changes, if you want to). If you need another copy, you can just check it out again.
Take a look at Version Control with Subversion. Odds are that if svn can do it, it's in there. Of specific note is the extensive command reference at the back of the book.
If the repository lives on machine that allows you to log in, and if you are running on Unix, Linux, or some variant that has an ssh command, use the following command (substituting appropriate values where obvious):
% svn checkout svn+ssh://server.cs.hmc.edu/your/repository/directory
% svnadmin create <path>
where path is the path (on the local filesystem) to the repository. This will create a directory containing administrative files at the specified path. Next, you will probably want to add your files to the repository so you can begin editing them.
If you're starting from scratch, you can just get a working copy of the repository (initially empty) and svn add new files and directories as needed (followed by svn commit, of course).
The following command imports the files in a specified project directory into the given repository:
% svn import <project path> <repository path> -m "Initial import"
The -m option allows you to specify a log message. When entering the
repository path, you must provide a protocol used for access. For
local files, use the "file" protocol. Thus, to import the folder
~/test into the repository in ~/repos with a log message of "starting repos", the following command
would be issued:
HMC Computer Science Department
Contact Information