Title: Subversion
1Subversion
School of Computing FACULTY OF ENGINEERING
- An open-source revision control system, which
aims to be a compelling replacement for CVS.
Katarzyna Boronska
2- Using a control version system
3Why bother?
- Typical cases, when revision control is useful
- Ive changed something in my simulation between
two weeks ago and now and nothing works anymore! - I think one year ago my code was working with
these parameters! - I want to work on my code at home and at the
office. - I want to have a nice, working version, to give
away and keep my untested version to myself. - I want to share my code with a group of people.
4You may have heard of...
- Some version control systems
- SVN (Subversion)?
- Git
- CVS (Concurrent Version System)?
- Visual SourceSafe
- RCS
- Some other names for version control system
- revision control
- source control
- source code management
5Basic usage
- Create repository
- Import initial project
- Get the most recent version into a local
directory - Make changes locally (and test)?
- Submit changes to repository
once
everyday use
6Viewing differences
- View history of changes
- which files were changed
- when
- by which user
- what log messages say
- View changes with diff
7Sharing the code
- Create repository, import initial project.
- Set up access rights for others.
- Get the most recent version into a local
directory. - Make changes locally, test them.
- Update again, resolve conflicts, test.
- Register changes to repository.
once
everyday use
8Branching
branch
main trunk
initial import
v. 1.0
branch
time
- create branches
- compute differences between changes
- maintain, abandon branch or apply changes to the
main trunk
9 10Setting up the project repository
- Create repository
- gt svnadmin create /flow
- Import initial project
- gt svn import /tmp/flow file///home/kb/flow/trunk
-m "initial import" - For more than one user
- Set up access rights for others
- for your unix group (below)?
- with an SVN server, e.g. http/https server access
control (root task)? - gt cd /flowgt chmod grwx db db/transactions
db/revs db/revprops db/write-lock locksgt chmod
-R gr db db/revs db/revprops locksgt chmod -R
gr hooks
11Basic usage
- Get the code
- gt svn checkout file///home/kb/flow/trunk flow
- gt svn co svnssh//kb_at_comp.uk/home/kb/flow/trunk
flow - Update checked-out version
- gt cd flow svn update
- Review your changes
- gt svn status
- gt svn diff
- Make your changes
- Register your changes
- gt svn commit
once per location
everyday use
? heateq.kdevelop.pcs M
heateq.kdevelop ? src/heat M
src/adapted.h M src/f2c.c M config.h
write a log message, when prompted.
12Viewing differences
- revision numbering
- each commit - new revision number for the whole
project - view changes log
- gt svn log -r 102103
- view changes with diff
- gt svn diff adapted.h
- check out an old version
- gt svn checkout -r 54 file///home/kb/flow/trunk
flow_r54
Index adapted.h
--- adapted.h (revision 118)?
adapted.h (working copy)? _at__at_ -28,7 28,7 _at__at_
typedef struct node d_t posX, posY - d_t
cval, cold d_t hval, pval, cold struct node
next struct node top struct node
left _at__at_ -98,15 98,16 _at__at_
--------------------------------------------------
---------------------- r102 kb 2008-09-09
111346 0100 (Tue, 09 Sep 2008) 1
line Switched to GSL (GNU Scientific Library)
CBLAS. Now we don't need any longer Jan's
pre-compiled ../header and ../lib
directories. -------------------------------------
----------------------------------- r103 kb
2008-09-24 152823 0100 (Wed, 24 Sep 2008) 2
lines Switched from absolute to relative
tolerance in the "exact" solver in
v_cycle. Removed COARSEST_LEVEL lt MIN_LEVEL
condition from main. -----------------------------
-------------------------------------------
13Other basic commands
- add
- gt svn add stencil_9points.c
- delete
- gt svn delete stencil_simple.c
- info
- revert
- gt svn revert stencil_simple.c
- merge
- export
- gt svn export file///home/kb/flow/trunk
flow_2009_01_20 - copy
- gt svn copy file///home/kb/flow/trunk
\file///home/kb/flow/tags/v_beta -m "tagging
ver. beta"
14Common traps
- working on an out-of-date version
- neglecting log messages
- committing too seldom
- working on non-subversion version
- forgetting to add files, if working with only one
check-out
15Graphical clients
- KDevelop
- Eclipse
- Anjuta
- TortoiseSVN
- RapidSVN
- SmartSvn
- eSVN
- Subcommander
- TkSVN
- emacs
users choice, per location
16KDevelop
17RapidSVN
18