Full information on svn and its sub-commands can be read in
Chapter 9 of the subversion book. Subversion prints nice help
information if you issue svn help or svn help
subcommand at the prompt.
There are many different switches for the sub-commands, some of them
are quite general such as these
- -r number where number is a revision
number or revision keyword (HEAD, BASE,
COMMITTED, or PREV). To compare version within the
repository itself use -r number:anothernumber. A specific
date, or a range, can be used. Put the date inside curly braces
(many formats are supported whereof we show one below). You can even
refer to date specified revisions mixed with numbered revisions.
- HEAD The latest revision in the repository.
- BASE The “pristine” revision of an item in a
working copy.
- COMMITTED The last revision in which an item
changed before (or at) BASE.
- PREV The revision just before the last revision in
which an item changed. (Technically, COMMITTED-1.)
- DATE example: svn log -r 2005-01-27:2005-02-21
- -v will give more information in many svn
sub-commands.
- -N Run non-recursively.
Not all svn sub-commands are needed in normal use. Here we
list them in some sort of groups.
- checkout You can check out any sub-directory you want
but are recommended to check out the root level directory. Following
the recommendation of the svn book the main trunk is in the
repository trunk directory. So, you should do
svn
checkout http://base.thep.lu.se/svn/trunk base
The last base tells
svn to checkout the main trunk into a sub-directory base. If you omit
base, svn will place the checked out files into sub-directory trunk.
- update Update (synchronise) your working copy. If a
conflict occurs, svn creates temporary files containing different
revisions of the conflicting item. You need to resolve the conflict,
and use svn resolved to tell subversion that you resolved the
conflict.
- add Schedule files, directories, or symbolic links to
be added to the repository. This command is recursive, use -N
to prevent recursiveness.
- delete Schedule files, directories, or symbolic links
to be removed from the repository. (What happens if the directory is
non-empty? Need testing.)
- copy Copy items and schedule them for addition into
the repository. Inherits history information.
- move Move items, i.e., perform svn copy; svn
delete
- status Reports all changes made in the working
directory. There are many different status codes, please refer to
Chapter 9 in the svn book for the list of codes. Recursive. -v
switch will output information about every item in the working
copy. -u will report whether items in the
working copy is out of date.
- diff Prints file changes in unified diff
format. Useful for creating patches, svn diff patchfile. With no
switches, comparison is done against the pristine working copy,
i.e., only locally changed files will show differences. Use -r for
comparison against the repository.
- revert Reverts the item to its previous state,
i.e., changes are disregarded and item restored, and any (svn)
scheduled tasks are reset.
- resolved Tell subversion that you resolved a
conflict. Issuing this command will remove the temporary files
created by svn update when a conflict is spotted by
subversion. There are other ways of resolving conflicts but use this
command. Subversion will not accept a commit until conflicts are
resolved. Note, you must specify item in the command, and be careful,
if you do svn resolved, subversion accepts this without checking
that you really resolved the conflict and will subsequently accept a
commit without making a fuss.
- commit Commit your changes. Tree changes are
performed in the repository when you issue commit. Use -m "My
message." to supply a log message, or if you prefer to write an essay in a
file, you can use
--file
filename. If you
omit the message, then an external editor is launched. A commit is
refused if you try to commit out of date items.
- log Shows you broad information: log messages
attached to revisions, and which paths changed in each
revision. Verbose information available, -v. Recursive.
- cat This is used to retrieve any file as it existed
in a particular revision number and display it on your screen.
- list Displays the files in a directory for any given
revision.
- cleanup Will cleanup subversion if subversion ended
up in an undefined state due to unexpected interruption during some
subversion command. Locks can be resolved with this command.
- import A quick way to copy an unversioned tree of
files into a repository, creating intermediate directories as
necessary.