Learn Subversion
Swe05
Learn Subversion
SubVersion is a version management system intended to fix the defects of
CVS ("a compelling replacement for
CVS in the open source community"). In particular, Subversion allows files to be moved and copied with preservation of version information. This permits refactoring of the directory structure. Other nice features are that commits are atomic transactions, branches and tagging are much simpler (mentally), etc.
There are other version management systems that are superior to
CVS, but Subversion has a model and syntax that is very close to
CVS.
CVS users should have no trouble adapting to Subversion.
Using Subversion
Linux
A Linux build of Subversion is installed under
/praktikum/se. You should issue the following command to set up the environment so that the shell can find the
svn program:
. /praktikum/se/nix/Linux/etc/profile.d/nix.sh
(Note the ". " in front of that.) You may want to put this line into your
~/.profile file so it gets executed automatically when you log in.
Windows
A Windows build of Subversion is installed in P:\SE\Win32\Subversion. You can use it from a command prompt, e.g.,
p:\se\win32\subversion\svn co http://...
For convenience, you can add this directory to your PATH. Go to My Computer -> Properties (right mouse) -> Advanced -> Environment Variables, and add (or edit) the variable "Path" with value "P:\SE\Win32\Subversion".
Windows users may also be interested in
TortoiseSVN, which is a Subversion client implemented as a Windows Explorer extension. Unfortunately this requires registry changes so I haven't been able to do a globally usable install. So you'll have to install it yourself. It does take up 15 MB of space, but you can probably delete the internationalisation stuff (the
iconv directory).
Solaris
Subversion is not yet installed on the Solaris machines. You can still do this assignment from one of these machines by logging in remotely on one of the Linux machines. On Solaris, you can do this from a terminal using the command
ssh MACHINENAME
where MACHINENAME is one of the Linux machines in
BBL-401 or
BBL-406 (please choose one randomly to prevent them from being swamped).
Exercises
- Create a Subversion repository. You can do this locally using the
svnadmin command; however, it is better to create a repository that can be shared over the Internet. Go to https://losser.st-lab.cs.uu.nl:12443/repoman to create a repository. You have to create a user account first. Note that you can give other people read or write access to your repository. Note: please prefix the name of your repository with the string "SE2003_". (This makes it easier for us to clean up the server.)
- Check out the repository created in the previous step. Subversion uses HTTP (with WebDAV? extensions) as its network transport protocol, so you can check out using, e.g., svn checkout https://losser.st-lab.cs.uu.nl:12443/repos/my_repo.
- Add the sources of the interpreter (with your Makefile). Note: it may be a good idea to already create directories
interpreter and interpreter/trunk, and add the source to the latter directory. (This will save you some work below.)
- Make modifications to a (or some) file(s). If you are working in pairs, be sure to make modifications to different as well as same files. Within a file, be sure to modify different as well as same lines. If you are working alone, check out the project in two different locations in your local file system and simulate working in pairs by making the modifications in the two different checked out versions.
- Commit the modifications (
svn commit). If a conflict occurs which cannot be solved by Subversion (which should happen if the previous exercise has been done), repair the file(s) containing the conflicts and commit again.
- Refer to Chapter 4 of the Subversion Guide for information on branching and tagging. Create a
/interpreter/trunk/ directory and move the sources of the interpreter to that directory. Also create /interpreter/branches/ and /interpreter/tags/.
- Make a versioned copy of
/interpreter/trunk/ to /interpreter/tags/0.1.
- Make a branch of the trunk in
/interpreter/branches/experimental. Make some random changes in experimental. Then try to merge them back into the trunk (using svn merge).
- Undo the merge (this is a common scenario: a modification turns out to be broken and has to be backed out). You can use
svn merge for this too. For example, svn merge -r11:10 . will apply the backwards difference from revision 11 to revision 10 to the current directory.