LMU Computer Science undergraduates are strongly encouraged, and in many cases required, to maintain a relatively complete electronic portfolio of all coursework in a revsion control system, such as Subversion (a.k.a. SVN) or Git. Maintaining an electronic portfolio of your work has several important benefits:
There are several places on the web that will host a repository for you. LMU Computer Science students, however, can also take advantage of a private subversion repository provided with their lab account. These notes cover only about 3% of everything you can do with SVN, but at least it is a useful 3%.
Every LMU Computer Science student gets a account which contains, among many other things, a public-facing website, a private database, and a private SVN repository. Over time you will likely build up a repository of all of your work at LMU (that isn't required to be hosted on public sites, which is generally required of senior capstone projects).
/
|__ homework
| |__ cmsi185
| | |__ ...
| |__ cmsi186
| | |__ ...
| |__ cmsi281
| | |__ hw1.tex
| | |__ hw2.tex
| | |__ hw3.tex
| | |__ src
| | | |__ java
| | | | |__ ...
| | | |__ javascript
| | | |__ ...
| |__ cmsi282
| | |__ ...
| |__ cmsi284
| | |__ src
| | | |__ c
| | | |__ hello.c
| | | |__ ...
| | |__ ...
| |__ cmsi386
| | |__ ...
| .
| .
| .
|
|__ projects
|__ tictactoe
| |__ ...
|__ scrabble
| |__ ...
|__ lolcompiler
|__ ...
Your private repository is stored in the the directory ~/.svn.
The most common SVN tasks are these:
Let's start by making a workspace. Create a directory called
homework/cmsi284/hello/c in your home directory. Navigate to it, then
create the file hello.c as follows:
#include <stdio.h>
int main() {
printf("Hello, world\n");
return 0;
}
Before checking it in, make sure it actually works:
~/workspace/homework/cmsi284/src/c$ gcc hello.c ~/workspace/homework/cmsi284/src/c$ ./a.out Hello, world
Now let's tell SVN about it:
TODO
At this point you're ready to commit or "check in" your
work. Only check in source code (like hello.c); never check in
"derived artifacts" (like a.out).
TODO
Now let's do something useful. Make a change to the code, something
like changing the text "Hello, world" to "Hola, mundo". Do it now.
We don't have to invoke svn add this time; that was already done.
But before we commit, let's get into the habit of running a
diff.
TODO - svn diff
That looks good, so commit:
TODO - svn commit again
Now you're working with version 2 of the repo, and the repository
is at version 2. If someone else — or you, from another computer —
checks out this file modifies it and checks in a new version, then the repository
will be at verion 3. Your local copy is now out of sync
with the repository. If you worked on your out-of-sync file and tried
to check in changes, SVN would complain. Before you work, you should
do a svn update. If no changes had been made you would see
something like this:
Here SVN is telling you that you have an unmanaged file in the workspace that it doesn't know about, which is actually as it should be. If some one had made a change (from another computer most likely), then the repsonse to the update would have been:
~/workspace/cmsi284/src/c$ svn update TODO
Update frequently when working on teams or from multiple computers.
svn add to inform
CVS that you wanted it to manage a file for you, before you were able
to commit? When removing a file, you have to do something similar.
Say svn remove filename to disassociate the file, and
then later, upon issuing svn commit the file will be removed
from the repository.These notes do not tell you how to use the SVN client in Eclipse. Like any tool, Eclipse's SVN client automates some mundane tasks for you and allows you to do complex tasks much faster, at the price of hiding some important functionality that you'll wish you knew the moment the tools fails you or just happens not to be there. Furthermore, if you get a job in a shop that does not use Eclipse, you'll be embarassed to admit your lack of commandline knowledge. Commandline svn is almost always faster. Eclipse pretty much only "helps" with complicated merges.
svn+ssh, the server is
svn.cs.lmu.edu, and your repository location
is something like /nfs/svn/alice.svn remove commands, either.
Simply deleting a file (from within Eclipse) is enough. When you
commit, the file will be removed from the repository.You really, really, really should master as much of SVN as possible. This means building up a repository and backfilling it with old assignments, tweaking old code and recommiting it, and so on. It also means outside reading and more and more practice. Some sites and books to get acquainted with include: