This site holds the basic information needed to be able to use the
repositories located in the tacs users home directory.
It used to be a CVS-repository, but it has been converted to Subversion.
This has been done for 2 reasons
To read this tutorial you need to be familiar with
a few Unix/Linux command line tools:
ls - list content of (current) directory
cd - change directory
pwd - print working directory
mkdir - make directory
ln - make link between files (or directories)
Bart and Lisa want's to collaborate on an essay, both of them being nerds
Latex is naturally the tool of choice. Lisa starts writing the essay
and emails her introduction to Bart. Bart is pleased with the results
but makes a few alterations, and sends it back to Lisa. Some of the
typos that Bart has located, Lisa has already found, but she manually
finds out which new improvements Bart has found, and sends the latest
version back to Bart. At this point, Bart has made a few alterations
to the introduction, which he tries to "brade" into the latest version
from Lisa. Both of them being long time Linux users, 'diff' and 'patch'
are heavily used to make one essay of the two versions.
At some point they agree that the only way this collaboration will ever work
is by a strict regime which only lets one of them work on the essay on a given
day. Lisa uses one of her days off to google the web for some
version control tools, and locates CVS , Subversion and darcs .
Lisa being the clever one, understands right away that Subversion is the tool
of choice since Bart always has a bit of a struggle with technical things.
Lisa sets up a repository on her home directory at the University of Oslo.
This is only a matter of creating a directory and using the svnadmin create tool
nelja:lisas> cd /hom/lisas/ nelja:lisas> mkdir svnroot nelja:lisas> svnadmin create /hom/lisas/svnroot
Lisa has her version of the essay located in one of her subdirectories at the University
so she imports this directory as the main working directory. The directory which
holds her essay is called theEssay .
nelja:lisas> svn import /hom/lisas/theEssay file:///hom/lisas/svnroot/theEssay -m "initial import"
Naturally Lisa wants a controlled version of her 'essay directory' on her ifi-account
so she creates a directory where she can have her version controlled files.
nelja:lisas> cd /hom/lisas nelja:lisas> ls svnroot theEssay www_docs nelja:lisas> mkdir svn nelja:lisas> ls svnroot theEssay www_docs svn
Now all Lisa has to do is to check out a version which is stored in the
Lisa already has these files in the theEssay directory naturally, but
these files are not under version control, so to avoid all the emailing and
administration that this collaboration led to, she will use a version
controlled set of files from now on.
Lisa does a checkout of the version controlled theEssay directory
nelja:lisas> cd svn nelja:svn> svn checkout file:///hom/lisas/svnroot/theEssay nelja:svn> ls theEssay
The directory she imported into Subversion has now been
checked out somewhere else in her file-tree, at first site they
seem to be identical.
But then she notices that there is a new directory called .svn
located inside the checked out version of theEssay directory.
The original theEssay directory looked like this:
theEssay/ | |-- collaboration.aux |-- collaboration.dvi |-- collaboration.log |-- collaboration.ps `-- collaboration.tex
The directory checked out from Subversion looks like this:
theEssay/ | |-- .svn | |-- README.txt | |-- empty-file | |-- entries | |-- format | |-- prop-base | |-- props | |-- text-base | |-- tmp | | |-- prop-base | | |-- props | | |-- text-base | | `-- wcprops | `-- wcprops | |-- collaboration.aux |-- collaboration.dvi |-- collaboration.log |-- collaboration.ps `-- collaboration.tex
Lisa being clever, understands rigth away that this is how Subversion
keeps track of how files develope over time, namely by keeping
copies of the original files in some directory (.svn), and then comparing these
to the ones in the original directory. This way Subversion can immediately see what files
have been modified and which files haven't. Next time Lisa uploads her changes
Subversion will only have to upload actual changes, since the files
that are not modified will be identical, and that way we save a lot of time
by only uploading/downloading changes, not the entire new set of files.
Lisa notices a few typos in the collaboration.tex file rigtht away,
and decides to make a few changes to this file. After that has been
done she saves the file, and wants to know whether Subversion has noticed
her modification of the file. After reading a bit on the internet
she notices the Subversion command status which
should be able to tell her what sort of status Subversion thinks
this file is in.
nelja:svn> ls theEssay nelja:svn> cd theEssay (this is the version controlled 'theEssay' directory) nelja:theEssay> ls collaboration.aux collaboration.dvi collaboration.log collaboration.ps collaboration.tex nelja:theEssay> svn status M theEssay/collaboration.tex
Lisa thinks this means that Subversion
believes the file collaboration.tex has been modified (M).
Lisa decides to upload (commit) her changes to the
repository and call up Bart with the good news!
nelja:lisas> cd svn/theEssay nelja:lisas> svn commit -m "Lisa's first upload of new collaboration.tex"
Now Lisa has to persuade Bart to use this incredibly adwanced technology
to make this essay collaboration work.
Bart immediately says this Subversion stuff is way to hard to learn, and claims that the
old way of doing it was just as good, in fact maybe even better.
After a couple of days of arguing Bart checks out the repository
"just to shut her up", and starts working with the files in that directory
instead of his old directory, admitting after a while that it feels almost the same.
A repository is nothing but a file-tree with some
meta-information about the files in the .svn directories.
Typical usage 1:
Typical usage 2:
-- check out repository when logged in on ifi nelja:bjarneh> mkdir -p where/i/would/like/to/have/my/repository nelja:bjarneh> cd where/i/would/like/to/have/my/repository nelja:repository> svn checkout file:///ifi/fenris/p13/tacs/svnroot/trunk nelja:repository> ls trunk kurs papers tex svn-book.pdf -- check out repository using ssh (must be member of tacs-group) nelja:bjarneh> mkdir tacs nelja:bjarneh> cd tacs nelja:tacs> pwd /ifi/fenris/i03/bjarneh/tacs nelja:tacs> ln -s /ifi/fenris/p13/tacs/svnroot/ . nelja:tacs> ls svnroot now you have a symbolic link to the repository tree and you know where your home directory is located the following takes place on a local machine far far away bjarneh@localmachine$ mkdir -p where/i/would/like/to/have/my/repository bjarneh@localmachine$ cd where/i/would/like/to/have/my/repository bjarneh@localmachine$ svn checkout svn+ssh://email@example.com/ifi/fenris/i03/bjarneh/tacs/svnroot/trunk password: password: password: bjarneh@localmachine$ ls trunk kurs papers tex svn-book.pdf (FIRST TIME YOU CHECK OUT, PASSWORD MUST BE WRITTEN 3 TIMES!!!)
-- modify a file in repository (REGULAR MODIFICATION) nelja:bjarneh> cd path/to/local/repository nelja:repository> emacs src/java/SomeFile.java * make some alterations * nelja:repository> svn status M src/java/SomeFile.java (Subversion states that this file has been locally modified) -- modify a file in repository (REMOVE) nelja:bjarneh> cd path/to/local/repository nelja:repository> svn rm src/java/SomeFile.java nelja:repository> svn status D src/java/SomeFile.java (Subversion states that this file has been deleted locally) -- modify a file in repository (MOVE) nelja:bjarneh> cd path/to/local/repository nelja:repository> svn mv src/java/SomeFile.java new/path/to/file/ nelja:repository> svn status D src/java/SomeFile.java A new/path/to/file/SomeFile.java (Subversion states that this file has been locally moved) -- modify repository (ADD CONTENT) nelja:bjarneh> cd path/to/local/repository nelja:repository> mkdir newDirectory nelja:repository> echo "im a new file" > newDirectory/newFile.txt nelja:repository> svn status ? newDirectory (Subversion states that this directory is not under version control) nelja:repository> svn add newDirectory A newDirectory A newDirectory/newFile.txt (Subversion adds content recursively)
-- commit your changes on entire repository nelja:bjarneh> cd path/to/repository nelja:repository> svn commit -m "this message will show up in the commit-log" -- commit your changes on single file nelja:bjarneh> cd path/to/repository nelja:repository> svn commit path/to/file.txt -m "commiting changes to file.txt for some reason"
-- update entire repository: nelja:bjarneh> cd path/to/local/repository nelja:repository> svn up -- update someFile.txt in repository: nelja:bjarneh> cd path/to/local/repository nelja:repository> svn up path/to/SomeFile.txt
nelja:bjarneh> cd path/to/repository nelja:repository> svn up Updated to revision 23 C src/java/ThreadMaster.java nelja:repository> ls src/java/ThreadMaster.java* ThreadMaster.java ThreadMaster.java.mine ThreadMaster.r22 ThreadMaster.r23 you have three choices - merge conflict by hand - copy on of the temporary files on top of the ThreadMaster.java file - svn revert ThreadMaster.java (remove your own changes on the file) nelja:repository> less src/java/ThreadMaster.java <<< .mine import java.util.Fector; === import java.util.Vector; >>> .r23 you can modify the file, remove the temporary files by hand (rm ThreadMaster.r* ThreadMaster.mine) or run nelja:bjarneh> svn resolved TO GET THE FULL STORY CHECKOUT THE REPOSITORY AND READ trunk/svn-book.pdf
comments can be mailed to: bjarneh