Basic subversion commands

There is a very good documentation for subversion available, the svn book:

http://svnbook.red-bean.com/

There are also several quick references are around, for example:

http://www.digilife.be/quickreferences/QRC/Subversion%20Quick%20Reference%20Card.pdf

Short command list

Always keep in mind that there are two different things: the repository (usually residing on a server) and your local copy ("checkout").

The commands usually take some arguments; a path, a revision number, a username. Take a look into the detailed documentation for this.

A rule of thumb is: whenever you change something in the repository (server-side), then add a comment with the -m flag for on-line comments or the -F $FILENAME flag, which appends the file of the appropriate name.

Commands that change nothing

svn info -- tells you the URL of the repository and its root directory, as well as the revision number of your checkout

$ svn info
Path: .
URL: https://svnsrv.desy.de/desy/marlintpc/trunk
Repository Root: https://svnsrv.desy.de/desy/marlintpc
Repository UUID: 41c05227-d42d-0410-9319-85d422a44614
Revision: 2288
Node Kind: directory
Schedule: normal
Last Changed Author: rosem
Last Changed Rev: 2282
Last Changed Date: 2010-10-11 11:47:09 +0200 (Mon, 11 Oct 2010)

svn status -- compares your local copy to the version at the repository (check svn info for which repository path!) and and yields a list of files and attributes that have changed or are unknown

$ svn status
?       cdb.log
?       doc/html

svn log -- gives you the complete log file, which are the log messages that are sent along with commits (you might want to pipe it to less/more)

$ svn log | less
------------------------------------------------------------------------
r2282 | rosem | 2010-10-11 11:47:09 +0200 (Mon, 11 Oct 2010) | 1 line

My wrong, somehow the root CMakeLists.txt was mixed up with the one from the reco dir
------------------------------------------------------------------------
r2280 | rosem | 2010-10-08 17:29:18 +0200 (Fri, 08 Oct 2010) | 1 line

Reverting an involuntary change -- sorry from my part.
...

Commands that change your local copy

svn checkout -- actually the command that creates your local copy

$ svn co https://svnsrv.desy.de/desy/marlintpc/trunk
A    trunk/analysis/src/PadResponseProcessor.cc
A    trunk/analysis/src/TimePixOccupancyProcessor.cc
[...]
A    trunk/examples/reconstruction_straight_tracks/README
A    trunk/examples/reconstruction_straight_tracks/dumpPadCentres.xml
 U   trunk
Checked out revision 2291.

svn update -- updates your local copy to the latest revision of the repository

$ svn update
At revision 2291.

svn add/svn remove -- adds or removes a file to version control, needs a commit afterwards

Commands that change the repository

svn commit -- commits all changes

svn copy -- make a shallow (=cheap) copy of an existing path

A usual session

Usually you will have your own working branch in the repository (how to create it is described elsewhere: HowToDevelopMarlinTPC).

First you will checkout your branch (I choose the kerberos authentication for simplicity, the other methods work the same way, but the repository paths are consistently different):

$ svn co https://svnsrv.desy.de/desy/marlintpc/branches/rosem
[...]

Then you will do your modifications. The status command (invoked from the local base directory) shows which files have changed:

$ svn status
M       reconstruction/include/PulseFinderProcessor.h                                                                                                                                                             
M       reconstruction/src/PulseFinderProcessor.cc         

Since you made sure that everything is correct (or just want to save your work for the day), you commit your changes, commenting on it for later reference:

$ svn commit -m"updating my stuff"
Sending        reconstruction/include/PulseFinderProcessor.h
Sending        reconstruction/src/PulseFinderProcessor.cc
Transmitting file data ..
Committed revision 2010.

MarlinTPC: BasicSubversionCommands (last edited 2010-10-18 15:04:52 by ChristophRosemann)