Subversion 1.
5 Version
Control Tool
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
Topics Of Discussion
What is Subversion
Fundamental Concepts
Repository
How Subversion handles Repository
Difference between Subversion and clearcase
Working copy
Revisions
Working Copy Detailed Discussion -- Basic Usage
Creating Working copy
Adding Data into the Repository
Make Changes in Working Copy
Update
Commit
History
Branching and Merging
How Revision works
Installation Instruction
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 2
What is Subversion
Subversion is a free/open-source version control system. Collabnet is a company
hosting Subversion tool as a service
CollabNet Subversion manages files and directories, and the changes made to
them
This tool allows you to recover older versions of your data, or examine the
history of how data changed.
CollabNet Subversion can operate across networks, which allows it to be used
by people on different computers. At some level, the ability for various people to
modify and manage the same set of data from their respective locations fosters
collaboration.
Subversion is also called as Standalone Software Configuration Management
(SCM)
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 3
Fundamental Concepts
The Repository
The repository is central store of data.
The repository stores information in the form of a file system tree a
typical hierarchy of files and directories.
Any number of clients connects to the repository, and then read or
write to these files.
Equivalent to VOBs in ClearCase, It allows all changes in the file
systems and can be retrieved in any level
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 4
Fundamental Concepts
Difference Between Subversion and Clearcase
Property Subversion ClearCase
Need to pay for ClearCase licenses and
Cost SVN is free and open source for support as well
FSFS (Fast Secure File System ) /
Data Base Berkeley DB RHYMA
Supported (known as working
Workspace Snapshot copy) Supported
Workspace Dynamic Not Supported Supported
Supported (known as working
Workspace Snapshot copy) Supported
checkout reserved Yes (optional) Yes (Default)
checkout unreserved Yes (Default) Yes (optional)
At any point of time only one Multiple branch/version selection
Version selection for work revision based selection possible through Configuration Spec
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 5
Fundamental Concepts
How Subversion handles Repository
Subversion uses URLs to identify versioned files and directories in
repositories.
Exp: http://fiscbanla810226/svn/
This will be used in downloading needed files and directories from the
repository to the working copy.
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 6
Fundamental Concepts
Working Copy
A Subversion working copy is an ordinary directory tree on your local
system, containing a collection of files.
Working copy will usually correspond to a particular sub tree of the
repository.
Subversion will never incorporate other people's changes, nor make
your own changes available to others, until you explicitly tell it to do so.
Subversion has publish (commit) and update commands to make
working directory changes visible to others or make your working
directory up to date.
Conti….
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 7
Fundamental Concepts
Working Copy
Working directory will contain some extra files created and maintained
by subversion to carry out these operations. In particular .svn subdirectory
will be there in each directory.
The checkout records are not maintained in the server
Please don’t delete these folders (.svn) as these are subversion
maintained administrative files and folders to track the modified files/dir.
Creating, maintaining working copy will be explained in coming slides.
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 8
Fundamental Concepts
Revisions
A.c B.c C.c
1 2 3 Revision 3
state of file system
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 9
Fundamental Concepts
Revisions
Exp Shown Here :
A.c B.c C.c
1 2 3
Revision 4
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 10
Fundamental Concepts
Revisions
Exp Shown Here :
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 11
Fundamental Concepts
Revisions
This is state of file system (Repository).
Changes to a fix should be committed (checked-in) in Single
transaction so that is easy to refer to files that were part of the fix and
is a industry best practice
This means commit statement will publish changes to any number of
files and directories as a single transaction.
Each revision is assigned a unique natural number, one greater than the
number of the previous revision.
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 12
Working Copy detailed discussion
Basic usage
Creating Working copy
Command: svn checkout URL[@REV]... [PATH]
This command will help creating working copy of a repository in
local disk.
Example :
svn checkout http://fiscbanla810226/svn/Folder_Name
C:\svn\Folder_Name
We can also choose any revision by mentioning the revision number.
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 13
Working Copy detailed discussion
• TortoiseSVN (GUI ) Version
• Working copy creation in TortoiseSVN
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 14
Working Copy detailed discussion
Adding Data into the Repository
There are two ways to get new files into your
Subversion repository: import and add.
Command:
svn import D:/Test_Folder -m "Initial import"
This command is used to add the project into
existing repository.
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 15
Working Copy detailed discussion
TortoiseSVN (GUI ) Version
Select the top-level folder of project directory structure in the windows explorer and right
click to open the context menu. Select the command TortoiseSVN → Import... which brings
up a dialog box.
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 16
Working Copy detailed discussion
Adding files and folders to the repository
Command: svn add PATH...
This command will add files/folders in current working copy
Then commit will send changes done in working copy
TortoiseSVN (GUI) Version of add command
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 17
Working Copy detailed discussion
Make Changes in Working Copy
Commit:
Command: svn commit
This will update the changes done in working copy to the repository.
Update :
Command: svn update
This will update repository, as changes made in working copy.
Exp: svn update
U Testing.c
Updated to revision 7.
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 18
Working Copy detailed discussion
Make Changes in Working Copy
Commit and update options in TortoiseSVN
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 19
Working Copy detailed discussion
Make Changes in Working Copy
History:
To find information about the history of a file or directory,
There are several commands that can provide you with historical data
from the repository.
svn log
Shows you broad information: log messages with date and author
information attached to revisions, and which paths changed in each
revision.
Command: svn log
This command provides the information about who made the changes,
which revision, date and time etc ….
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 20
Working Copy detailed discussion
Make Changes in Working Copy
Exp:
svn log
-----------------------------------------------------------------------
r3 | Srikanth | Mon, 15 Jul 2002 18:03:46 -0500 | 1 line
Added include lines and corrected # of cheese slices.
-----------------------------------------------------------------------
r2 | Srikanth| Mon, 15 Jul 2002 17:47:57 -0500 | 1 line
Added first method!!!
------------------------------------------------------------------------
r1 | Srikanth| Mon, 15 Jul 2002 17:40:08 -0500 | 1 line
Initial check-in
-----------------------------------------------------------------------
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 21
Working Copy detailed discussion
svn diff
Shows line-level details of a particular change.
Command: svn diff
With no option will compare working files to the cached
“pristine” copies in the .svn area.
With –r <number> <file_name> will fetch us the difference
between working copy and particular revision in the
repository.
With –r <number1:number2> <file_name> will fetch us the
difference between two revisions the repository.
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 22
Working Copy detailed discussion
svn cat
• Retrieves a file as it existed in a particular revision number
and display it on your screen.
• Command: svn cat –r <Number> <file_name>
• Will fetch the content of the file @ revision <number>.
svn list
• Displays the files in a directory for any given revision.
• Command: svn list –r <number>
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 23
Branching and Merging
Branch:
Concept of Branching is to maintain line of development
independent of each other.
Branching in subversion is nothing but a copying the
files/folders using svn copy.
Command to create branch (copy)
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 24
Branching and Merging
Exp:
D:\Srikanth_Rep\Play>svn copy trunk/*.*
branches/Dev_Test
svn: Skipping argument: 'trunk/.svn' ends in a reserved name
A branches\Dev_Test\First.txt
A branches\Dev_Test\second.txt
This will copy (add) all files and folders in trunk folder
to branches/Dev_test folder.
Then if you commit branches folder to
repository then the revision graph of file first.txt looks
something similar to this.
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 25
Branching and Merging
Branches
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 26
Branching and Merging
Merge :
Branches are used to maintain separate lines of development, at some stage it has to merge
back into the Main development branch
Merge always happen with the working copy to the branch from which we need to merge
Good Practice of merging is to keep unmodified working copy.
3 ways of merging is handled by Subversion
Merge a range of revisions
Subversion will Calculate the changes necessary to get [FROM] revision M of branch A
[TO] revision N of branch A, and apply those changes to my working copy (of trunk or
branch B).
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 27
Branching and Merging
Merge :
Reintegrate a branch
This Method covers the case where from branch is in sync with to branch changes and
extra changes done in from branch.
After the merge from branch and to branch are same.
Merge two different trees
This is a more general case of the reintegrate method
Calculate the changes necessary to get [FROM] the head revision of the trunk [TO] the head
revision of the branch, and apply those changes to my working copy (of the trunk).
The net result is that trunk now looks exactly like the branch.
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 28
Branching and Merging
Merge :
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 29
Branching and Merging
Merge :
Merge Option in TortoiseSVN
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 30
Branching and Merging
Merge :
Three Variations of merge in TortoiseSVN
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 31
Branching and Merging
Merge :
Merge a range of revisions
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 32
Branching and Merging
Merge :
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006 Reintegrate a branch
CollabNet Subversion1.5 . 33
Branching and Merging
Merge :
Merge two different trees
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 34
Branching and Merging
Merge :
Conflict in Merge
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 35
Branching and Merging
Merge :
Conflict in Merge
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 36
Working Copy detailed discussion
How Revision works
As we know revision is state of fileset
Revision # work in downloading files.
In this case SVN will take single atomic transaction
for updation.
Like as shown in picture.
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 37
Working Copy detailed discussion
How Revision works
Revision # works in merge
In this case SVN expect Revision # should be part of
that branch otherwise merge will finish without
proper result.
Means If we want to merge Vista branch to main
branch and assuming as a single atomic transaction, if we
give 63 merge will not give proper results.
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 38
Installation instruction
The document will contain the complete
information on how to install Subversion on
windows with GUI Tortoise SVN.
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 39
Q&A
Thank You
FIDELITY INVESTMENTS I CONFIDENTIAL INFORMATION 2006
CollabNet Subversion1.5 . 40