A simple example using Linux

I have a directory called Intro_LaTeX containing the LaTeX source files of exercises and slides for a course. The directory structure is

    Intro_LaTeX
     |       |
Slides   Exercises

    |        |
MTO7.tex    main.tex screendump.png intro.tex section1.tex section2.tex


Most of the files are .tex text files, but there is one image in a .png file. I work on these files in different locations and would like to have access the PDF version of the slides in case I lose my memory stick.

I want to be able to manage changes to these files safely and systematically. At the moment I have different versions of the files in different places and frequently spend valuable time trying to remember which was the latest version.

1. Prepare the directory.

In a temporary directory make a copy of the latest version of the directories and clean it up. Remove  all the files created by running latex (.aux, .log, .dvi, .pdf etc). Dynamic files should not be stored on the server as they are recreated every time a file or program is compiled.

2. Add the directory to the subversion server.

svn import Intro_LaTeX https://www.stats.ox.ac.uk/svn/repos_name


where repos_name is the name of your repository. This is usually your username. Add an informative message like: 'Adding my Introduction to LaTeX files'. 

What editor am I using?

The editor I used here was vi. This might not be what you want! To change the editor in Linux do
export SVN_EDITOR=path to your editor
so if you want to use emacs you would need
export SVN_EDITOR=/usr/bin/emacs
In general to find the location of a command use which command so which gedit would give /usr/bin/gedit.


After entering a message, saving it and exiting from the editor I saw a line beginning with

Adding ...

for each file I imported and finally

Committed revision 1.

3. Now to make changes. First remove the temporary directory which you imported to the server. Then checkout the directory you want to work on using

svn checkout https://www.stats.ox.ac.uk/svn/repos_name/dir_name

Replacing repos_name by your repository name and dir_name by the name of the directory. 

What is this .svn directory?

You may notice that a directory called .svn has been created. This is used by the subvsersion system to keep track of your changes.

Do not change or remove the .svn directory.

Now make some changes to the files; recompile if necessary to see if the changes are good. If you enter

svn status

after making some changes you should see a list of files. Those files that are not part of the repository will have ? at the beginning of the line. Any file that is part of the repository that has been modified will be indicated with an M.

To add a file - perhaps the PDF version of the slides would be useful - use

svn add Slides.pdf

Changing file locations

If you alter the file structure by creating new directories or moving files between directories you should always use svn copy
svn move
so that when files are committed these changes are saved.


4. When you have finished making changes you need to commit them or save them back on the server. To do this enter

svn commit -m"A message describing the changes"

and the changed files will be written back to the server. If you use

svn commit

you will be prompted for a message and a list of files that are written back is displayed.

5. Finally to give my talk I browsed to

https://www.stats.ox.ac.uk/svn/repos_name/path_to_files

to find the PDF file.

This example was run on a FC 5 Linux box in Statistics and a Live Ubuntu system at home. The slides were accessed from an Ubuntu system in OUCS.