AD Teaching Wiki:

Subversion (SVN)

SVN is a version management system. With its help, you can manage any data (in most cases however text or program code) on a central computer (in our case a computer at our premises) in a so-called “repository”. You may download your files from this computer (“svn checkout”), you may add new files (“svn add”) and upload the contents of new or edited files into the repository (“svn commit”). If someone else edits your data (in our case the tutors correcting your program), you will get the latest version with “svn update”.

svn checkout

For each course we have an individual SVN repository. In this repository, each participant has his or her own subdirectory. The name of this subdirectory corresponds exactly to the name of your University IT Services account. In order to check out your subdirectory, please proceed as follows (under Unix / Linux):

svn checkout <URL> <MYFOLDER> --username <MYUSERNAME>

whereas <URL> is the url to your own subdirectory in the SVN repository of the lecture (e.g.,<MYUSERNAME>), <MYUSERNAME>is the user name of your University IT Services account and <MYFOLDER> is a directory of your choice.

svn add

In order to add a new “FILE” to the repository, please proceed as follows

svn add FILE

With this command, the file is however not uploaded to the server; the files in question are only scheduled (marked) for the upload. The upload itself will take place with the next “svn commit”, see below. “svn add” does also work with several files at a time, e.g. for “FILE1”, “FILE2” and “FILE3”

svn add FILE1 FILE2 FILE3

If one of the files is a folder, the folder will be “added” including all the files it contains. If you do this, please make sure that all files in the folder are intended to be uploaded into the repository and that any by-products such as editor backup files, “.o”-files or executable files are deleted (or moved) before.

If you find that you do not wish to add a file for which the “svn add” has already been executed, please use “svn revert” followed by the respective file name(s).

svn revert

svn revert FILE

Will reset a file to the last committed version. A “svn add” may thus be reverted, as long as no “svn commit” has been executed.

svn commit

With this command, all changes to the local working copy are transmitted to the computer where the repository is located. This means in our case the computer at our premises. Changes mean either changes to files already in the repository or files added to the repository for the first time with the aid of “svn add”.

“svn commit” fails for files to be edited which are stored in locked directories. This would be the case for older exercise sheets after the submission deadline.

svn update

With this, all changes in the central repository are transmitted to your working copy. If there were no changes in the repository, nothing will happen at all. If there was a change to a file in the repository which you edited in the meantime as well, svn will try to keep both changes, which is called “merge”. In most cases, this is successful, if the changes were made in different passages in the file. If the changes happen to be in the same passage in the file, there is a conflict.

In the event of a conflict, svn will indicate a “C” for the file in question. In this case, please edit the file in order to eliminate the conflict. You will find that the passages affected by the conflict are highlighted in the file (the marks cannot be missed). Both versions are displayed. You may then decide, which version you want to keep, edit the file accordingly and remove the marks). After that, you have to tell SVN explicitly, that the conflict has been resolved by using “svn resolved” followed by the file name.

svn remove

svn remove FILE

Removes the file locally as well as in the repository. This change must be transmitted by “svn commit”.

svn help

With this, all available commands for “svn” can be listed and further information can be requested. As a matter of principle, this command replaces the Man-Pages for “svn”.

svn help

svn help add

AD Teaching Wiki: Manuals/SVN (last edited 2018-04-16 14:21:24 by Axel Lehmann)