CSC 263, 265, and 378
Repository
This is a Subversion (SVN) Repository located at
/p/theory/profs/Repository which contains assignment and test questions
used in previous sections. The repository is only readable to members
of the unix group theoryprofs. I've tried to include useful information
for working with SVN repositories below, you can find more details
about SVN here.
Initial Checkout:
Usually, when working with a Subversion (SVN) repository you will start
by "checking out" the repository. This creates a working copy of the
repository in your home directory or on your local machine. You can
then make changes and modifications without interfering with another
person's use of the material. Once you're ready, you can commit your
changes back to the repository to share with the rest of the faculty.
Use the following command to check out the repository.
svn checkout
file:///p/theory/profs/Repository
If this is your first time using the repository you can check the
README.TXT file for an overview of how the repository has been
organized. Once you've checked out the repository you'll have a copy of
the README.TXT file in your working copy of the repository. If you'd
like to view the README.TXT file beofre checkig out the repository, you
can find a copy at /p/theory/profs/README.TXT
Basic Work Cycle:
Once you have a working copy you can then use your favorite editor to
make changes to existing files. You can also make additions using svn
add to add new files to the repository. Once you're done and would like
to share your changes with other faculty members you can use svn commit
to upload your changes back to the main repository.
For example:
Usually you'll want to start by updating your working copy to receive
any changes made since your last update.
svn update Repository
There are two kinds of changes you can make to your working copy, file
changes and tree changes. You can use your favorite text editor, word
processor or any other software you like to make changes to existing
files (known as file changes). SVN will automatically detect these
changes. Tree changes refers
to the removal, addition, copying or moving of a file.
Basic Work Cycle: File changes
Lets say you'd like to add a new question to recurrences.tex (located
in Repository/0_Basics), simply open the file in your text editor (ex:
vi Repository/0_Basics/recurrences.tex), add the question and save the
file. Now your working copy of recurrences.tex will have your
modifications, but the repository won't.
You can run svn status to display what file you've changed. If your
working from withing the Repository (you used the command cd
Repository) you can simply type:
svn status
Some people prefer to run all commands from their home directory, in
which case use:
svn status Repository
At this point in this example svn status will display the following:
M 0_Basics/recurrences.tex
You can use the svn commit command to send your changes to the shared
repository. When committing changes to the repository you also need to
add a comment to the log files. This makes it much easier to track
changes later.
svn commit -m "Added a question to
0_Basics/recurrences.tex"
If the commit was successful you should see something similar to:
Sending recurrences.tex
Transmitting file data .
Committed revision 2.
SVN only checks to make sure that nobody else has made changes to any
of the same files that you changed. If someone has done that, the
entire commit will fail with a message informing you that one or more
of your files is out of date. In this example, if someone else has made
a change to recurrences.tex you'll see something like:
Sending recurrences.tex
svn: Commit failed (details follow):
svn: Out of date: 'recurrences.tex' in transaction '3-1'
This means you'll need to run svn update, sort out what changes were
made to recurrences.tex, merge your changes in and try to commit again.
svn update
C recurrences.tex
Update to revision3.
The C stands fro conflict. If SVN considers the file to be mergable, it
places conflict markers (special strings of text) into the file to
visibly demonstrate the overlapping areas. For every conflicted file,
SVN places three extra unversioned files in your working copy.
Filename.mine is your file as it existed before you updated your
working copy (If SVN considers the file to be unmergable the .mine file
isn't created since it would be identical to the working copy).
Filename.rOLDREV is a copy of the 'base' revision file, that is the
file you checked out before you made any edits. Filename.rNEWREV is the
'head' revision file, this is the file currently in the shared
repository. In our example it would look like:
ls recurrences.tex*
recurrences.tex
recurrences.tex.mine
recurrences.tex.r1
recurrences.tex.r3
Looking at the file with the conflict markers is usually a good place
to start merging the two setts of changes. Lets say you both added a
question at the end of the recurrences.tex file. There would now be
conflict markers that look something like:
Original text of file
<<<<<<< .mine
Changes you made
=======
Changes the other person made
>>>>>>> .r3
To keep both new questions in the file simply remove the conflict
markers and make sure the two questions are properly separated. Once
you've merged your changes with the new version use the svn resolved
command to tell SVN you've manually merged the changes. Then try commit
again.
svn resolved recurrences.tex
svn commit
Basic Work Cycle: Tree Changes
There are times when the changes you'd like to make involve adding,
removing, copying or moving a file, these are known as tree changes.
For example, if you had an entirely new set of questions to add to
0_Basics. You already have a file with all these questions and would
like to add the entire file as is, instead of coping the questions into
an existing file. This is a good time to use the svn add command.
First, move your new file to your working copy of the repository, then
add it to the repository. Finally, commit your changes to the shared
repository.
mv foo Repository/0_Basics/foo
svn add Repository/0_Basics/foo
svn commit Repository
The svn delete, copy and move commands work similarly.
Removing the Repository:
Having a working copy of the entire repository in your home directory
is a waste of space, especially once you're done teaching the course.
The simple solution to this is simply to delete it. The central
repository will remain, with the modifications you made earlier. If you
should ever need the files again in the future you simply check them
out again.
rm -R Repository