SlideShare a Scribd company logo
Subversion Control System
Sriee Gowthem Raaj
1
Sriee Gowthem RaajBy
Subversion Control System
Sriee Gowthem Raaj
2
Table of Contents
Introduction ..........................................................................................................................................10
What is this tutorial about? ..............................................................................................................10
What is subversion?..........................................................................................................................10
Tortoise SVN......................................................................................................................................10
Problems in Versioning Model..........................................................................................................11
Methodology 1 – Lock-Modify-Unlock .............................................................................................12
Merits............................................................................................................................................13
Demerits........................................................................................................................................13
Methodology 2 – Lock-Modify-Unlock .............................................................................................14
Repository.............................................................................................................................................16
What is a repository?........................................................................................................................16
How to create a repository? .............................................................................................................16
Why is repository asking for a folder structure? What is it? ............................................................17
Practical Illustration of Folder Structure.......................................................................................18
Scenario of Layout Usage..............................................................................................................19
Importing ..............................................................................................................................................21
What is importing?............................................................................................................................21
How to import data into the repository?..........................................................................................21
Be careful with the location!.............................................................................................................21
Scenario 1: What happens when project location is not specified properly?..............................22
Scenario 2: How to specify the project location? .........................................................................23
Working Copy & Checkout....................................................................................................................25
What is Working Copy & Checkout?.................................................................................................25
How to checkout data from the repository? ....................................................................................25
What is checkout depth?..................................................................................................................26
Fully Recursive ..............................................................................................................................26
Immediate Children, including folders..........................................................................................27
Only file children...........................................................................................................................27
Only this item................................................................................................................................27
Choose item ..................................................................................................................................28
What are Revisions?..........................................................................................................................28
Action Items..................................................................................................................................29
Subversion Control System
Sriee Gowthem Raaj
3
Revisions Terminology ..................................................................................................................29
Commit..................................................................................................................................................31
What is committing?.........................................................................................................................31
How to commit?................................................................................................................................31
Features of Commit dialog box.........................................................................................................32
Update ..................................................................................................................................................37
What is an update?...........................................................................................................................37
Why we need to update?..................................................................................................................37
How to do an update? ......................................................................................................................37
Sparse Update...................................................................................................................................38
What is sparse update?.................................................................................................................38
Update conflicts................................................................................................................................41
To avoid conflicts? ........................................................................................................................41
Resolving Conflicts ................................................................................................................................44
What is a conflict?.............................................................................................................................44
Resolving File Conflicts......................................................................................................................44
How to resolve a conflict?.................................................................................................................45
Resolving Tree Conflicts....................................................................................................................45
How to resolve Tree conflicts?..........................................................................................................45
Locking ..................................................................................................................................................49
What is locking?................................................................................................................................49
How to lock? .....................................................................................................................................49
Ignore....................................................................................................................................................53
Purpose of ignoring?.........................................................................................................................53
How to Ignore? .................................................................................................................................53
Remove Ignore..................................................................................................................................55
Change Lists ..........................................................................................................................................57
What are changelists?.......................................................................................................................57
How to add changelist?.....................................................................................................................58
Icons Overlay.........................................................................................................................................61
Adding Files...........................................................................................................................................63
Copy/Moving.........................................................................................................................................63
Renaming ..............................................................................................................................................64
Subversion Control System
Sriee Gowthem Raaj
4
Before Commit:.................................................................................................................................64
On commit: .......................................................................................................................................64
Drawbacks:........................................................................................................................................64
How to prevent this? ........................................................................................................................64
Deleting Files/Folders ...........................................................................................................................65
Undo Changes.......................................................................................................................................66
Exporting Working Copy .......................................................................................................................67
Relocation a Working Copy...................................................................................................................68
Branching/Tagging ................................................................................................................................70
What is a Branch? .............................................................................................................................70
What is Tag?......................................................................................................................................70
How to Branch/Tag? .........................................................................................................................70
Switching...........................................................................................................................................72
How to Switch? .............................................................................................................................73
Creating/Apply Patch............................................................................................................................75
What is a patch? ...............................................................................................................................75
How to create a patch?.....................................................................................................................75
Apply Patch .......................................................................................................................................77
Merging.................................................................................................................................................80
What is merging?..............................................................................................................................80
Methods in merging..........................................................................................................................81
Merging range of revisions ...........................................................................................................81
Merging two different trees .........................................................................................................83
Merge Option....................................................................................................................................84
Subversion properties...........................................................................................................................86
Features of SVN properties...............................................................................................................86
SVN Tools ..............................................................................................................................................97
Repo-Browser ...................................................................................................................................97
Revision Log ......................................................................................................................................98
Statistics......................................................................................................................................106
SVN supports the following graphical formats ...........................................................................107
Tortoise Merge................................................................................................................................108
Tortoise IDiff ...................................................................................................................................109
Subversion Control System
Sriee Gowthem Raaj
5
Blame Differences...............................................................................................................................111
What is Blame? ...............................................................................................................................111
Subversion Control System
Sriee Gowthem Raaj
6
Table of Figures
Figure 1 Illustration of subversion system usage..................................................................................11
Figure 2 Developers A & B Checking out File........................................................................................11
Figure 3 Developers A & B saving files to the server ............................................................................11
Figure 4 Developer A reads & locks the file..........................................................................................12
Figure 5 Developer B gets read error when accessing the locked file..................................................12
Figure 6 Developer A releases lock and writes the file.........................................................................13
Figure 7 Developer B can now access the file.......................................................................................13
Figure 8 Developer A & B reads the same file ......................................................................................14
Figure 9 Developer A commits his changes to the server.....................................................................14
Figure 10 Developer B gets out of date error.......................................................................................14
Figure 11 Create Repository .................................................................................................................16
Figure 12 Create Folder Structure.........................................................................................................16
Figure 13 Folder --> Repository ............................................................................................................17
Figure 14 Repo Browser with URL ........................................................................................................19
Figure 15 Context Menu --> Import......................................................................................................21
Figure 16 Import Dialog Box .................................................................................................................21
Figure 17 Wrong Import .......................................................................................................................22
Figure 18 Repository messed up! .........................................................................................................22
Figure 19 Right Import..........................................................................................................................23
Figure 20 Project imported inside trunk...............................................................................................23
Figure 21 Context Menu --> SVN Checkout ..........................................................................................25
Figure 22 Checkout Dialog Box .............................................................................................................25
Figure 23 Checkout Depth option.........................................................................................................26
Figure 24 Checkout Depth - Fully Recursive .........................................................................................26
Figure 25 Checkout Depth - Immediate Children, including folders.....................................................27
Figure 26 Checkout Depth - Only file children......................................................................................27
Figure 27 Checkout Depth - Only this item...........................................................................................27
Figure 28 Checkout Depth - Choose Item.............................................................................................28
Figure 29 Revision Log ..........................................................................................................................28
Figure 30 Revision usage.......................................................................................................................29
Figure 31 Context Menu --> SVN Commit.............................................................................................31
Figure 32 Commit dialog box ................................................................................................................31
Figure 33 Features of Commit Dialog ...................................................................................................32
Figure 34 Adding project specific text ..................................................................................................33
Figure 35 Change list.............................................................................................................................34
Figure 36 Commit Finished ...................................................................................................................35
Figure 37 Context Menu --> Update.....................................................................................................37
Figure 38 Update finished.....................................................................................................................37
Figure 39 Update to Revision - Repo Browser......................................................................................38
Figure 40 Update to Revision - Working copy ......................................................................................39
Figure 41 Update to Revision dialog box ..............................................................................................39
Subversion Control System
Sriee Gowthem Raaj
7
Figure 42 Update to Revision Scenario.................................................................................................40
Figure 43 Update Conflict .....................................................................................................................41
Figure 44 Context Menu --> Check for Modification ............................................................................41
Figure 45 Check for modification..........................................................................................................42
Figure 46 File in Conflict........................................................................................................................44
Figure 47 Conflicted area......................................................................................................................45
Figure 48 Context Menu --> Resolve.....................................................................................................45
Figure 49 Context Menu --> Get Lock...................................................................................................49
Figure 50 Get Lock Dialog Box...............................................................................................................49
Figure 51 Lock Finished Dialog Box.......................................................................................................50
Figure 52 Lock status.............................................................................................................................50
Figure 53 Use of "Check for Modification" in locking...........................................................................51
Figure 54 Context Menu --> Ignore.......................................................................................................53
Figure 55 Ignore multiple files ..............................................................................................................54
Figure 56 After Ignore...........................................................................................................................54
Figure 57 After Ignore Commit .............................................................................................................54
Figure 58 Checking Ignore.....................................................................................................................54
Figure 59 Remove Ignore......................................................................................................................55
Figure 60 Without Change list ..............................................................................................................57
Figure 61 Adding Change list ................................................................................................................58
Figure 62 With Changelist.....................................................................................................................59
Figure 63 Adding files - Right Drag........................................................................................................63
Figure 64 Right Drag - Copy/Move........................................................................................................63
Figure 65 Repair Move..........................................................................................................................65
Figure 66 Context Menu --> Delete ......................................................................................................65
Figure 67 Context Menu --> Revert ......................................................................................................66
Figure 68 Revert Dialog Box..................................................................................................................66
Figure 69 Context Menu --> Export.......................................................................................................67
Figure 70 Right Drag Export..................................................................................................................67
Figure 71 Relocate Dialog Box ..............................................................................................................68
Figure 72 Not a root error.....................................................................................................................68
Figure 73 Context Menu --> Branch/tag...............................................................................................70
Figure 74 Branch/tag dialog box...........................................................................................................71
Figure 75 After Branch/tag ...................................................................................................................72
Figure 76 Context Menu --> Switch ......................................................................................................73
Figure 77 Switch dialog box ..................................................................................................................73
Figure 78 Context Menu --> Create Patch ............................................................................................75
Figure 79 Create patch dialog box ........................................................................................................76
Figure 80 Patch file ...............................................................................................................................77
Figure 81 Context Menu --> Apply Patch..............................................................................................77
Figure 82 Tortoise Merge......................................................................................................................78
Figure 83 Merge Wizard........................................................................................................................80
Figure 84 Merge range of revision........................................................................................................81
Subversion Control System
Sriee Gowthem Raaj
8
Figure 85 Merge --> Show Log ..............................................................................................................82
Figure 86 Merge Two Different trees ...................................................................................................83
Figure 87 Test Merge............................................................................................................................84
Figure 88 Property dialog box...............................................................................................................86
Figure 89 Import Property ....................................................................................................................87
Figure 90 After Import ..........................................................................................................................87
Figure 91 Default properties.................................................................................................................88
Figure 92 New --> Other .......................................................................................................................88
Figure 93 End of Line style....................................................................................................................88
Figure 94 Windows properties..............................................................................................................89
Figure 95 svn:exteranl property window..............................................................................................90
Figure 96 External property inserted....................................................................................................90
Figure 97 Setting external.....................................................................................................................90
Figure 98 Repo-Browser with external project.....................................................................................91
Figure 99 Minimum log size..................................................................................................................92
Figure 100 Language option..................................................................................................................92
Figure 101 MIME type...........................................................................................................................92
Figure 102 Properties............................................................................................................................94
Figure 103 Log Minimum size ...............................................................................................................94
Figure 104 Log Template.......................................................................................................................95
Figure 105 Repo-Browser .....................................................................................................................97
Figure 106 Revision Log ........................................................................................................................98
Figure 107 Top Pane - Revision Log ......................................................................................................99
Figure 108 Revision Log Tool tip ...........................................................................................................99
Figure 109 Context Menu Top Pane ...................................................................................................100
Figure 110 Unified Diff........................................................................................................................101
Figure 111 Compare with previous version........................................................................................102
Figure 112 pre-revprop-change error.................................................................................................103
Figure 113 pre-revprop-changed file..................................................................................................104
Figure 114 Before Editing....................................................................................................................104
Figure 115 After Editing ......................................................................................................................105
Figure 116 Copy to clipboard..............................................................................................................105
Figure 117 Bottom Pane .....................................................................................................................105
Figure 118 Tortoise Merge..................................................................................................................108
Figure 119 Tortoise IDiff .....................................................................................................................109
Figure 120 Context Menu --> Blame...................................................................................................111
Figure 121 Blame Dialog Box ..............................................................................................................111
Figure 122 Tool Tip on mouse hover ..................................................................................................112
Figure 123 Sticky selection..................................................................................................................113
Figure 124 Edit --> Go to Line .............................................................................................................113
Figure 125 Edit --> Find What .............................................................................................................114
Figure 126 Blame --> Context Menu...................................................................................................115
Subversion Control System
Sriee Gowthem Raaj
9
Introduction to
SVN
Subversion Control System
Sriee Gowthem Raaj
10
Introduction
What is this tutorial about?
This tutorial is about Subversion Control system. The series of articles in this blog takes about
various features of Tortoise SVN and how to implement them. I have explained these concepts with
reference to concepts and from a developer perspective.
This tutorial is for software professionals who are early in their career and are using subversion in a
day to day basis. Familiarity with subversion concepts gives you the base for understanding any
derivative of subversion systems.
This tutorial is not for professionals who are developing subversion software’s and who are
administrators of version control systems.
These articles are
1. Atomic (not dependent on other articles).
2. They can be used as reference if you are stuck with implementing any feature.
What is subversion?
It is an open source version control system. Subversion allows you manage files and folders along
with their changes over a period of time. It plays a key role in software development process. Since
each project involves developers working at different locations, organizations use subversion to
maintain their code base in a centralized location.
Subversion is a power tool for a developer’s tools kit. Learning its feature and how to implement
them will make your life easier as a developer.
I have tailored these articles using Tortoise SVN.
Tortoise SVN
Advantages in using Tortoise SVN are as follows
 User friendly GUI Tool
 Inbuilt tools – TortoiseIDiff, TortoiseMerge, Tortoise Repository Browser
 Overlay status icons representing the state of the files/folders
 Efficient tracking over the changes in a development life cycle
 It is an open source project developed under General Public License (GPL) making it free to
download and use for personal and professional projects
Subversion Control System
Sriee Gowthem Raaj
11
Figure 1 Illustration of subversion system usage
Problems in Versioning Model
Scenario: Two developers are working on a same module, there are few bugs in this module and it
has to be fixed by the developers.
Both the developers take the source code from a
central location. They start working on the code
to fix the bug assigned to them.
Each developer has made changes to the code
and has fixed the bugs assigned to each of
them.
Figure 2 Developers A & B Checking out File
Figure 3 Developers A & B saving files to the
server
Subversion Control System
Sriee Gowthem Raaj
12
Now they have to paste the modified code back to the whole projects location.
Developer 1 pastes his modified code to the server. After that Developer 2 pastes his modified code
to the server overwriting the changes made by developer 1.
The problems are
1. Each developer does not have any idea about other developer changes
2. Both the developers are working on the same source code. There is a possibility that
overwriting occurs often
3. The scenario illustrated is simple involving only 2 developers. Imagine the complexity for a
huge project involving teams working offshore and onsite.
There are two methodologies discussed below for solving the above problem.
Methodology 1 – Lock-Modify-Unlock
 Developer A reads the file for the
module assigned for him from the
server.
 He locks the file so that others can’t
access the file unless he writes the file
and unlocks it.
 Developer A can start modifying the
code to fix the bug assigned to him.
Figure 4 Developer A reads & locks the file
 Developer B tries to read the file in the
same module.
 Developer B gets an error for accessing
the file.
Figure 5 Developer B gets read error when accessing
the locked file
Subversion Control System
Sriee Gowthem Raaj
13
Figure 6 Developer A releases lock and writes the file
 Developer A has made his changes in
the source code.
 He writes his file to the server and
unlocks it.
Figure 7 Developer B can now access the file
 Now other developers can read the
file for modification.
 Using this method Developer A
changes is present in the source code
and others are aware of developers A
changes.
Merits
This method solves the problem with file overwriting and masking the changes made by other
developers. However there are some shortcomings in this methodology.
Demerits
1. If a person has locked a file and is not available, then admin should intervene and unlock the
files
2. If the person who has locked a file went on leave or a vacation, then it becomes a problem
for others. They have to wait for the person to release his lock to access the file.
3. This method gives way to Serialization – Other persons in the team has to wait for one
person to finish his task. Parallel working is not possible. This is the major disadvantage with
this method
These disadvantages make this method unlikely to be used.
Subversion Control System
Sriee Gowthem Raaj
14
Methodology 2 – Lock-Modify-Unlock
 Both developers (A & B) can take the
source code from the server.
 Developer A begins to make changes in
the file.
 Developer B also modifies the file
 Developer A commits his changes first to
the server.
 Developer A’s commit has changed the
state of the code in the server.
Figure 9 Developer A commits his changes to
the server
Figure 10 Developer B gets out of date error
 Developer B after making modifications
is going to paste his code to the server
 Developer B gets an out of date error.
 This error implies that the source code
in the server has changed since
developer B copied the code
Figure 8 Developer A & B reads the same file
Subversion Control System
Sriee Gowthem Raaj
15
Repository
Subversion Control System
Sriee Gowthem Raaj
16
Repository
What is a repository?
Repository is the core aspect of a subversion system. It is the location where all the project contents
are stored. It is similar to your cloud storage but it will remember all the changes that have taken
place in the repository.
It can have multiple clients accessing it. Clients can read/write from the repository, they can view the
historical changes that have been taken in the repository.
How to create a repository?
Step 1. Go to a location where you want to place the entire project. It can be in your hard drive or in
a remote server
Step 2. Create a folder. Right Click on
the folder
Step 3. In the context menu select
TortoiseSVN  Create
Repository Here.
Step 4. After repository is created, SVN asks you to whether create a folder structure.
Figure 12 Create Folder Structure
Figure 11 Create Repository
Subversion Control System
Sriee Gowthem Raaj
17
Step 5. You can create the folder structure now or later. Click Ok and your repository is created. The
folder changes like the picture shown below.
Figure 13 Folder --> Repository
Why is repository asking for a folder structure? What is it?
Folder structures are like common layouts that are used in projects. It is a way projects are
organized. It is not mandatory part of a Subversion system or for a project. Every project or
organizations follow their own structures. The default folder structure provided by SVN is /trunk,
/branch and /tag.
Even if we have not created the folder structure when we created the repository we can add folders
to the repository just like we are adding folders in windows explorer using repository browser.
/trunk This is the folder where main line of development takes place. It is the place holder of
your code base.
For Example: If you are working for a company which develops Mobile Apps. Then the
source code/resources/build files will be present in /trunk
/branch This is the folder which contains the code separated from the main line of development.
Normally branches are used to add new features for the project.
 If the new feature works well then it will be merged back into the /trunk.
 If the new feature did not work it won’t affect the real line of development.
 If there are minor changes and often committing operation is going on, it won’t
annoy the developers working for on new line of development.
For Example: You mobile app product has successfully used Bluetooth module and is
released. Your company wants to know whether they can use Wifi module also. So this
feature addition is done in the branch without affecting the main line of development.
Subversion Control System
Sriee Gowthem Raaj
18
/tag Tag is used to keep the released version of the code. You can see all the releases for a
project in /tag.
For Example: Your mobile app supports 4 languages till v1.4 and language support has
been restricted to only English from v1.5. Users can get v1.4 of you application from
/tag.
Practical Illustration of Folder Structure
Layout can be used based upon the functionality of the project.
1. Indexing by branch – Used if the project files are related to each other
2. Indexing by project – Used If there are different set of projects
Scenario: Let us consider possible folder structure for Mobile Application Development Company
Indexing by branch Indexing by project
The screenshot below shows the default folder structure for the repository created. I have used the
default folder structure (/trunk, /branch, /tag) for the articles.
Subversion Control System
Sriee Gowthem Raaj
19
Figure 14 Repo Browser with URL
Scenario of Layout Usage
Initially /trunk – Development version to be released v1.0
/branch – No files
/tag – No files
After v1.0 release /trunk – Development version to be released v1.1
/branch – Used for bug fixing in v1.0 and released as v1.0.1
/tag – v1.0
This is how the folder structure in the repository looks when development cycle is going on.
Repository URL Schema
For Local drives: file:///D:/path/to/repository
Example: file:///D:/SVN/Repository
For File servers: file://hostname/path/to/repository
Example: file://12.14.15.2/Repository
Subversion Control System
Sriee Gowthem Raaj
20
Import
Subversion Control System
Sriee Gowthem Raaj
21
Importing
What is importing?
Importing is a feature where you can add your project to the repository. This is the immediate next
step to do after creating the repository.
How to import data into the repository?
Step 1. Select the project which is required to be imported into the repository. Right click to get the
context menu as shown below.
Figure 15 Context Menu --> Import
Step 2. Select import. A dialog box shows
up.
Step 3. Select the location of the
repository where you want to
import the project
Step 4. Enter the log message. These log
messages are atomic transactions
which will help others to know the
purpose of the action.
Be careful with the location!
The URL of the repository should be selected properly. You need to specify at which part of the
folder structure (/trunk, /branch, /tag) inside the repository you need to import the data. Otherwise
the whole repository will be messed up.
Figure 16 Import Dialog Box
Subversion Control System
Sriee Gowthem Raaj
22
Let us see 2 examples related to this. Scenario 1 tells about what happens when the location is not
specified and scenario 2 tells us the right way of specifying the location.
Scenario 1: What happens when project location is not specified properly?
Figure 17 Wrong Import
Figure 18 Repository messed up!
Subversion Control System
Sriee Gowthem Raaj
23
Scenario 2: How to specify the project location?
Figure 19 Right Import
Figure 20 Project imported inside trunk
Subversion Control System
Sriee Gowthem Raaj
24
Working Copy &
Checkout
Subversion Control System
Sriee Gowthem Raaj
25
Working Copy & Checkout
What is Working Copy & Checkout?
The process of extracting data from the repository is known as Checkout
Working copy is an ordinary directory tree copied to your own hard disk. It is a private copy where
you can work on them. This working copy is taken from the repository by a process called checkout
How to checkout data from the repository?
Step 1. Right click on the folder where you want
your private copy to be to get the
context menu.
Step 2. Click SVN Checkout to get the dialog box shown.
Figure 22 Checkout Dialog Box
Step 3. Options in the dialog box
a. URL of Repository: From where you want to take a copy
b. Checkout directory: To where you want to paste the project
c. Checkout depth: The depth up to which you need the files
d. Omit Externals: Externals are external linking to the project (Will be discussed in
future articles)
e. HEAD Revision: Current revision in the repository
f. Revision: We can specify specific revision
Figure 21 Context Menu --> SVN Checkout
Subversion Control System
Sriee Gowthem Raaj
26
Step 4. Press Ok. All the project contents will be copied to your hard disk as a private copy. (Read
through the article to know in detail for the options present in the dialog box)
What is checkout depth?
Checkout depth specifies the level up to which the data should be copied from the repository to
your hard disk. There are four options in checkout depth.
Figure 23 Checkout Depth option
Fully Recursive
Figure 24 Checkout Depth - Fully Recursive
All files and folders in
the repository are
copied to local hard
disk
Subversion Control System
Sriee Gowthem Raaj
27
Immediate Children, including folders
Figure 25 Checkout Depth - Immediate Children, including folders
Only file children
Includes only the files immediately next to the top level folder. This option does not include
folders
Figure 26 Checkout Depth - Only file children
Only this item
Includes only the top level empty folder without any content inside them
Figure 27 Checkout Depth - Only this item
Includes only files and
folders immediately
next to the top level
project folder
Subversion Control System
Sriee Gowthem Raaj
28
Choose item
This option allows the users to choose specific files that are required. Though this option gives
more control to the user it will take lot of time while committing their changes to the
repository.
Figure 28 Checkout Depth - Choose Item
What are Revisions?
Revisions are atomic transaction numbers. Each import/checkout/commit/lock/merge etc is
assigned a revision number. Revisions represent the changes that are made for a particular file or a
folder in the repository. With version numbers you can take a snapshot of a particular state of the
project.
Figure 29 Revision Log
Subversion Control System
Sriee Gowthem Raaj
29
The above revision log gives details about the revision number, author and comments associated
with a revision. Let us understand the use of revisions using a simple example.
Scenario: Revision 9 is a stable revision; your software is running fine without any crashes. In
revision 11 some new features have been added but now the software is crashing. Your task is to
find out why the crash is occurring?
Action Items
Q1. You need to know which revision is standard and which revision is crashing
Q2. You need to know what changes had been added since the stable version
Q3. Then you need the project in a state when it was not crashing to debug the issues
We can get the answers from the revision log. This example shows practical usage of revisions.
Figure 30 Revision usage
Revisions Terminology
Head Revision The latest revision present in the repository
Base Revision ‱ The revision when you checked out a working copy to your system
‱ Changes may be made to the repository after your check out
Snapshot ‱ Making a private copy from the repository at a particular state
‱ User can specify the revision number in SVN Checkout Dialog box
Stable
Revision
Need to
checkout
Crashing
Revision
Changes made
in this revision
Subversion Control System
Sriee Gowthem Raaj
30
Commit
Subversion Control System
Sriee Gowthem Raaj
31
Commit
What is committing?
Committing is process of publishing your changes to the repository so that your changes are saved in
the code base and others accessing the repository will get the updated version of the source code.
How to commit?
Step 1. After making your changes in the project, right
click the project that you want to commit to
the repository. You will see the context menu
as shown in the figure
Step 2. Select SVN Commit. You will get the commit
dialog box as shown in the figure below
Figure 32 Commit dialog box
Figure 31 Context Menu --> SVN Commit
Subversion Control System
Sriee Gowthem Raaj
32
Features of Commit dialog box
Figure 33 Features of Commit Dialog
 Shows list of versioned and unversioned files in the bottom pane
 Columns in the bottom pane can be resized, added or removed
 Can Drag/Drop files
 Checkbox is present to add only specific files for this commit
 When a lock is acquired by this author it will be released automatically after committing
 We can format the log messages
o *text* - Bold
o ^text^ - Italics
o _text_ - underline
 We can also add project specific text to the dictionary as shown in the figure below
Subversion Control System
Sriee Gowthem Raaj
33
Figure 34 Adding project specific text
 Ctrl + Space gives auto suggestion
 Add/Delete recent log messages
 We can also add path to the log messages. Drag the file in the bottom pane and drop in the
edit control. You should be able to see the path of the file copied to the log message.
 You can also move the files to change list
o Change List – Grouping files under a category. Ignore-on-commit is the predefined
list as shown in the figure below. We can add our own change list (It is discussed in a
separate article)
Subversion Control System
Sriee Gowthem Raaj
34
Figure 35 Change list
Step 3. After entering the log messages using the features discussed above. Click Ok. Your changes
will be added to the repository. A dialog box opens to inform you the status of the commit
as shown below
Note
Log Messages: Some projects have a template for entering the log messages. These log messages
should tell what the change is about. It is a good practice to make it clear and understandable.
Subversion Control System
Sriee Gowthem Raaj
35
Figure 36 Commit Finished
You will see the commit messages with different colors. The color schema for the commit messages
are as follow
Black Unrevisioned files
Red Files that are deleted or replaced
Blue Committing a modified file
Purple Adding new file into the repository
However these color settings can be modified in the TortoiseSVN Settings, I prefer to use to default
color schema reducing the need to memorizing set of color schemas.
Subversion Control System
Sriee Gowthem Raaj
36
Update
Subversion Control System
Sriee Gowthem Raaj
37
Update
What is an update?
Process of incorporating others changes in your working copy is known as updating.
Why we need to update?
As the name implies we need to have the updated version to merge our changes. Let us consider this
possible scenario.
You have checked out revision 145 from the repository (This will be your Base revision). Similarly
others started to work on their private copy. Many of your peers have made changes in the source
code and committed them in the repository. The Head revision of the repository is 160.
When you try to commit your changes, you will get an out of date error. Because there are many
changes present in the HEAD revision against your BASE revision.
To solve this you need to update your working copy and then commit your changes.
How to do an update?
Step 1. Select the folder. Right click and
select the options shown in the
figure
Step 2. Select SVN Update. Update action
starts. The color scheme of committing applies to update dialog as well.
Figure 38 Update finished
Step 3. Now you can commit your changes to the repository
Figure 37 Context Menu --> Update
Subversion Control System
Sriee Gowthem Raaj
38
Sparse Update
What is sparse update?
When your checkout depth is other than “Fully Recursive” in SVN Checkout dialog box then it is
known as sparse update. Update to revision should be used to mirror your working copy to the
repository. Let us understand update to revision with a simple scenario.
Scenario: There are many projects that are connected to other projects in your repository. There is a
requirement change that needs to be added in a particular project. Checking out the whole project
will be a daunting task. So here’s how to do it.
Step 1. Locate the trunk of the project in the repository – Project Root.
Step 2. Right click on the folder in your local machine where you want to check out the source code.
In this case you need Project 1.
Step 3. Select Project 1 and choose “Only this item” in SVN Checkout dialog box. This option only
copies the top level folder (i.e Project 1) without the content inside the folder.
Step 4. Selecting update to revision will copy the files of project 1 to your local machine. You can
use the folder or repo-browser to update your working copy. Two possibilities are shown in
the figure below.
Figure 39 Update to Revision - Repo Browser
Subversion Control System
Sriee Gowthem Raaj
39
Figure 40 Update to Revision - Working copy
Step 5. We can specify which revision of
Project 1 to update in your
working copy. Either HEAD
revision or a specific version
Step 6. Update Depth
a. Working copy – Uses the
same depth you chose
which checking out your
working copy
b.Make Depth Sticky – Will
use the same option for
future selections also
Step 7. Press Ok to mirror your working
copy to the repository
Figure 41 Update to Revision dialog box
Subversion Control System
Sriee Gowthem Raaj
40
Figure 42 Update to Revision Scenario
Subversion Control System
Sriee Gowthem Raaj
41
Update conflicts
Whenever other developers have made changes in the same file you have made changes, update
dialog box shows the file that are conflicted. This is shown in the figure below
Figure 43 Update Conflict
To avoid conflicts?
Before committing or updating your working copy it is better to check for modifications in the
repository. Right click on the folder; context menu appears as shows in the figure below.
Figure 44 Context Menu --> Check for Modification
Select Check for modifications will open a dialog box which gives information about the files/folders
modified. The figure below shows a single file (ReadMe.txt) modified by two users. It is better to use
this option when you are using sparse update.
Subversion Control System
Sriee Gowthem Raaj
42
Figure 45 Check for modification
Subversion Control System
Sriee Gowthem Raaj
43
Resolve
Conflicts
Subversion Control System
Sriee Gowthem Raaj
44
Resolving Conflicts
What is a conflict?
A conflict arises when two or more person modified the same file or due to
missed/renamed/deleted folders.
Resolving File Conflicts
File conflicts should be resolved manually by the developers in their private working copy before
committing their changes into the repository. Whenever there is a conflict in a
project the overlay status of the project icon will be changed to conflict as shown
in the figure.
It is a good practice to use “Check for modification” before updating/committing
your working copy with the repository.
When you’re working copy sees a conflict with the file it will create three files in
you working copy.
Filename.ext.mine - Your changes before updating
Filename.ext.rOLDREV - BASE Revision before updating
Filename.ext.rNEWREV - HEAD Revision that is received from the repository
Conflict
File conflict
When many changes
happened on the
same file
Tree Conflict
When many peers changed
the tree structure by
renaming/moving/deleting
a folder
Figure 46 File in
Conflict
Subversion Control System
Sriee Gowthem Raaj
45
How to resolve a conflict?
Step 1. Open the editor of your choice. The changes
will be mentioned in the format as shown in
the figure.
Step 2. After making the changes, right click on the
folder with conflict and select the option as
shown in the figure.
Figure 48 Context Menu --> Resolve
Step 3. Resolve conflict will
a. Keeps your version and overwrites the repository version
b. Deletes the files (filename.ext.mine, filename.ext.rOLDREV, filename.ext.rNEWREV)
that were created during conflicts
Step 4. After the conflicts are resolved you will see normal overlay status icon for the folder.
Note:
Context Menu  Revert after resolving a conflict will keep the repository version only, your changes
will be discarded.
Resolving Tree Conflicts
Resolving tree conflicts are not as direct as resolving files conflict. There can many possible scenarios
for a tree conflict to arise. I have illustrated some of them below.
How to resolve Tree conflicts?
 SVN has no way automated to resolve tree conflicts
 Developers should communicate with each other and resolve the conflict.
 SVN provided tools like Revision Log/ Merge history can be used to track the changes that
went on in a single revision. With this information it is up to the developers to work out a
possible solution for renamed/moved/deleted file in the tree.
Figure 47 Conflicted area
Subversion Control System
Sriee Gowthem Raaj
46
Scenario 1
Scenario 2
Scenario 3
Commit
Modifies Foo.txtFoo.txt Foo.txt
Checkout
Changes Foo.txt to
Boo.txt
Deletes Foo.txt
Commit
Changes Foo.txt to
Boo.txt (or)
Moves Foo folder
to Boo Folder
Modifies Foo.txt
Modifies Foo folder
Checkout
Foo.txt (or)
Foo Folder
Foo.txt (or)
Foo Folder
Commit
Modified
Foo.txt to
Doo.txt
Modified
Foo.txt to
Boo.txt
Checkout
Foo.txt Foo.txt
Subversion Control System
Sriee Gowthem Raaj
47
Scenario 4
Scenario 5
Scenario 6
Modified
Foo.txt to
Boo.txt
Modified
Foo.txt
Foo.txtFoo.txt
Merge
Modifies Foo.txt
Modifies Foo folder
Changes Foo.txt to
Boo.txt (or)
Moves Foo folder
to Boo Folder
Foo.txt (or)
Foo folder
Foo.txt (or)
Foo folder
Merge
Modified Foo.txt
to Boo.txt
Modified Foo.txt
to Doo.txt
Foo.txt (or)
Foo folder
Foo.txt (or)
Foo folder
Merge
Subversion Control System
Sriee Gowthem Raaj
48
Locking
Subversion Control System
Sriee Gowthem Raaj
49
Locking
What is locking?
We have already seen the methodology Lock-Modify-Unlock. This feature is supported by SVN, it is
up to the user to lock files. These are applicable to build or makefiles. Making changes in these files
could mess up the entire project setup environment. Locking is applicable for files/folders that are
show stoppers.
How to lock?
Step 1. Select the file/folder that you want to lock. Right click will bring up the context menu as
shown in the figure.
Step 2. Selecting Get Lock will open a dialog box where you can select the files you need to acquire
lock. Enter the log message stating the reason for locking file(s). The Get Lock dialog box is
shown in the figure.
Figure 49 Context Menu --> Get Lock
Figure 50 Get Lock Dialog Box
Subversion Control System
Sriee Gowthem Raaj
50
Step 3. After lock has been acquired, Lock finished dialog box will appear detailing the current
action taken as shown in the figure.
Further Icon overlay shows locked status for the files locked.
Figure 52 Lock status
Steal lock/ Break lock: SVN provides this feature to steal or break a lock acquired by other person.
This feature may be helpful in some cases but is not recommended.
Use of “Check for Modification” with locking: Check for modification option helps the developers to
get a clear picture of the lock status in the repository.
Use of Hook – scripts: SVN uses hook scripts for automating some features. For instance we can
write scripts to send a mail to the entire team when someone acquires a lock/releases a lock.
Figure 51 Lock Finished Dialog Box
Subversion Control System
Sriee Gowthem Raaj
51
Figure 53 Use of "Check for Modification" in locking
Subversion Control System
Sriee Gowthem Raaj
52
Ignore
Subversion Control System
Sriee Gowthem Raaj
53
Ignore
Purpose of ignoring?
Files that are created while compiling your project - *.obj, *.lst (or) the output folder which contains
*.exe files generated from your project. Each time user commits his project SVN shows these files to
be unversioned. Imagine the scenario for a project which contains many modules and time cost for
committing these changes to the repository.
At these circumstances files/folders can be ignored from versioning.
How to Ignore?
Step 1. Select the file you want to ignore. Right click will give you the context menu as shown in the
figure
Figure 54 Context Menu --> Ignore
Step 2.
a. Every file will give you 4 options
Filename.filenameExtension – Only that file
*.filenameExtension – Files with that extension
Filename.filenameExtension (recursively) – All files with that name and extension
*.filenameExtension (recursively) – All files with that extension
Subversion Control System
Sriee Gowthem Raaj
54
b. Ignoring multiple files will show similar options as shown in the figure below.
Figure 55 Ignore multiple files
Step 3. After selecting the option, the file will be marked in
deleted state.
Step 4. Committing the ignored file will change their state
to ignore as shown in the figure.
Step 5. Making any changes to ignored files will not change
them to modified state. As shown in the figure, a.bat is modified but it state did not change
after saving the changes.
Figure 58 Checking Ignore
Figure 57 After Ignore Commit
Figure 56 After Ignore
Subversion Control System
Sriee Gowthem Raaj
55
Remove Ignore
We can remove the ignore files
using the same process as
adding files to ignore list. After
removing the files have been
changed from ignore state to
changed state. This is illustrated
in the figure.
After ignoring the file state has
been changed to modified
state.
Figure 59 Remove Ignore
Subversion Control System
Sriee Gowthem Raaj
56
Change List
Subversion Control System
Sriee Gowthem Raaj
57
Change Lists
What are changelists?
Changelist is a feature which helps developers to group files they have modified. This feature gives
developers clarity over the files they have modified. It is up to the developers to use this feature; it is
only applicable to client machine. It doesn’t have any effect on the repository.
Scenario: Developer is working on several files in a single module. In order to track his files, his
changes and what changes went on in each commit. He can use change ist to categorize his set of
files.
Our developer is working on some files in Application layer and a particular module in Middleware;
let’s have a look at his commit dialog without change list.
Figure 60 Without Change list
Now this is pretty messed up and he decides to add changelist to track his set of files.
Subversion Control System
Sriee Gowthem Raaj
58
How to add changelist?
Step 1. Selects the files  Right click to get the context menu as shown in the figure.
Figure 61 Adding Change list
Step 2. Default change list would be ignore-on-commit. Adding files to this changelist will add
ignore property.
Step 3. If you haven’t added any change list until now <new changelist> will be shown
Step 4. Click <new changelist> to add any field.
Step 5. Selected files will now be grouped under your new changelist.
Note: Changelist doesn’t deal with any state changes or make any changes in the repository.
It is used by users to group files on their private machine.
Subversion Control System
Sriee Gowthem Raaj
59
Let’s have a look at our developer commit dialog after adding changelist
Figure 62 With Changelist
Subversion Control System
Sriee Gowthem Raaj
60
Common
Subversion Control System
Sriee Gowthem Raaj
61
Icons Overlay
One of the attracting features of Tortoise SVN is Icon overlays. These visual icons provide us the
status of file currently in. Each icon has a meaning associated with it.
Normal status Icon
This file in your working copy mirrors the contents in the
repository.
Modified status icon
This file has been modified since it was last checked out
from the repository.
Non versioned status icon
This file is not versioned. It will be versioned on committing.
Added status icon
This file has been added in your working copy and is not
added to the repository. It will be added and versioned on
committing.
Conflicted status icon
This file is under conflict. Two or more users have modified
the same file. Needs user attention to resolve the conflict
and move it to normal state.
Deleted status icon
This file has been deleted. This will be removed from the
repository on commit.
Subversion Control System
Sriee Gowthem Raaj
62
Locked status icon
This file has been locked by one of the users. It cannot be
modified by other users.
Read-only status icon
This file has “needs-lock” property assigned to it. Users
checking out this file should acquire a lock. Without lock
users can’t make any changes to this file.
Ignored status icon
This file won’t be versioned. Changes in this file won’t be
reflected while committing.
To get detailed properties for a particular
file, Right Click  Windows Properties will
open up the dialog box shown in the figure
below.
Subversion Control System
Sriee Gowthem Raaj
63
Adding Files
There are two ways to add files.
First is the normal way that we add files in the windows explorer. When files are added newly via
windows explorer, the file shows un-versioned status. Committing the file will add these un-
versioned files to the repository.
Second way is to drag and drop files in
your working copy location. Right
dragging the files to your working copy
will bring up the context menu as
shown in the figure.
Select “SVN Copy and add files to this
WC (Working Copy)”.
The file will show added icon overlay
status. Committing will add this file in
the repository.
Copy/Moving
 These common operations are same, but there are small differences that need to be
understood.
 You can copy/move/rename files from within the working copy, with different working
copies but within repositories files history won’t be saved. It will be added as a new file in
other repository.
 You can Right Drag files to your working copy. Right drag will open a context menu as shown
in the figure. Select “SVN Copy and add files to this WC” will mark the files with added
status. Committing will update these files in the repository.
Figure 64 Right Drag - Copy/Move
Figure 63 Adding files - Right Drag
Subversion Control System
Sriee Gowthem Raaj
64
 Difference between Copy/Paste and Copy/TortoiseSVN Paste
Copy (Ctrl+C) & Paste (Ctrl+V) Copy (Ctrl+C) & TortoiseSVN Paste
(Ctrl+V)
When you copy a file and paste it in your
working copy, the file will be in unversioned
state ( ). All the previous version history for
that file will be lost.
When you copy a file and
TortoiseSVN paste it in your working
copy, the file will be in added state (
). All the previous version history
for that file will be preserved.
Without revision history, it would be difficult
for the user while bug fixing
With comments present in the log
message, you could track the files
using revision log.
Renaming
Scenario: Consider that you have renamed a file from “ReadMe.txt” to “DontReadMe.txt”. When
you commit, Subversion thinks “ReadMe.txt” is missing and “DontReadMe.txt” as a new file.
Before Commit:
ReadMe.txt will be in missing state ( ). DontReadMe.txt will be in added state ( ).
On commit:
ReadMe.txt will be deleted and DontReadMe.txt will be added and versioned.
Although you retain the file there are few drawbacks.
Drawbacks:
 You will be losing the version history of ReadMe.txt. DontReadMe.txt will be having new
comments that were entered on commit.
 Before committing, when you update your working copy ReadMe.txt will be copied back
from the server.
How to prevent this?
In Commit or Check for Modification dialog box, select the files that you renamed. Right click on the
files to get the context menu as shown in the figure. Select Repair Move to pair two files as rename.
Subversion Control System
Sriee Gowthem Raaj
65
Figure 65 Repair Move
Deleting Files/Folders
 Always use TortoiseSVN 
Delete to delete a file.
 The advantage is that you will
be entering log messages
stating the reason for deleting
the file. It will be versioned,
making it easy to track the file.
 On the contrary deleting files
from windows explorer will
lose version history
information about that file.
Figure 66 Context Menu --> Delete
Subversion Control System
Sriee Gowthem Raaj
66
Undo Changes
 We can undo our changes using
TortoiseSVN  Revert.
 Select files that are required to revert
back. Revert dialog box is shown in
the figure below.
Figure 68 Revert Dialog Box
 Revert operation will only undo the changes in your local copy, it won’t affect the repository
 Revert operation is slow; SVN moves modified files to your recycle bin and then copies files from
the repository.
 Clean up is a feature in SVN used you’re your working copy is in inconsistent state. TortoiseSVN
 Cleanup will fix your working copy. It is recommended to use Revert than Clean up.
Figure 67 Context Menu --> Revert
Subversion Control System
Sriee Gowthem Raaj
67
Exporting Working Copy
 There are many ways to export
your project. You can export from
Repo-Browser, Working Copy,
Show log and by dragging &
dropping to another location.
 To export, select the file Right
Click to get the context menu as
shown in the figure.
 Export functionality is the same
irrespective of the context.
 Export is used to get the contents of a project without version control attached to it. You
won’t see .svn folder or icon overlay’s as illustrated in the figure below.
Figure 70 Right Drag Export
Figure 69 Context Menu --> Export
Subversion Control System
Sriee Gowthem Raaj
68
Relocation a Working Copy
As the title implies, TortoiseSVN  Relocate is used to shift the location of a working copy. It is most
infrequently used operations. This feature is used when there are any IP/URL changes or protocol
(http  https) changes.
Figure 71 Relocate Dialog Box
Relocating a working copy can be done only in the root folder. It will throw an error if other folders
are used. Error is shown in the figure below.
Figure 72 Not a root error
Subversion Control System
Sriee Gowthem Raaj
69
Branch/
Tag
Subversion Control System
Sriee Gowthem Raaj
70
Branching/Tagging
What is a Branch?
Branch is used for implementing new features or testing new feature separately from the main line
of development.
What is Tag?
Tag is a location where stable versions of a project are present.
How to Branch/Tag?
There are three ways to Branch/Tag
1. Using repo-browser drag the projects from one location to branch/tag folder
2. Using revision log, select a particular revision. Right click  Context Menu  TortoiseSVN 
Branch/Tag.
3. Select the root folder of your working copy. Right click to get the context menu as shown in
the figure.
Figure 73 Context Menu --> Branch/tag
a. Select Branch/Tag opens a dialog box shown in the figure.
i. To Path: Select the path where you want to branch/tag
ii. Log Messages: Enter appropriate comments for branching/tagging
iii. Create copy in the repository from
1. HEAD – Use the latest version in the repository
2. Revision – Specify a revision where branch/tag should take place.
This option is useful when you forgot to branch/tag and committed
the code to the repository
3. Working Copy – Use your working copy instead of the version
present in the repository
Subversion Control System
Sriee Gowthem Raaj
71
iv. Set explicit revision for these externals:
Externals are links to module present in other location. Since we are making
a fresh copy from our trunk to Branch/Tag we have redirect the externals to
our Branch/Tag. Usage of Externals is covered in a separate article.
v. Switch working copy to new branch/tag:
Note that you are creating branch/tag in the repository. Even if you choose
working copy all changes will be done in the repository and not in your
private machine. Selecting this option will switch your working copy to the
new branch/tag after it has been created in the repository
Figure 74 Branch/tag dialog box
Subversion Control System
Sriee Gowthem Raaj
72
b. After selecting the required option in Branch/tag dialog box. Press OK to create a
Branch/tag in the repository. Your repository after branching/tagging is shown in the
figure below
Figure 75 After Branch/tag
Switching
As we already discussed switching is used to switch from your working copy to Branch/tag version.
You can also do a fresh checkout in an empty folder but switching will only copy the files that are
modified. Switching can make “Cheap copy” – you don’t need to spend additional costs (time,
processor usage/memory) when you are switching.
Subversion Control System
Sriee Gowthem Raaj
73
How to Switch?
Step 1. To switch select the root folder of your working copy. Right click to get the context menu as
shown in the figure.
Step 2. Select switch, a dialog box opens up.
Figure 77 Switch dialog box
(Options present in the dialog box are already discussed)
Step 3. Press Ok for your working copy to switch.
Figure 76 Context Menu --> Switch
Subversion Control System
Sriee Gowthem Raaj
74
Creating / Apply
Patch
Subversion Control System
Sriee Gowthem Raaj
75
Creating/Apply Patch
What is a patch?
A patch is an individual contribution to a project. It can be a bug fix code or new functionality or
changing the existing functionality. These patch files should be reviewed and approved to be
entered into the source code. Let us understand patch files with a scenario.
Scenario
In open source projects there will be many contributing to the project. Incorporating everyone
change to the main source code will make it messy. But at the same time some one’s modification
can solve a particular issue. So how to solve the issue as well prevent messy source code. The
answer is patch files.
Top contributors to the project will be given write access. New members will be given only read
access. New members can submit their code changes in a form of patch file. Seniors will go through
the submitted patch file, review them, test them and then patch the file to the source code.
How to create a patch?
1. Select the file/folder in your working copy you want to patch. Right click to get the context
menu as shown in the figure.
Figure 78 Context Menu --> Create Patch
2. Select Create Patch, dialog box opens which allows you to select files for creating patch. (The
options in the dialog box are self-explanatory)
Subversion Control System
Sriee Gowthem Raaj
76
Figure 79 Create patch dialog box
3. Select OK to create the patch file. Patch file have .patch/.diff extension ( ).
4. The patch file will be in unified diff format. It contains text mentioning the changes for each
line with context. The figure shows a sample patch file.
Subversion Control System
Sriee Gowthem Raaj
77
Figure 80 Patch file
There is one significant feature in patch file. The very first line of the patch file has Index which
specifies the location of the file. This index will be useful to find the location to correctly apply the
patch.
Apply Patch
You can apply patch using two ways
1. Select the folder/file you want to apply patch. Right Click  Context Menu  Apply Patch
 Select the patch file in Windows Explorer
2. Double click the patch file  Select the file/folder for which you want to apply patch.
Figure 81 Context Menu --> Apply Patch
Both the selection will open Tortoise Merge. You can see the difference between the files and
merge changes to your working copy.
Subversion Control System
Sriee Gowthem Raaj
78
Figure 82 Tortoise Merge
Subversion Control System
Sriee Gowthem Raaj
79
Merging
Subversion Control System
Sriee Gowthem Raaj
80
Merging
What is merging?
At some point of time you need to add the features implemented in a branch with your main line of
development. Merging always takes place from your working copy. You need to check out the
branch in to your working copy and can then merge the changes back to the trunk.
Always merge first before making any modification. If in case your merge failed because of conflicts
then modified changes will be gone. Revert is the only option to undo changes which will delete all
your changes.
When you select a folder Right click  Context Menu  Merge will open Merge wizard with two
options as shown in the figure below.
Figure 83 Merge Wizard
Subversion Control System
Sriee Gowthem Raaj
81
Methods in merging
1. Merging range of revisions
2. Merging two different trees
Merging range of revisions
Figure 84 Merge range of revision
 URL to merge from
Enter the URL of branch/tag that you want to merge with your working copy
 Revision range to merge
o All revision ---- Takes revision from the start to HEAD revision
o Specific Range
You can specify the range of revisions.
Example revision expression -11, 12 | 111,323 -350 | 13- 200@5.
 Click Next to get Merge Option. Select options and click Merge to merge.
Subversion Control System
Sriee Gowthem Raaj
82
Figure 85 Merge --> Show Log
It is a good practice to use Show Log. Show Log open revision log where you can select the files you
want to merge with your working copy.
If version numbers are not specified explicitly or selected all revision radio button subversion
calculates the versions that are required to be merged. This feature is known as “Merge Tracking”.
This process is knows reintegrate or automatic merge.
It is better to use merge tracking features because you don’t need to remember the last set of
revisions that you integrated. For Example if you have explicitly mentioned revision range 4556 –
4687, next merge should happen after 4687. If you use merge tracking option SVN takes care of this.
Peg Revision
 When a particular branch is deleted/renamed from the trunk where your branch is split, we
need to use peg revision to hint SVN about the split.
 Syntax for using peg revision – 20 -100 @ peg version number
 For Example
o Branch development started at revision - 30
o Trunks HEAD revision - 100
o Branch rename – 67
o Merge range with peg revision – 20 -100 @67
Subversion Control System
Sriee Gowthem Raaj
83
Merging two different trees
Figure 86 Merge Two Different trees
From field: Specify the URL of trunk
To field: Specify the URL of branch where you want to merge.
In both from field and to field you select HEAD revision, specific revision or use revision log to select
range of revisions.
Press Next to get Merge Options. Choose options and select Merge to merge.
Subversion Control System
Sriee Gowthem Raaj
84
Merge Option
I am not going to cover each aspect of Merge Option. Most of the time using default settings works
but if you want a deeper insight on merge option refer TortoiseSVN manual.
Test Merge is a pretty useful option. Before making the official merge, one can use this option to
check whether the merge will be successful or not. The figure below shows a test merge with tree
conflicts. Now users can check out the reason for conflicts and correct them before performing the
actual merge.
Figure 87 Test Merge
Note:
Merging process is simple to perform but concept of merging is a little complex. There are many
possibilities to merge between branches, between tags, between branch and trunk, between trunk
and tag etc. It is better to understand how TortoiseSVN performs merging.
Subversion Control System
Sriee Gowthem Raaj
85
Properties
Subversion Control System
Sriee Gowthem Raaj
86
Subversion properties
Subversion properties are used to perform automation of certain tasks. To assign properties to a
folder, select the folder  Right Click  Context Menu  TortoiseSVN  Properties. The properties
dialog box will appears as shown in the figure below.
Figure 88 Property dialog box
Features of SVN properties
 Adding properties to a folder will be applied to all the files and subfolders as well. Adding
properties to a file is applicable for that file only.
 Subversion allows you to save properties so that you can export these properties to other
project as well. Properties will be saved as filename.svnprops. There are options to export
and import properties.
 Can edit the properties using Edit option
 Remove properties using remove option
 Save a value for a property. This is used when you want to set a default initial size.
Subversion Control System
Sriee Gowthem Raaj
87
Figure 89 Import Property
After Import
Figure 90 After Import
Subversion Control System
Sriee Gowthem Raaj
88
What are the properties SVN has?
Figure 91 Default properties
Figure 92 New --> Other
I. EOL
Select the End of Line Style you need from the options shown in the figure.
Figure 93 End of Line style
Subversion Control System
Sriee Gowthem Raaj
89
II. Externals
This property is used to pull in other files or project in to this location. You can also set external
property from Windows  Properties  Select Subversion Tab  Properties as shown in the
figure below.
Figure 94 Windows properties
Subversion Control System
Sriee Gowthem Raaj
90
Figure 95 svn:exteranl property window Click “New”
Click “Ok”
Figure 97 Setting external
Figure 96 External property inserted
Subversion Control System
Sriee Gowthem Raaj
91
Projects that are added using external property will have a shortcut icon against them when
viewed in Repo-browser.
Figure 98 Repo-Browser with external project
III. Bugtraq - Required to integrate external bug tracking software
IV. Local Hooks
These are scripts which will be triggered when some operation takes place. Some of hook script
templates are present in “Repository/hooks/” directory.
For Example:
When someone has acquired a lock it will invoke post-lock file. We can program the post-lock
file to send mail to other team members stating that – particular person has acquired a lock on
a particular file.
V. Log Size
Used to set size for log messages. With this option subversion administrators can set a
minimum size so that users are compelled to enter detailed log messages. It will prevent empty
& inappropriate log messages.
Subversion Control System
Sriee Gowthem Raaj
92
Figure 99 Minimum log size
VI. Languages
Figure 100 Language option
Choose the language that will be used for spell checking the log messages in commit dialog. By
default the selection will be in English. Other language options can be selected depending up on
your local machine settings
VII. Mime type
Figure 101 MIME type
Subversion Control System
Sriee Gowthem Raaj
93
Can be used to specify the input type for a file so that subversion could understand
VIII. Needs-Lock
Makes the file read only. Users should acquire a lock before modifying the files. Otherwise it will
throw write access
IX. Merge Log Template
Log templates for users to enter log messages in an intended method.
X. Other
There are many properties that SVN allows us to have for a project. All these properties are self-
explanatory. To add further clarity to the properties let’s take one scenario.
Scenario: Your project has teams working on various operating systems and you are facing lot
of path problems (Windows/Linux). So you need your team to specify information in the
following format.
1. Which operating system they are working on
2. What was the module assigned to them
3. Log message stating the reason for modification with that file
Solution
Step 1. Need to specify Log minimum size property to prevent users from committing without
proper reason. This can be done using tvsn:logminsize property.
Step 2. Create a log template
a. OS:
b. Assigned Module:
c. Log reason to Commit/Delete/Branch/Import/Move/Export
After setting properties your properties dialog box will be like the one shown in the figure.
Subversion Control System
Sriee Gowthem Raaj
94
Figure 102 Properties
Figure 103 Log Minimum size
Subversion Control System
Sriee Gowthem Raaj
95
Figure 104 Log Template
Subversion Control System
Sriee Gowthem Raaj
96
Developer
Tools
Subversion Control System
Sriee Gowthem Raaj
97
SVN Tools
SVN offers some niche tools to work. They are
 Repo-Browser
 Revision Log
 Tortoise Merge
 Tortoise IDiff
Repo-Browser
Repo-Browser is similar to windows explorer. The figure below shows a repo-browser. The
operations are self-explanatory.
Figure 105 Repo-Browser
Subversion Control System
Sriee Gowthem Raaj
98
Revision Log
Revision Log is the most used tool in SVN. It is the tool where we can view all the change history.
Revision log can be accessed from different dialog boxes. When you click “Show Log” it will invoke
Revision Log dialog box. Revision log is shown in the figure below.
Figure 106 Revision Log
There are three sections in Revision Log that needs to be understood clearly. They are Top Pane,
Middle Pane and Bottom Pane.
Subversion Control System
Sriee Gowthem Raaj
99
I. Top Pane
Figure 107 Top Pane - Revision Log
Revision This column lists the revision numbers for all the revision that has taken place for the file
Action There are four columns associated with Revision action. Each column represents a
particular action that has occurred at that particular revision. Each action is represented by
an icon arranged in the following order.
 Modified - Revision modified a file or directory
 Added - Revision added a file or directory
 Missing - Revision deleted a file or directory
 Replaced - Revision replaced a file or directory
Search Users can filter the log messages or search the revision log. Hovering the mouse over the
search field will display tool tip as shown in the figure below.
Figure 108 Revision Log Tool tip
This search feature implements Sub String searches also.
Sub String Meaning
A B -C Searches for string having both A & B but not C
A –B +C Searches for string having both A not B, or strings containing C
-Case Searches for string without case but also includes strings with Special
Subversion Control System
Sriee Gowthem Raaj
100
+Special Case Cases
!A B Searches for string which do not contain both A and B
!-A -B Searches for string which contains A or B
“A and B” Searches for string within double quotes (“”)
Author Person responsible for that revision
Date Time stamp
Message Shows the log message associated with that revision
From - To Used for filtering the revision by specifying the time period. Top pane shows only the list of
revision within the time period specified in FROM date - TO date
a. Context Menu in Top Pane
Figure 109 Context Menu Top Pane
Subversion Control System
Sriee Gowthem Raaj
101
Compare with working copy
Compares the current revision what you have selected with your working copy.
It opens the default diff tool – Tortoise Merge
Show changes as unified diff
Compares the selected revision with your working copy and gives the output in a form of unified diff.
The figure below shows unified diff format. Diff format will be in text format, it is a little bit difficult
to interpret than the visual representation of Tortoise Merge
Figure 110 Unified Diff
Compare with previous version
 SVN opens the below tool mentioning the files that are modified from the current selected
version to the previous version.
 Users can also click on the version numbers to select revisions that they need to compare
 Users can also invert the selection.
 Selecting the file will open Tortoise Merge, where it represents the difference between the
files
 Search option is there to filter the results.
Subversion Control System
Sriee Gowthem Raaj
102
Figure 111 Compare with previous version
Browse
Repository
Opens repo-browser displaying the location of the selected file.
Create
Branch/Tag
Can create a Branch/Tag from the selected version. This option works best if you forgot
to Branch/tag and committed the changes.
Update item
to Revision
Updates this particular revision to your working copy. This option works best if you have
chosen Checkout depth other than “Fully Recursive”.
Revert to
this version
Revert to an earlier version. If you have made changes in N+1 revision, you can use this
option to revert back the changes to N revision.
These changes will be reverted to your working copy only. It won’t affect the repository
at all.
Revert
changes
from this
version
Undo the changes in the current selected version.
Merge Merge this particular revision to your choice
Subversion Control System
Sriee Gowthem Raaj
103
revision to

Checkout Checkout this revision as a working copy
Export Export the selected revision (without .svn folder)
Edit Author Edit the author for a particular revision.
Edit Log
message
Edit the existing log messages. This option is useful if you want to correct any log
message.
When you try to edit the log messages and author it will throw the following pre-
revprop-change error.
Figure 112 pre-revprop-change error
This error occurs due to changing the revision property. By default this features can
be change. In order to make changes you have to edit hook scripts present in
Repository/hooks directory.
To overcome this error
Step 1. Go to /Repository/hooks directory. There you can see default
template files with extension (.tmpl).
Step 2. Rename the file as pre-revprop-change.bat
Step 3. Delete all the contents present in the template file
Step 4. Enter exit 0 and save the file. If you want to automate you can do it
scripting.
But overwriting the revision will again cause messy things. To avoid this you can
automate the script such that only the administrator can edit the revisions.
Subversion Control System
Sriee Gowthem Raaj
104
The following figure shows the edited pre-revprop-change file
Figure 113 pre-revprop-changed file
Now you can edit the author name of a revision.
Figure 114 Before Editing
Subversion Control System
Sriee Gowthem Raaj
105
Figure 115 After Editing
Show
revision
properties
Shows the properties assigned to that revision
Copy to
clipboard
Copies the content to clipboard. You can use this content to mail to other members in
the team or save it for your reference.
Figure 116 Copy to clipboard
Search log
messages
Searches the log messages
II. Bottom Pane
Figure 117 Bottom Pane
Subversion Control System
Sriee Gowthem Raaj
106
Bottom pane shows the path and action corresponding to each revision.
Show All Shows all the log messages for all the revisions
Show Range Shows only log messages for a range of revisions
Next 100 Shows log messages for next 100 revisions
For a large project there may be several log messages, comments etc. It
may take long time to show log. At this time Show All/Show Range comes
into handy.
Stop on Copy/Rename Stops on branch/tag where files and folders are moved to the trunk.
Include merged
version
If a feature were implemented in branch are successful and it is merged
back to trunk.
Without checking this option – It will show messages as normal commit
With checking this option – It will show icon/grey text to indicate where
merge has taken place.
Statistics
Another feature of SVN is to show statistical informatics. You can view many different kinds of
graphs based on
 Statistics
 Commit by author
 Commit by date
 Percent of authorship
Subversion Control System
Sriee Gowthem Raaj
107
SVN supports the following graphical formats
 The visual representation of these graphs even adds clarity to the project overall subversion
log
 It can be also used to determine the quality of the programmer, number of people who are
actively contributing to the code base.
 Context menu of Bottom pane are self-explanatory
Stacked Line
Graph
Line Graph Stacked Bar
Graph
Bar Graph Pie Graph
Subversion Control System
Sriee Gowthem Raaj
108
Tortoise Merge
Tortoise Merge is an inbuilt tool which comes along Tortoise SVN. It is the default application which
will open when we are viewing the differences. You can also open Tortoise Merge as a separate tool.
The selected file will be shown side by side with their differences highlighted. The figure below
shows the merge tool.
Figure 118 Tortoise Merge
You will end up with Tortoise merge for the following options
 Diff with previous version
 Diff with working copy
 Diff between files
 Diff with URL
Subversion Control System
Sriee Gowthem Raaj
109
Tortoise IDiff
Tortoise IDiff is the inbuilt tool of Tortoise SVN which is used to find the differences between images.
 We can stack images either vertically or horizontally
 Zoom in/Zoom out the images
 Fit images in the space provided in the window
 Overlay images one over the other
 Lists the image info for both the images
Figure 119 Tortoise IDiff
Subversion Control System
Sriee Gowthem Raaj
110
Blame
Difference
Subversion Control System
Sriee Gowthem Raaj
111
Blame Differences
What is Blame?
Blame feature in SVN is used to find out who changed which content in a file.
Tortoise SVN  Blame from context menu will open the Blame dialog box as shown in the figure.
Figure 120 Context Menu --> Blame
Figure 121 Blame Dialog Box
 Blame can be applied only to a file. We can select from which revision to which revision we
need to see the blame differences.
 By default Tortoise Blame is used
 It shows revision number/author and the line which has been modified. When we hover the
mouse over to a particular revision, a small pop up window opens up displaying the log
Subversion Control System
Sriee Gowthem Raaj
112
messages entered by the author for that particular revision. This is shown in the figure
below.
Figure 122 Tool Tip on mouse hover
 When you select a particular author, changes made by that author in that revision will be
highlighted in bold colour and the modification made by the author in other revisions are
shown in less highlighted colour. The selection is a sticky selection.
Subversion Control System
Sriee Gowthem Raaj
113
Figure 123 Sticky selection
 There are also few Edit properties supported by SVN as shown in the figures below.
Figure 124 Edit --> Go to Line
Subversion Control System
Sriee Gowthem Raaj
114
Figure 125 Edit --> Find What
 Right Click on the Blame file brings up the context menu. The figure below shows the
functionality of each menu item
Subversion Control System
Sriee Gowthem Raaj
115
Figure 126 Blame --> Context Menu
**********************************************************************************

More Related Content

PDF
Documentation de Doctrine ORM
PDF
Htd group presentation
 
PDF
Manual de servicio serie a1 de baic
PDF
Yanmar b7 3(us) excavator service repair manual
PDF
Original
PDF
Yanmar sv08 1 excavator service repair manual
PDF
Yanmar vi o55 5 excavator service repair manual
PDF
ExTreM Expense Report Software
Documentation de Doctrine ORM
Htd group presentation
 
Manual de servicio serie a1 de baic
Yanmar b7 3(us) excavator service repair manual
Original
Yanmar sv08 1 excavator service repair manual
Yanmar vi o55 5 excavator service repair manual
ExTreM Expense Report Software

What's hot (10)

PDF
Doctrine Manual 1.2
PDF
Implementation Guidelines KQMH
PDF
ZTE Warp Elite Manual / User Guide
DOC
Cleft lip and palate / for orthodontists by Almuzian
PDF
MUHAMMAD SHARIF | TECHNOITSCHOOL BOOK
PDF
Molecular Cytogenetics Book
PDF
The Japanese Knotweed Bible - TP Knotweed Solutions
DOCX
TECHNOITSCHOOL BOOK OF PROJECT
PDF
5952-3706E
PDF
1. 1177
Doctrine Manual 1.2
Implementation Guidelines KQMH
ZTE Warp Elite Manual / User Guide
Cleft lip and palate / for orthodontists by Almuzian
MUHAMMAD SHARIF | TECHNOITSCHOOL BOOK
Molecular Cytogenetics Book
The Japanese Knotweed Bible - TP Knotweed Solutions
TECHNOITSCHOOL BOOK OF PROJECT
5952-3706E
1. 1177
Ad

Similar to Subversion Reference (20)

PDF
Man, marriage and machine – adventures in artificial advice
PDF
Tellurium reference Document 0.7.0
DOC
PDF
A Real Time Application Integration Solution
PDF
Magento Design Guide
PDF
Magento designguide
PDF
Tellurium 0.6.0 User Guide
PDF
Gemini Manual
PDF
Append 03 bash beginners guide
PDF
How to program with java (sample)
PDF
Operating system note
PDF
Netvibes user guide
PDF
How To View Current Execution Policy PowerShell
PDF
Final Roport_(After Binding).pdf
DOCX
UMG8900.docx
PDF
Access 2007 Notes-All Chapters.pdf
PDF
Penetration testing tutorial
PDF
Huong dan su dung canon 40005
PDF
Clojure forbeginners
PDF
Netex learningCentral | Administrator Manual v4.4 [En]
Man, marriage and machine – adventures in artificial advice
Tellurium reference Document 0.7.0
A Real Time Application Integration Solution
Magento Design Guide
Magento designguide
Tellurium 0.6.0 User Guide
Gemini Manual
Append 03 bash beginners guide
How to program with java (sample)
Operating system note
Netvibes user guide
How To View Current Execution Policy PowerShell
Final Roport_(After Binding).pdf
UMG8900.docx
Access 2007 Notes-All Chapters.pdf
Penetration testing tutorial
Huong dan su dung canon 40005
Clojure forbeginners
Netex learningCentral | Administrator Manual v4.4 [En]
Ad

More from University of Texas at Dallas (15)

PDF
Interaction overview & Timing diagram
PDF
Communication Diagram
PDF
Sequence Diagram
PDF
PDF
PDF
Deployment Diagram
PDF
Component Diagram
PDF
Composite Structure Diagram
PDF
PDF
PDF
Use Case UML Diagram
PDF
Introduction to UML
PPTX
Interaction overview & Timing diagram
Communication Diagram
Sequence Diagram
Deployment Diagram
Component Diagram
Composite Structure Diagram
Use Case UML Diagram
Introduction to UML

Recently uploaded (20)

PPTX
assetexplorer- product-overview - presentation
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Introduction to Artificial Intelligence
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Nekopoi APK 2025 free lastest update
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
ai tools demonstartion for schools and inter college
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPT
Introduction Database Management System for Course Database
assetexplorer- product-overview - presentation
Digital Systems & Binary Numbers (comprehensive )
Internet Downloader Manager (IDM) Crack 6.42 Build 41
wealthsignaloriginal-com-DS-text-... (1).pdf
How to Choose the Right IT Partner for Your Business in Malaysia
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Softaken Excel to vCard Converter Software.pdf
PTS Company Brochure 2025 (1).pdf.......
Introduction to Artificial Intelligence
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Design an Analysis of Algorithms I-SECS-1021-03
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Nekopoi APK 2025 free lastest update
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
ai tools demonstartion for schools and inter college
Adobe Illustrator 28.6 Crack My Vision of Vector Design
2025 Textile ERP Trends: SAP, Odoo & Oracle
Upgrade and Innovation Strategies for SAP ERP Customers
Introduction Database Management System for Course Database

Subversion Reference

  • 1. Subversion Control System Sriee Gowthem Raaj 1 Sriee Gowthem RaajBy
  • 2. Subversion Control System Sriee Gowthem Raaj 2 Table of Contents Introduction ..........................................................................................................................................10 What is this tutorial about? ..............................................................................................................10 What is subversion?..........................................................................................................................10 Tortoise SVN......................................................................................................................................10 Problems in Versioning Model..........................................................................................................11 Methodology 1 – Lock-Modify-Unlock .............................................................................................12 Merits............................................................................................................................................13 Demerits........................................................................................................................................13 Methodology 2 – Lock-Modify-Unlock .............................................................................................14 Repository.............................................................................................................................................16 What is a repository?........................................................................................................................16 How to create a repository? .............................................................................................................16 Why is repository asking for a folder structure? What is it? ............................................................17 Practical Illustration of Folder Structure.......................................................................................18 Scenario of Layout Usage..............................................................................................................19 Importing ..............................................................................................................................................21 What is importing?............................................................................................................................21 How to import data into the repository?..........................................................................................21 Be careful with the location!.............................................................................................................21 Scenario 1: What happens when project location is not specified properly?..............................22 Scenario 2: How to specify the project location? .........................................................................23 Working Copy & Checkout....................................................................................................................25 What is Working Copy & Checkout?.................................................................................................25 How to checkout data from the repository? ....................................................................................25 What is checkout depth?..................................................................................................................26 Fully Recursive ..............................................................................................................................26 Immediate Children, including folders..........................................................................................27 Only file children...........................................................................................................................27 Only this item................................................................................................................................27 Choose item ..................................................................................................................................28 What are Revisions?..........................................................................................................................28 Action Items..................................................................................................................................29
  • 3. Subversion Control System Sriee Gowthem Raaj 3 Revisions Terminology ..................................................................................................................29 Commit..................................................................................................................................................31 What is committing?.........................................................................................................................31 How to commit?................................................................................................................................31 Features of Commit dialog box.........................................................................................................32 Update ..................................................................................................................................................37 What is an update?...........................................................................................................................37 Why we need to update?..................................................................................................................37 How to do an update? ......................................................................................................................37 Sparse Update...................................................................................................................................38 What is sparse update?.................................................................................................................38 Update conflicts................................................................................................................................41 To avoid conflicts? ........................................................................................................................41 Resolving Conflicts ................................................................................................................................44 What is a conflict?.............................................................................................................................44 Resolving File Conflicts......................................................................................................................44 How to resolve a conflict?.................................................................................................................45 Resolving Tree Conflicts....................................................................................................................45 How to resolve Tree conflicts?..........................................................................................................45 Locking ..................................................................................................................................................49 What is locking?................................................................................................................................49 How to lock? .....................................................................................................................................49 Ignore....................................................................................................................................................53 Purpose of ignoring?.........................................................................................................................53 How to Ignore? .................................................................................................................................53 Remove Ignore..................................................................................................................................55 Change Lists ..........................................................................................................................................57 What are changelists?.......................................................................................................................57 How to add changelist?.....................................................................................................................58 Icons Overlay.........................................................................................................................................61 Adding Files...........................................................................................................................................63 Copy/Moving.........................................................................................................................................63 Renaming ..............................................................................................................................................64
  • 4. Subversion Control System Sriee Gowthem Raaj 4 Before Commit:.................................................................................................................................64 On commit: .......................................................................................................................................64 Drawbacks:........................................................................................................................................64 How to prevent this? ........................................................................................................................64 Deleting Files/Folders ...........................................................................................................................65 Undo Changes.......................................................................................................................................66 Exporting Working Copy .......................................................................................................................67 Relocation a Working Copy...................................................................................................................68 Branching/Tagging ................................................................................................................................70 What is a Branch? .............................................................................................................................70 What is Tag?......................................................................................................................................70 How to Branch/Tag? .........................................................................................................................70 Switching...........................................................................................................................................72 How to Switch? .............................................................................................................................73 Creating/Apply Patch............................................................................................................................75 What is a patch? ...............................................................................................................................75 How to create a patch?.....................................................................................................................75 Apply Patch .......................................................................................................................................77 Merging.................................................................................................................................................80 What is merging?..............................................................................................................................80 Methods in merging..........................................................................................................................81 Merging range of revisions ...........................................................................................................81 Merging two different trees .........................................................................................................83 Merge Option....................................................................................................................................84 Subversion properties...........................................................................................................................86 Features of SVN properties...............................................................................................................86 SVN Tools ..............................................................................................................................................97 Repo-Browser ...................................................................................................................................97 Revision Log ......................................................................................................................................98 Statistics......................................................................................................................................106 SVN supports the following graphical formats ...........................................................................107 Tortoise Merge................................................................................................................................108 Tortoise IDiff ...................................................................................................................................109
  • 5. Subversion Control System Sriee Gowthem Raaj 5 Blame Differences...............................................................................................................................111 What is Blame? ...............................................................................................................................111
  • 6. Subversion Control System Sriee Gowthem Raaj 6 Table of Figures Figure 1 Illustration of subversion system usage..................................................................................11 Figure 2 Developers A & B Checking out File........................................................................................11 Figure 3 Developers A & B saving files to the server ............................................................................11 Figure 4 Developer A reads & locks the file..........................................................................................12 Figure 5 Developer B gets read error when accessing the locked file..................................................12 Figure 6 Developer A releases lock and writes the file.........................................................................13 Figure 7 Developer B can now access the file.......................................................................................13 Figure 8 Developer A & B reads the same file ......................................................................................14 Figure 9 Developer A commits his changes to the server.....................................................................14 Figure 10 Developer B gets out of date error.......................................................................................14 Figure 11 Create Repository .................................................................................................................16 Figure 12 Create Folder Structure.........................................................................................................16 Figure 13 Folder --> Repository ............................................................................................................17 Figure 14 Repo Browser with URL ........................................................................................................19 Figure 15 Context Menu --> Import......................................................................................................21 Figure 16 Import Dialog Box .................................................................................................................21 Figure 17 Wrong Import .......................................................................................................................22 Figure 18 Repository messed up! .........................................................................................................22 Figure 19 Right Import..........................................................................................................................23 Figure 20 Project imported inside trunk...............................................................................................23 Figure 21 Context Menu --> SVN Checkout ..........................................................................................25 Figure 22 Checkout Dialog Box .............................................................................................................25 Figure 23 Checkout Depth option.........................................................................................................26 Figure 24 Checkout Depth - Fully Recursive .........................................................................................26 Figure 25 Checkout Depth - Immediate Children, including folders.....................................................27 Figure 26 Checkout Depth - Only file children......................................................................................27 Figure 27 Checkout Depth - Only this item...........................................................................................27 Figure 28 Checkout Depth - Choose Item.............................................................................................28 Figure 29 Revision Log ..........................................................................................................................28 Figure 30 Revision usage.......................................................................................................................29 Figure 31 Context Menu --> SVN Commit.............................................................................................31 Figure 32 Commit dialog box ................................................................................................................31 Figure 33 Features of Commit Dialog ...................................................................................................32 Figure 34 Adding project specific text ..................................................................................................33 Figure 35 Change list.............................................................................................................................34 Figure 36 Commit Finished ...................................................................................................................35 Figure 37 Context Menu --> Update.....................................................................................................37 Figure 38 Update finished.....................................................................................................................37 Figure 39 Update to Revision - Repo Browser......................................................................................38 Figure 40 Update to Revision - Working copy ......................................................................................39 Figure 41 Update to Revision dialog box ..............................................................................................39
  • 7. Subversion Control System Sriee Gowthem Raaj 7 Figure 42 Update to Revision Scenario.................................................................................................40 Figure 43 Update Conflict .....................................................................................................................41 Figure 44 Context Menu --> Check for Modification ............................................................................41 Figure 45 Check for modification..........................................................................................................42 Figure 46 File in Conflict........................................................................................................................44 Figure 47 Conflicted area......................................................................................................................45 Figure 48 Context Menu --> Resolve.....................................................................................................45 Figure 49 Context Menu --> Get Lock...................................................................................................49 Figure 50 Get Lock Dialog Box...............................................................................................................49 Figure 51 Lock Finished Dialog Box.......................................................................................................50 Figure 52 Lock status.............................................................................................................................50 Figure 53 Use of "Check for Modification" in locking...........................................................................51 Figure 54 Context Menu --> Ignore.......................................................................................................53 Figure 55 Ignore multiple files ..............................................................................................................54 Figure 56 After Ignore...........................................................................................................................54 Figure 57 After Ignore Commit .............................................................................................................54 Figure 58 Checking Ignore.....................................................................................................................54 Figure 59 Remove Ignore......................................................................................................................55 Figure 60 Without Change list ..............................................................................................................57 Figure 61 Adding Change list ................................................................................................................58 Figure 62 With Changelist.....................................................................................................................59 Figure 63 Adding files - Right Drag........................................................................................................63 Figure 64 Right Drag - Copy/Move........................................................................................................63 Figure 65 Repair Move..........................................................................................................................65 Figure 66 Context Menu --> Delete ......................................................................................................65 Figure 67 Context Menu --> Revert ......................................................................................................66 Figure 68 Revert Dialog Box..................................................................................................................66 Figure 69 Context Menu --> Export.......................................................................................................67 Figure 70 Right Drag Export..................................................................................................................67 Figure 71 Relocate Dialog Box ..............................................................................................................68 Figure 72 Not a root error.....................................................................................................................68 Figure 73 Context Menu --> Branch/tag...............................................................................................70 Figure 74 Branch/tag dialog box...........................................................................................................71 Figure 75 After Branch/tag ...................................................................................................................72 Figure 76 Context Menu --> Switch ......................................................................................................73 Figure 77 Switch dialog box ..................................................................................................................73 Figure 78 Context Menu --> Create Patch ............................................................................................75 Figure 79 Create patch dialog box ........................................................................................................76 Figure 80 Patch file ...............................................................................................................................77 Figure 81 Context Menu --> Apply Patch..............................................................................................77 Figure 82 Tortoise Merge......................................................................................................................78 Figure 83 Merge Wizard........................................................................................................................80 Figure 84 Merge range of revision........................................................................................................81
  • 8. Subversion Control System Sriee Gowthem Raaj 8 Figure 85 Merge --> Show Log ..............................................................................................................82 Figure 86 Merge Two Different trees ...................................................................................................83 Figure 87 Test Merge............................................................................................................................84 Figure 88 Property dialog box...............................................................................................................86 Figure 89 Import Property ....................................................................................................................87 Figure 90 After Import ..........................................................................................................................87 Figure 91 Default properties.................................................................................................................88 Figure 92 New --> Other .......................................................................................................................88 Figure 93 End of Line style....................................................................................................................88 Figure 94 Windows properties..............................................................................................................89 Figure 95 svn:exteranl property window..............................................................................................90 Figure 96 External property inserted....................................................................................................90 Figure 97 Setting external.....................................................................................................................90 Figure 98 Repo-Browser with external project.....................................................................................91 Figure 99 Minimum log size..................................................................................................................92 Figure 100 Language option..................................................................................................................92 Figure 101 MIME type...........................................................................................................................92 Figure 102 Properties............................................................................................................................94 Figure 103 Log Minimum size ...............................................................................................................94 Figure 104 Log Template.......................................................................................................................95 Figure 105 Repo-Browser .....................................................................................................................97 Figure 106 Revision Log ........................................................................................................................98 Figure 107 Top Pane - Revision Log ......................................................................................................99 Figure 108 Revision Log Tool tip ...........................................................................................................99 Figure 109 Context Menu Top Pane ...................................................................................................100 Figure 110 Unified Diff........................................................................................................................101 Figure 111 Compare with previous version........................................................................................102 Figure 112 pre-revprop-change error.................................................................................................103 Figure 113 pre-revprop-changed file..................................................................................................104 Figure 114 Before Editing....................................................................................................................104 Figure 115 After Editing ......................................................................................................................105 Figure 116 Copy to clipboard..............................................................................................................105 Figure 117 Bottom Pane .....................................................................................................................105 Figure 118 Tortoise Merge..................................................................................................................108 Figure 119 Tortoise IDiff .....................................................................................................................109 Figure 120 Context Menu --> Blame...................................................................................................111 Figure 121 Blame Dialog Box ..............................................................................................................111 Figure 122 Tool Tip on mouse hover ..................................................................................................112 Figure 123 Sticky selection..................................................................................................................113 Figure 124 Edit --> Go to Line .............................................................................................................113 Figure 125 Edit --> Find What .............................................................................................................114 Figure 126 Blame --> Context Menu...................................................................................................115
  • 9. Subversion Control System Sriee Gowthem Raaj 9 Introduction to SVN
  • 10. Subversion Control System Sriee Gowthem Raaj 10 Introduction What is this tutorial about? This tutorial is about Subversion Control system. The series of articles in this blog takes about various features of Tortoise SVN and how to implement them. I have explained these concepts with reference to concepts and from a developer perspective. This tutorial is for software professionals who are early in their career and are using subversion in a day to day basis. Familiarity with subversion concepts gives you the base for understanding any derivative of subversion systems. This tutorial is not for professionals who are developing subversion software’s and who are administrators of version control systems. These articles are 1. Atomic (not dependent on other articles). 2. They can be used as reference if you are stuck with implementing any feature. What is subversion? It is an open source version control system. Subversion allows you manage files and folders along with their changes over a period of time. It plays a key role in software development process. Since each project involves developers working at different locations, organizations use subversion to maintain their code base in a centralized location. Subversion is a power tool for a developer’s tools kit. Learning its feature and how to implement them will make your life easier as a developer. I have tailored these articles using Tortoise SVN. Tortoise SVN Advantages in using Tortoise SVN are as follows  User friendly GUI Tool  Inbuilt tools – TortoiseIDiff, TortoiseMerge, Tortoise Repository Browser  Overlay status icons representing the state of the files/folders  Efficient tracking over the changes in a development life cycle  It is an open source project developed under General Public License (GPL) making it free to download and use for personal and professional projects
  • 11. Subversion Control System Sriee Gowthem Raaj 11 Figure 1 Illustration of subversion system usage Problems in Versioning Model Scenario: Two developers are working on a same module, there are few bugs in this module and it has to be fixed by the developers. Both the developers take the source code from a central location. They start working on the code to fix the bug assigned to them. Each developer has made changes to the code and has fixed the bugs assigned to each of them. Figure 2 Developers A & B Checking out File Figure 3 Developers A & B saving files to the server
  • 12. Subversion Control System Sriee Gowthem Raaj 12 Now they have to paste the modified code back to the whole projects location. Developer 1 pastes his modified code to the server. After that Developer 2 pastes his modified code to the server overwriting the changes made by developer 1. The problems are 1. Each developer does not have any idea about other developer changes 2. Both the developers are working on the same source code. There is a possibility that overwriting occurs often 3. The scenario illustrated is simple involving only 2 developers. Imagine the complexity for a huge project involving teams working offshore and onsite. There are two methodologies discussed below for solving the above problem. Methodology 1 – Lock-Modify-Unlock  Developer A reads the file for the module assigned for him from the server.  He locks the file so that others can’t access the file unless he writes the file and unlocks it.  Developer A can start modifying the code to fix the bug assigned to him. Figure 4 Developer A reads & locks the file  Developer B tries to read the file in the same module.  Developer B gets an error for accessing the file. Figure 5 Developer B gets read error when accessing the locked file
  • 13. Subversion Control System Sriee Gowthem Raaj 13 Figure 6 Developer A releases lock and writes the file  Developer A has made his changes in the source code.  He writes his file to the server and unlocks it. Figure 7 Developer B can now access the file  Now other developers can read the file for modification.  Using this method Developer A changes is present in the source code and others are aware of developers A changes. Merits This method solves the problem with file overwriting and masking the changes made by other developers. However there are some shortcomings in this methodology. Demerits 1. If a person has locked a file and is not available, then admin should intervene and unlock the files 2. If the person who has locked a file went on leave or a vacation, then it becomes a problem for others. They have to wait for the person to release his lock to access the file. 3. This method gives way to Serialization – Other persons in the team has to wait for one person to finish his task. Parallel working is not possible. This is the major disadvantage with this method These disadvantages make this method unlikely to be used.
  • 14. Subversion Control System Sriee Gowthem Raaj 14 Methodology 2 – Lock-Modify-Unlock  Both developers (A & B) can take the source code from the server.  Developer A begins to make changes in the file.  Developer B also modifies the file  Developer A commits his changes first to the server.  Developer A’s commit has changed the state of the code in the server. Figure 9 Developer A commits his changes to the server Figure 10 Developer B gets out of date error  Developer B after making modifications is going to paste his code to the server  Developer B gets an out of date error.  This error implies that the source code in the server has changed since developer B copied the code Figure 8 Developer A & B reads the same file
  • 15. Subversion Control System Sriee Gowthem Raaj 15 Repository
  • 16. Subversion Control System Sriee Gowthem Raaj 16 Repository What is a repository? Repository is the core aspect of a subversion system. It is the location where all the project contents are stored. It is similar to your cloud storage but it will remember all the changes that have taken place in the repository. It can have multiple clients accessing it. Clients can read/write from the repository, they can view the historical changes that have been taken in the repository. How to create a repository? Step 1. Go to a location where you want to place the entire project. It can be in your hard drive or in a remote server Step 2. Create a folder. Right Click on the folder Step 3. In the context menu select TortoiseSVN  Create Repository Here. Step 4. After repository is created, SVN asks you to whether create a folder structure. Figure 12 Create Folder Structure Figure 11 Create Repository
  • 17. Subversion Control System Sriee Gowthem Raaj 17 Step 5. You can create the folder structure now or later. Click Ok and your repository is created. The folder changes like the picture shown below. Figure 13 Folder --> Repository Why is repository asking for a folder structure? What is it? Folder structures are like common layouts that are used in projects. It is a way projects are organized. It is not mandatory part of a Subversion system or for a project. Every project or organizations follow their own structures. The default folder structure provided by SVN is /trunk, /branch and /tag. Even if we have not created the folder structure when we created the repository we can add folders to the repository just like we are adding folders in windows explorer using repository browser. /trunk This is the folder where main line of development takes place. It is the place holder of your code base. For Example: If you are working for a company which develops Mobile Apps. Then the source code/resources/build files will be present in /trunk /branch This is the folder which contains the code separated from the main line of development. Normally branches are used to add new features for the project.  If the new feature works well then it will be merged back into the /trunk.  If the new feature did not work it won’t affect the real line of development.  If there are minor changes and often committing operation is going on, it won’t annoy the developers working for on new line of development. For Example: You mobile app product has successfully used Bluetooth module and is released. Your company wants to know whether they can use Wifi module also. So this feature addition is done in the branch without affecting the main line of development.
  • 18. Subversion Control System Sriee Gowthem Raaj 18 /tag Tag is used to keep the released version of the code. You can see all the releases for a project in /tag. For Example: Your mobile app supports 4 languages till v1.4 and language support has been restricted to only English from v1.5. Users can get v1.4 of you application from /tag. Practical Illustration of Folder Structure Layout can be used based upon the functionality of the project. 1. Indexing by branch – Used if the project files are related to each other 2. Indexing by project – Used If there are different set of projects Scenario: Let us consider possible folder structure for Mobile Application Development Company Indexing by branch Indexing by project The screenshot below shows the default folder structure for the repository created. I have used the default folder structure (/trunk, /branch, /tag) for the articles.
  • 19. Subversion Control System Sriee Gowthem Raaj 19 Figure 14 Repo Browser with URL Scenario of Layout Usage Initially /trunk – Development version to be released v1.0 /branch – No files /tag – No files After v1.0 release /trunk – Development version to be released v1.1 /branch – Used for bug fixing in v1.0 and released as v1.0.1 /tag – v1.0 This is how the folder structure in the repository looks when development cycle is going on. Repository URL Schema For Local drives: file:///D:/path/to/repository Example: file:///D:/SVN/Repository For File servers: file://hostname/path/to/repository Example: file://12.14.15.2/Repository
  • 20. Subversion Control System Sriee Gowthem Raaj 20 Import
  • 21. Subversion Control System Sriee Gowthem Raaj 21 Importing What is importing? Importing is a feature where you can add your project to the repository. This is the immediate next step to do after creating the repository. How to import data into the repository? Step 1. Select the project which is required to be imported into the repository. Right click to get the context menu as shown below. Figure 15 Context Menu --> Import Step 2. Select import. A dialog box shows up. Step 3. Select the location of the repository where you want to import the project Step 4. Enter the log message. These log messages are atomic transactions which will help others to know the purpose of the action. Be careful with the location! The URL of the repository should be selected properly. You need to specify at which part of the folder structure (/trunk, /branch, /tag) inside the repository you need to import the data. Otherwise the whole repository will be messed up. Figure 16 Import Dialog Box
  • 22. Subversion Control System Sriee Gowthem Raaj 22 Let us see 2 examples related to this. Scenario 1 tells about what happens when the location is not specified and scenario 2 tells us the right way of specifying the location. Scenario 1: What happens when project location is not specified properly? Figure 17 Wrong Import Figure 18 Repository messed up!
  • 23. Subversion Control System Sriee Gowthem Raaj 23 Scenario 2: How to specify the project location? Figure 19 Right Import Figure 20 Project imported inside trunk
  • 24. Subversion Control System Sriee Gowthem Raaj 24 Working Copy & Checkout
  • 25. Subversion Control System Sriee Gowthem Raaj 25 Working Copy & Checkout What is Working Copy & Checkout? The process of extracting data from the repository is known as Checkout Working copy is an ordinary directory tree copied to your own hard disk. It is a private copy where you can work on them. This working copy is taken from the repository by a process called checkout How to checkout data from the repository? Step 1. Right click on the folder where you want your private copy to be to get the context menu. Step 2. Click SVN Checkout to get the dialog box shown. Figure 22 Checkout Dialog Box Step 3. Options in the dialog box a. URL of Repository: From where you want to take a copy b. Checkout directory: To where you want to paste the project c. Checkout depth: The depth up to which you need the files d. Omit Externals: Externals are external linking to the project (Will be discussed in future articles) e. HEAD Revision: Current revision in the repository f. Revision: We can specify specific revision Figure 21 Context Menu --> SVN Checkout
  • 26. Subversion Control System Sriee Gowthem Raaj 26 Step 4. Press Ok. All the project contents will be copied to your hard disk as a private copy. (Read through the article to know in detail for the options present in the dialog box) What is checkout depth? Checkout depth specifies the level up to which the data should be copied from the repository to your hard disk. There are four options in checkout depth. Figure 23 Checkout Depth option Fully Recursive Figure 24 Checkout Depth - Fully Recursive All files and folders in the repository are copied to local hard disk
  • 27. Subversion Control System Sriee Gowthem Raaj 27 Immediate Children, including folders Figure 25 Checkout Depth - Immediate Children, including folders Only file children Includes only the files immediately next to the top level folder. This option does not include folders Figure 26 Checkout Depth - Only file children Only this item Includes only the top level empty folder without any content inside them Figure 27 Checkout Depth - Only this item Includes only files and folders immediately next to the top level project folder
  • 28. Subversion Control System Sriee Gowthem Raaj 28 Choose item This option allows the users to choose specific files that are required. Though this option gives more control to the user it will take lot of time while committing their changes to the repository. Figure 28 Checkout Depth - Choose Item What are Revisions? Revisions are atomic transaction numbers. Each import/checkout/commit/lock/merge etc is assigned a revision number. Revisions represent the changes that are made for a particular file or a folder in the repository. With version numbers you can take a snapshot of a particular state of the project. Figure 29 Revision Log
  • 29. Subversion Control System Sriee Gowthem Raaj 29 The above revision log gives details about the revision number, author and comments associated with a revision. Let us understand the use of revisions using a simple example. Scenario: Revision 9 is a stable revision; your software is running fine without any crashes. In revision 11 some new features have been added but now the software is crashing. Your task is to find out why the crash is occurring? Action Items Q1. You need to know which revision is standard and which revision is crashing Q2. You need to know what changes had been added since the stable version Q3. Then you need the project in a state when it was not crashing to debug the issues We can get the answers from the revision log. This example shows practical usage of revisions. Figure 30 Revision usage Revisions Terminology Head Revision The latest revision present in the repository Base Revision ‱ The revision when you checked out a working copy to your system ‱ Changes may be made to the repository after your check out Snapshot ‱ Making a private copy from the repository at a particular state ‱ User can specify the revision number in SVN Checkout Dialog box Stable Revision Need to checkout Crashing Revision Changes made in this revision
  • 30. Subversion Control System Sriee Gowthem Raaj 30 Commit
  • 31. Subversion Control System Sriee Gowthem Raaj 31 Commit What is committing? Committing is process of publishing your changes to the repository so that your changes are saved in the code base and others accessing the repository will get the updated version of the source code. How to commit? Step 1. After making your changes in the project, right click the project that you want to commit to the repository. You will see the context menu as shown in the figure Step 2. Select SVN Commit. You will get the commit dialog box as shown in the figure below Figure 32 Commit dialog box Figure 31 Context Menu --> SVN Commit
  • 32. Subversion Control System Sriee Gowthem Raaj 32 Features of Commit dialog box Figure 33 Features of Commit Dialog  Shows list of versioned and unversioned files in the bottom pane  Columns in the bottom pane can be resized, added or removed  Can Drag/Drop files  Checkbox is present to add only specific files for this commit  When a lock is acquired by this author it will be released automatically after committing  We can format the log messages o *text* - Bold o ^text^ - Italics o _text_ - underline  We can also add project specific text to the dictionary as shown in the figure below
  • 33. Subversion Control System Sriee Gowthem Raaj 33 Figure 34 Adding project specific text  Ctrl + Space gives auto suggestion  Add/Delete recent log messages  We can also add path to the log messages. Drag the file in the bottom pane and drop in the edit control. You should be able to see the path of the file copied to the log message.  You can also move the files to change list o Change List – Grouping files under a category. Ignore-on-commit is the predefined list as shown in the figure below. We can add our own change list (It is discussed in a separate article)
  • 34. Subversion Control System Sriee Gowthem Raaj 34 Figure 35 Change list Step 3. After entering the log messages using the features discussed above. Click Ok. Your changes will be added to the repository. A dialog box opens to inform you the status of the commit as shown below Note Log Messages: Some projects have a template for entering the log messages. These log messages should tell what the change is about. It is a good practice to make it clear and understandable.
  • 35. Subversion Control System Sriee Gowthem Raaj 35 Figure 36 Commit Finished You will see the commit messages with different colors. The color schema for the commit messages are as follow Black Unrevisioned files Red Files that are deleted or replaced Blue Committing a modified file Purple Adding new file into the repository However these color settings can be modified in the TortoiseSVN Settings, I prefer to use to default color schema reducing the need to memorizing set of color schemas.
  • 36. Subversion Control System Sriee Gowthem Raaj 36 Update
  • 37. Subversion Control System Sriee Gowthem Raaj 37 Update What is an update? Process of incorporating others changes in your working copy is known as updating. Why we need to update? As the name implies we need to have the updated version to merge our changes. Let us consider this possible scenario. You have checked out revision 145 from the repository (This will be your Base revision). Similarly others started to work on their private copy. Many of your peers have made changes in the source code and committed them in the repository. The Head revision of the repository is 160. When you try to commit your changes, you will get an out of date error. Because there are many changes present in the HEAD revision against your BASE revision. To solve this you need to update your working copy and then commit your changes. How to do an update? Step 1. Select the folder. Right click and select the options shown in the figure Step 2. Select SVN Update. Update action starts. The color scheme of committing applies to update dialog as well. Figure 38 Update finished Step 3. Now you can commit your changes to the repository Figure 37 Context Menu --> Update
  • 38. Subversion Control System Sriee Gowthem Raaj 38 Sparse Update What is sparse update? When your checkout depth is other than “Fully Recursive” in SVN Checkout dialog box then it is known as sparse update. Update to revision should be used to mirror your working copy to the repository. Let us understand update to revision with a simple scenario. Scenario: There are many projects that are connected to other projects in your repository. There is a requirement change that needs to be added in a particular project. Checking out the whole project will be a daunting task. So here’s how to do it. Step 1. Locate the trunk of the project in the repository – Project Root. Step 2. Right click on the folder in your local machine where you want to check out the source code. In this case you need Project 1. Step 3. Select Project 1 and choose “Only this item” in SVN Checkout dialog box. This option only copies the top level folder (i.e Project 1) without the content inside the folder. Step 4. Selecting update to revision will copy the files of project 1 to your local machine. You can use the folder or repo-browser to update your working copy. Two possibilities are shown in the figure below. Figure 39 Update to Revision - Repo Browser
  • 39. Subversion Control System Sriee Gowthem Raaj 39 Figure 40 Update to Revision - Working copy Step 5. We can specify which revision of Project 1 to update in your working copy. Either HEAD revision or a specific version Step 6. Update Depth a. Working copy – Uses the same depth you chose which checking out your working copy b.Make Depth Sticky – Will use the same option for future selections also Step 7. Press Ok to mirror your working copy to the repository Figure 41 Update to Revision dialog box
  • 40. Subversion Control System Sriee Gowthem Raaj 40 Figure 42 Update to Revision Scenario
  • 41. Subversion Control System Sriee Gowthem Raaj 41 Update conflicts Whenever other developers have made changes in the same file you have made changes, update dialog box shows the file that are conflicted. This is shown in the figure below Figure 43 Update Conflict To avoid conflicts? Before committing or updating your working copy it is better to check for modifications in the repository. Right click on the folder; context menu appears as shows in the figure below. Figure 44 Context Menu --> Check for Modification Select Check for modifications will open a dialog box which gives information about the files/folders modified. The figure below shows a single file (ReadMe.txt) modified by two users. It is better to use this option when you are using sparse update.
  • 42. Subversion Control System Sriee Gowthem Raaj 42 Figure 45 Check for modification
  • 43. Subversion Control System Sriee Gowthem Raaj 43 Resolve Conflicts
  • 44. Subversion Control System Sriee Gowthem Raaj 44 Resolving Conflicts What is a conflict? A conflict arises when two or more person modified the same file or due to missed/renamed/deleted folders. Resolving File Conflicts File conflicts should be resolved manually by the developers in their private working copy before committing their changes into the repository. Whenever there is a conflict in a project the overlay status of the project icon will be changed to conflict as shown in the figure. It is a good practice to use “Check for modification” before updating/committing your working copy with the repository. When you’re working copy sees a conflict with the file it will create three files in you working copy. Filename.ext.mine - Your changes before updating Filename.ext.rOLDREV - BASE Revision before updating Filename.ext.rNEWREV - HEAD Revision that is received from the repository Conflict File conflict When many changes happened on the same file Tree Conflict When many peers changed the tree structure by renaming/moving/deleting a folder Figure 46 File in Conflict
  • 45. Subversion Control System Sriee Gowthem Raaj 45 How to resolve a conflict? Step 1. Open the editor of your choice. The changes will be mentioned in the format as shown in the figure. Step 2. After making the changes, right click on the folder with conflict and select the option as shown in the figure. Figure 48 Context Menu --> Resolve Step 3. Resolve conflict will a. Keeps your version and overwrites the repository version b. Deletes the files (filename.ext.mine, filename.ext.rOLDREV, filename.ext.rNEWREV) that were created during conflicts Step 4. After the conflicts are resolved you will see normal overlay status icon for the folder. Note: Context Menu  Revert after resolving a conflict will keep the repository version only, your changes will be discarded. Resolving Tree Conflicts Resolving tree conflicts are not as direct as resolving files conflict. There can many possible scenarios for a tree conflict to arise. I have illustrated some of them below. How to resolve Tree conflicts?  SVN has no way automated to resolve tree conflicts  Developers should communicate with each other and resolve the conflict.  SVN provided tools like Revision Log/ Merge history can be used to track the changes that went on in a single revision. With this information it is up to the developers to work out a possible solution for renamed/moved/deleted file in the tree. Figure 47 Conflicted area
  • 46. Subversion Control System Sriee Gowthem Raaj 46 Scenario 1 Scenario 2 Scenario 3 Commit Modifies Foo.txtFoo.txt Foo.txt Checkout Changes Foo.txt to Boo.txt Deletes Foo.txt Commit Changes Foo.txt to Boo.txt (or) Moves Foo folder to Boo Folder Modifies Foo.txt Modifies Foo folder Checkout Foo.txt (or) Foo Folder Foo.txt (or) Foo Folder Commit Modified Foo.txt to Doo.txt Modified Foo.txt to Boo.txt Checkout Foo.txt Foo.txt
  • 47. Subversion Control System Sriee Gowthem Raaj 47 Scenario 4 Scenario 5 Scenario 6 Modified Foo.txt to Boo.txt Modified Foo.txt Foo.txtFoo.txt Merge Modifies Foo.txt Modifies Foo folder Changes Foo.txt to Boo.txt (or) Moves Foo folder to Boo Folder Foo.txt (or) Foo folder Foo.txt (or) Foo folder Merge Modified Foo.txt to Boo.txt Modified Foo.txt to Doo.txt Foo.txt (or) Foo folder Foo.txt (or) Foo folder Merge
  • 48. Subversion Control System Sriee Gowthem Raaj 48 Locking
  • 49. Subversion Control System Sriee Gowthem Raaj 49 Locking What is locking? We have already seen the methodology Lock-Modify-Unlock. This feature is supported by SVN, it is up to the user to lock files. These are applicable to build or makefiles. Making changes in these files could mess up the entire project setup environment. Locking is applicable for files/folders that are show stoppers. How to lock? Step 1. Select the file/folder that you want to lock. Right click will bring up the context menu as shown in the figure. Step 2. Selecting Get Lock will open a dialog box where you can select the files you need to acquire lock. Enter the log message stating the reason for locking file(s). The Get Lock dialog box is shown in the figure. Figure 49 Context Menu --> Get Lock Figure 50 Get Lock Dialog Box
  • 50. Subversion Control System Sriee Gowthem Raaj 50 Step 3. After lock has been acquired, Lock finished dialog box will appear detailing the current action taken as shown in the figure. Further Icon overlay shows locked status for the files locked. Figure 52 Lock status Steal lock/ Break lock: SVN provides this feature to steal or break a lock acquired by other person. This feature may be helpful in some cases but is not recommended. Use of “Check for Modification” with locking: Check for modification option helps the developers to get a clear picture of the lock status in the repository. Use of Hook – scripts: SVN uses hook scripts for automating some features. For instance we can write scripts to send a mail to the entire team when someone acquires a lock/releases a lock. Figure 51 Lock Finished Dialog Box
  • 51. Subversion Control System Sriee Gowthem Raaj 51 Figure 53 Use of "Check for Modification" in locking
  • 52. Subversion Control System Sriee Gowthem Raaj 52 Ignore
  • 53. Subversion Control System Sriee Gowthem Raaj 53 Ignore Purpose of ignoring? Files that are created while compiling your project - *.obj, *.lst (or) the output folder which contains *.exe files generated from your project. Each time user commits his project SVN shows these files to be unversioned. Imagine the scenario for a project which contains many modules and time cost for committing these changes to the repository. At these circumstances files/folders can be ignored from versioning. How to Ignore? Step 1. Select the file you want to ignore. Right click will give you the context menu as shown in the figure Figure 54 Context Menu --> Ignore Step 2. a. Every file will give you 4 options Filename.filenameExtension – Only that file *.filenameExtension – Files with that extension Filename.filenameExtension (recursively) – All files with that name and extension *.filenameExtension (recursively) – All files with that extension
  • 54. Subversion Control System Sriee Gowthem Raaj 54 b. Ignoring multiple files will show similar options as shown in the figure below. Figure 55 Ignore multiple files Step 3. After selecting the option, the file will be marked in deleted state. Step 4. Committing the ignored file will change their state to ignore as shown in the figure. Step 5. Making any changes to ignored files will not change them to modified state. As shown in the figure, a.bat is modified but it state did not change after saving the changes. Figure 58 Checking Ignore Figure 57 After Ignore Commit Figure 56 After Ignore
  • 55. Subversion Control System Sriee Gowthem Raaj 55 Remove Ignore We can remove the ignore files using the same process as adding files to ignore list. After removing the files have been changed from ignore state to changed state. This is illustrated in the figure. After ignoring the file state has been changed to modified state. Figure 59 Remove Ignore
  • 56. Subversion Control System Sriee Gowthem Raaj 56 Change List
  • 57. Subversion Control System Sriee Gowthem Raaj 57 Change Lists What are changelists? Changelist is a feature which helps developers to group files they have modified. This feature gives developers clarity over the files they have modified. It is up to the developers to use this feature; it is only applicable to client machine. It doesn’t have any effect on the repository. Scenario: Developer is working on several files in a single module. In order to track his files, his changes and what changes went on in each commit. He can use change ist to categorize his set of files. Our developer is working on some files in Application layer and a particular module in Middleware; let’s have a look at his commit dialog without change list. Figure 60 Without Change list Now this is pretty messed up and he decides to add changelist to track his set of files.
  • 58. Subversion Control System Sriee Gowthem Raaj 58 How to add changelist? Step 1. Selects the files  Right click to get the context menu as shown in the figure. Figure 61 Adding Change list Step 2. Default change list would be ignore-on-commit. Adding files to this changelist will add ignore property. Step 3. If you haven’t added any change list until now <new changelist> will be shown Step 4. Click <new changelist> to add any field. Step 5. Selected files will now be grouped under your new changelist. Note: Changelist doesn’t deal with any state changes or make any changes in the repository. It is used by users to group files on their private machine.
  • 59. Subversion Control System Sriee Gowthem Raaj 59 Let’s have a look at our developer commit dialog after adding changelist Figure 62 With Changelist
  • 60. Subversion Control System Sriee Gowthem Raaj 60 Common
  • 61. Subversion Control System Sriee Gowthem Raaj 61 Icons Overlay One of the attracting features of Tortoise SVN is Icon overlays. These visual icons provide us the status of file currently in. Each icon has a meaning associated with it. Normal status Icon This file in your working copy mirrors the contents in the repository. Modified status icon This file has been modified since it was last checked out from the repository. Non versioned status icon This file is not versioned. It will be versioned on committing. Added status icon This file has been added in your working copy and is not added to the repository. It will be added and versioned on committing. Conflicted status icon This file is under conflict. Two or more users have modified the same file. Needs user attention to resolve the conflict and move it to normal state. Deleted status icon This file has been deleted. This will be removed from the repository on commit.
  • 62. Subversion Control System Sriee Gowthem Raaj 62 Locked status icon This file has been locked by one of the users. It cannot be modified by other users. Read-only status icon This file has “needs-lock” property assigned to it. Users checking out this file should acquire a lock. Without lock users can’t make any changes to this file. Ignored status icon This file won’t be versioned. Changes in this file won’t be reflected while committing. To get detailed properties for a particular file, Right Click  Windows Properties will open up the dialog box shown in the figure below.
  • 63. Subversion Control System Sriee Gowthem Raaj 63 Adding Files There are two ways to add files. First is the normal way that we add files in the windows explorer. When files are added newly via windows explorer, the file shows un-versioned status. Committing the file will add these un- versioned files to the repository. Second way is to drag and drop files in your working copy location. Right dragging the files to your working copy will bring up the context menu as shown in the figure. Select “SVN Copy and add files to this WC (Working Copy)”. The file will show added icon overlay status. Committing will add this file in the repository. Copy/Moving  These common operations are same, but there are small differences that need to be understood.  You can copy/move/rename files from within the working copy, with different working copies but within repositories files history won’t be saved. It will be added as a new file in other repository.  You can Right Drag files to your working copy. Right drag will open a context menu as shown in the figure. Select “SVN Copy and add files to this WC” will mark the files with added status. Committing will update these files in the repository. Figure 64 Right Drag - Copy/Move Figure 63 Adding files - Right Drag
  • 64. Subversion Control System Sriee Gowthem Raaj 64  Difference between Copy/Paste and Copy/TortoiseSVN Paste Copy (Ctrl+C) & Paste (Ctrl+V) Copy (Ctrl+C) & TortoiseSVN Paste (Ctrl+V) When you copy a file and paste it in your working copy, the file will be in unversioned state ( ). All the previous version history for that file will be lost. When you copy a file and TortoiseSVN paste it in your working copy, the file will be in added state ( ). All the previous version history for that file will be preserved. Without revision history, it would be difficult for the user while bug fixing With comments present in the log message, you could track the files using revision log. Renaming Scenario: Consider that you have renamed a file from “ReadMe.txt” to “DontReadMe.txt”. When you commit, Subversion thinks “ReadMe.txt” is missing and “DontReadMe.txt” as a new file. Before Commit: ReadMe.txt will be in missing state ( ). DontReadMe.txt will be in added state ( ). On commit: ReadMe.txt will be deleted and DontReadMe.txt will be added and versioned. Although you retain the file there are few drawbacks. Drawbacks:  You will be losing the version history of ReadMe.txt. DontReadMe.txt will be having new comments that were entered on commit.  Before committing, when you update your working copy ReadMe.txt will be copied back from the server. How to prevent this? In Commit or Check for Modification dialog box, select the files that you renamed. Right click on the files to get the context menu as shown in the figure. Select Repair Move to pair two files as rename.
  • 65. Subversion Control System Sriee Gowthem Raaj 65 Figure 65 Repair Move Deleting Files/Folders  Always use TortoiseSVN  Delete to delete a file.  The advantage is that you will be entering log messages stating the reason for deleting the file. It will be versioned, making it easy to track the file.  On the contrary deleting files from windows explorer will lose version history information about that file. Figure 66 Context Menu --> Delete
  • 66. Subversion Control System Sriee Gowthem Raaj 66 Undo Changes  We can undo our changes using TortoiseSVN  Revert.  Select files that are required to revert back. Revert dialog box is shown in the figure below. Figure 68 Revert Dialog Box  Revert operation will only undo the changes in your local copy, it won’t affect the repository  Revert operation is slow; SVN moves modified files to your recycle bin and then copies files from the repository.  Clean up is a feature in SVN used you’re your working copy is in inconsistent state. TortoiseSVN  Cleanup will fix your working copy. It is recommended to use Revert than Clean up. Figure 67 Context Menu --> Revert
  • 67. Subversion Control System Sriee Gowthem Raaj 67 Exporting Working Copy  There are many ways to export your project. You can export from Repo-Browser, Working Copy, Show log and by dragging & dropping to another location.  To export, select the file Right Click to get the context menu as shown in the figure.  Export functionality is the same irrespective of the context.  Export is used to get the contents of a project without version control attached to it. You won’t see .svn folder or icon overlay’s as illustrated in the figure below. Figure 70 Right Drag Export Figure 69 Context Menu --> Export
  • 68. Subversion Control System Sriee Gowthem Raaj 68 Relocation a Working Copy As the title implies, TortoiseSVN  Relocate is used to shift the location of a working copy. It is most infrequently used operations. This feature is used when there are any IP/URL changes or protocol (http  https) changes. Figure 71 Relocate Dialog Box Relocating a working copy can be done only in the root folder. It will throw an error if other folders are used. Error is shown in the figure below. Figure 72 Not a root error
  • 69. Subversion Control System Sriee Gowthem Raaj 69 Branch/ Tag
  • 70. Subversion Control System Sriee Gowthem Raaj 70 Branching/Tagging What is a Branch? Branch is used for implementing new features or testing new feature separately from the main line of development. What is Tag? Tag is a location where stable versions of a project are present. How to Branch/Tag? There are three ways to Branch/Tag 1. Using repo-browser drag the projects from one location to branch/tag folder 2. Using revision log, select a particular revision. Right click  Context Menu  TortoiseSVN  Branch/Tag. 3. Select the root folder of your working copy. Right click to get the context menu as shown in the figure. Figure 73 Context Menu --> Branch/tag a. Select Branch/Tag opens a dialog box shown in the figure. i. To Path: Select the path where you want to branch/tag ii. Log Messages: Enter appropriate comments for branching/tagging iii. Create copy in the repository from 1. HEAD – Use the latest version in the repository 2. Revision – Specify a revision where branch/tag should take place. This option is useful when you forgot to branch/tag and committed the code to the repository 3. Working Copy – Use your working copy instead of the version present in the repository
  • 71. Subversion Control System Sriee Gowthem Raaj 71 iv. Set explicit revision for these externals: Externals are links to module present in other location. Since we are making a fresh copy from our trunk to Branch/Tag we have redirect the externals to our Branch/Tag. Usage of Externals is covered in a separate article. v. Switch working copy to new branch/tag: Note that you are creating branch/tag in the repository. Even if you choose working copy all changes will be done in the repository and not in your private machine. Selecting this option will switch your working copy to the new branch/tag after it has been created in the repository Figure 74 Branch/tag dialog box
  • 72. Subversion Control System Sriee Gowthem Raaj 72 b. After selecting the required option in Branch/tag dialog box. Press OK to create a Branch/tag in the repository. Your repository after branching/tagging is shown in the figure below Figure 75 After Branch/tag Switching As we already discussed switching is used to switch from your working copy to Branch/tag version. You can also do a fresh checkout in an empty folder but switching will only copy the files that are modified. Switching can make “Cheap copy” – you don’t need to spend additional costs (time, processor usage/memory) when you are switching.
  • 73. Subversion Control System Sriee Gowthem Raaj 73 How to Switch? Step 1. To switch select the root folder of your working copy. Right click to get the context menu as shown in the figure. Step 2. Select switch, a dialog box opens up. Figure 77 Switch dialog box (Options present in the dialog box are already discussed) Step 3. Press Ok for your working copy to switch. Figure 76 Context Menu --> Switch
  • 74. Subversion Control System Sriee Gowthem Raaj 74 Creating / Apply Patch
  • 75. Subversion Control System Sriee Gowthem Raaj 75 Creating/Apply Patch What is a patch? A patch is an individual contribution to a project. It can be a bug fix code or new functionality or changing the existing functionality. These patch files should be reviewed and approved to be entered into the source code. Let us understand patch files with a scenario. Scenario In open source projects there will be many contributing to the project. Incorporating everyone change to the main source code will make it messy. But at the same time some one’s modification can solve a particular issue. So how to solve the issue as well prevent messy source code. The answer is patch files. Top contributors to the project will be given write access. New members will be given only read access. New members can submit their code changes in a form of patch file. Seniors will go through the submitted patch file, review them, test them and then patch the file to the source code. How to create a patch? 1. Select the file/folder in your working copy you want to patch. Right click to get the context menu as shown in the figure. Figure 78 Context Menu --> Create Patch 2. Select Create Patch, dialog box opens which allows you to select files for creating patch. (The options in the dialog box are self-explanatory)
  • 76. Subversion Control System Sriee Gowthem Raaj 76 Figure 79 Create patch dialog box 3. Select OK to create the patch file. Patch file have .patch/.diff extension ( ). 4. The patch file will be in unified diff format. It contains text mentioning the changes for each line with context. The figure shows a sample patch file.
  • 77. Subversion Control System Sriee Gowthem Raaj 77 Figure 80 Patch file There is one significant feature in patch file. The very first line of the patch file has Index which specifies the location of the file. This index will be useful to find the location to correctly apply the patch. Apply Patch You can apply patch using two ways 1. Select the folder/file you want to apply patch. Right Click  Context Menu  Apply Patch  Select the patch file in Windows Explorer 2. Double click the patch file  Select the file/folder for which you want to apply patch. Figure 81 Context Menu --> Apply Patch Both the selection will open Tortoise Merge. You can see the difference between the files and merge changes to your working copy.
  • 78. Subversion Control System Sriee Gowthem Raaj 78 Figure 82 Tortoise Merge
  • 79. Subversion Control System Sriee Gowthem Raaj 79 Merging
  • 80. Subversion Control System Sriee Gowthem Raaj 80 Merging What is merging? At some point of time you need to add the features implemented in a branch with your main line of development. Merging always takes place from your working copy. You need to check out the branch in to your working copy and can then merge the changes back to the trunk. Always merge first before making any modification. If in case your merge failed because of conflicts then modified changes will be gone. Revert is the only option to undo changes which will delete all your changes. When you select a folder Right click  Context Menu  Merge will open Merge wizard with two options as shown in the figure below. Figure 83 Merge Wizard
  • 81. Subversion Control System Sriee Gowthem Raaj 81 Methods in merging 1. Merging range of revisions 2. Merging two different trees Merging range of revisions Figure 84 Merge range of revision  URL to merge from Enter the URL of branch/tag that you want to merge with your working copy  Revision range to merge o All revision ---- Takes revision from the start to HEAD revision o Specific Range You can specify the range of revisions. Example revision expression -11, 12 | 111,323 -350 | 13- 200@5.  Click Next to get Merge Option. Select options and click Merge to merge.
  • 82. Subversion Control System Sriee Gowthem Raaj 82 Figure 85 Merge --> Show Log It is a good practice to use Show Log. Show Log open revision log where you can select the files you want to merge with your working copy. If version numbers are not specified explicitly or selected all revision radio button subversion calculates the versions that are required to be merged. This feature is known as “Merge Tracking”. This process is knows reintegrate or automatic merge. It is better to use merge tracking features because you don’t need to remember the last set of revisions that you integrated. For Example if you have explicitly mentioned revision range 4556 – 4687, next merge should happen after 4687. If you use merge tracking option SVN takes care of this. Peg Revision  When a particular branch is deleted/renamed from the trunk where your branch is split, we need to use peg revision to hint SVN about the split.  Syntax for using peg revision – 20 -100 @ peg version number  For Example o Branch development started at revision - 30 o Trunks HEAD revision - 100 o Branch rename – 67 o Merge range with peg revision – 20 -100 @67
  • 83. Subversion Control System Sriee Gowthem Raaj 83 Merging two different trees Figure 86 Merge Two Different trees From field: Specify the URL of trunk To field: Specify the URL of branch where you want to merge. In both from field and to field you select HEAD revision, specific revision or use revision log to select range of revisions. Press Next to get Merge Options. Choose options and select Merge to merge.
  • 84. Subversion Control System Sriee Gowthem Raaj 84 Merge Option I am not going to cover each aspect of Merge Option. Most of the time using default settings works but if you want a deeper insight on merge option refer TortoiseSVN manual. Test Merge is a pretty useful option. Before making the official merge, one can use this option to check whether the merge will be successful or not. The figure below shows a test merge with tree conflicts. Now users can check out the reason for conflicts and correct them before performing the actual merge. Figure 87 Test Merge Note: Merging process is simple to perform but concept of merging is a little complex. There are many possibilities to merge between branches, between tags, between branch and trunk, between trunk and tag etc. It is better to understand how TortoiseSVN performs merging.
  • 85. Subversion Control System Sriee Gowthem Raaj 85 Properties
  • 86. Subversion Control System Sriee Gowthem Raaj 86 Subversion properties Subversion properties are used to perform automation of certain tasks. To assign properties to a folder, select the folder  Right Click  Context Menu  TortoiseSVN  Properties. The properties dialog box will appears as shown in the figure below. Figure 88 Property dialog box Features of SVN properties  Adding properties to a folder will be applied to all the files and subfolders as well. Adding properties to a file is applicable for that file only.  Subversion allows you to save properties so that you can export these properties to other project as well. Properties will be saved as filename.svnprops. There are options to export and import properties.  Can edit the properties using Edit option  Remove properties using remove option  Save a value for a property. This is used when you want to set a default initial size.
  • 87. Subversion Control System Sriee Gowthem Raaj 87 Figure 89 Import Property After Import Figure 90 After Import
  • 88. Subversion Control System Sriee Gowthem Raaj 88 What are the properties SVN has? Figure 91 Default properties Figure 92 New --> Other I. EOL Select the End of Line Style you need from the options shown in the figure. Figure 93 End of Line style
  • 89. Subversion Control System Sriee Gowthem Raaj 89 II. Externals This property is used to pull in other files or project in to this location. You can also set external property from Windows  Properties  Select Subversion Tab  Properties as shown in the figure below. Figure 94 Windows properties
  • 90. Subversion Control System Sriee Gowthem Raaj 90 Figure 95 svn:exteranl property window Click “New” Click “Ok” Figure 97 Setting external Figure 96 External property inserted
  • 91. Subversion Control System Sriee Gowthem Raaj 91 Projects that are added using external property will have a shortcut icon against them when viewed in Repo-browser. Figure 98 Repo-Browser with external project III. Bugtraq - Required to integrate external bug tracking software IV. Local Hooks These are scripts which will be triggered when some operation takes place. Some of hook script templates are present in “Repository/hooks/” directory. For Example: When someone has acquired a lock it will invoke post-lock file. We can program the post-lock file to send mail to other team members stating that – particular person has acquired a lock on a particular file. V. Log Size Used to set size for log messages. With this option subversion administrators can set a minimum size so that users are compelled to enter detailed log messages. It will prevent empty & inappropriate log messages.
  • 92. Subversion Control System Sriee Gowthem Raaj 92 Figure 99 Minimum log size VI. Languages Figure 100 Language option Choose the language that will be used for spell checking the log messages in commit dialog. By default the selection will be in English. Other language options can be selected depending up on your local machine settings VII. Mime type Figure 101 MIME type
  • 93. Subversion Control System Sriee Gowthem Raaj 93 Can be used to specify the input type for a file so that subversion could understand VIII. Needs-Lock Makes the file read only. Users should acquire a lock before modifying the files. Otherwise it will throw write access IX. Merge Log Template Log templates for users to enter log messages in an intended method. X. Other There are many properties that SVN allows us to have for a project. All these properties are self- explanatory. To add further clarity to the properties let’s take one scenario. Scenario: Your project has teams working on various operating systems and you are facing lot of path problems (Windows/Linux). So you need your team to specify information in the following format. 1. Which operating system they are working on 2. What was the module assigned to them 3. Log message stating the reason for modification with that file Solution Step 1. Need to specify Log minimum size property to prevent users from committing without proper reason. This can be done using tvsn:logminsize property. Step 2. Create a log template a. OS: b. Assigned Module: c. Log reason to Commit/Delete/Branch/Import/Move/Export After setting properties your properties dialog box will be like the one shown in the figure.
  • 94. Subversion Control System Sriee Gowthem Raaj 94 Figure 102 Properties Figure 103 Log Minimum size
  • 95. Subversion Control System Sriee Gowthem Raaj 95 Figure 104 Log Template
  • 96. Subversion Control System Sriee Gowthem Raaj 96 Developer Tools
  • 97. Subversion Control System Sriee Gowthem Raaj 97 SVN Tools SVN offers some niche tools to work. They are  Repo-Browser  Revision Log  Tortoise Merge  Tortoise IDiff Repo-Browser Repo-Browser is similar to windows explorer. The figure below shows a repo-browser. The operations are self-explanatory. Figure 105 Repo-Browser
  • 98. Subversion Control System Sriee Gowthem Raaj 98 Revision Log Revision Log is the most used tool in SVN. It is the tool where we can view all the change history. Revision log can be accessed from different dialog boxes. When you click “Show Log” it will invoke Revision Log dialog box. Revision log is shown in the figure below. Figure 106 Revision Log There are three sections in Revision Log that needs to be understood clearly. They are Top Pane, Middle Pane and Bottom Pane.
  • 99. Subversion Control System Sriee Gowthem Raaj 99 I. Top Pane Figure 107 Top Pane - Revision Log Revision This column lists the revision numbers for all the revision that has taken place for the file Action There are four columns associated with Revision action. Each column represents a particular action that has occurred at that particular revision. Each action is represented by an icon arranged in the following order.  Modified - Revision modified a file or directory  Added - Revision added a file or directory  Missing - Revision deleted a file or directory  Replaced - Revision replaced a file or directory Search Users can filter the log messages or search the revision log. Hovering the mouse over the search field will display tool tip as shown in the figure below. Figure 108 Revision Log Tool tip This search feature implements Sub String searches also. Sub String Meaning A B -C Searches for string having both A & B but not C A –B +C Searches for string having both A not B, or strings containing C -Case Searches for string without case but also includes strings with Special
  • 100. Subversion Control System Sriee Gowthem Raaj 100 +Special Case Cases !A B Searches for string which do not contain both A and B !-A -B Searches for string which contains A or B “A and B” Searches for string within double quotes (“”) Author Person responsible for that revision Date Time stamp Message Shows the log message associated with that revision From - To Used for filtering the revision by specifying the time period. Top pane shows only the list of revision within the time period specified in FROM date - TO date a. Context Menu in Top Pane Figure 109 Context Menu Top Pane
  • 101. Subversion Control System Sriee Gowthem Raaj 101 Compare with working copy Compares the current revision what you have selected with your working copy. It opens the default diff tool – Tortoise Merge Show changes as unified diff Compares the selected revision with your working copy and gives the output in a form of unified diff. The figure below shows unified diff format. Diff format will be in text format, it is a little bit difficult to interpret than the visual representation of Tortoise Merge Figure 110 Unified Diff Compare with previous version  SVN opens the below tool mentioning the files that are modified from the current selected version to the previous version.  Users can also click on the version numbers to select revisions that they need to compare  Users can also invert the selection.  Selecting the file will open Tortoise Merge, where it represents the difference between the files  Search option is there to filter the results.
  • 102. Subversion Control System Sriee Gowthem Raaj 102 Figure 111 Compare with previous version Browse Repository Opens repo-browser displaying the location of the selected file. Create Branch/Tag Can create a Branch/Tag from the selected version. This option works best if you forgot to Branch/tag and committed the changes. Update item to Revision Updates this particular revision to your working copy. This option works best if you have chosen Checkout depth other than “Fully Recursive”. Revert to this version Revert to an earlier version. If you have made changes in N+1 revision, you can use this option to revert back the changes to N revision. These changes will be reverted to your working copy only. It won’t affect the repository at all. Revert changes from this version Undo the changes in the current selected version. Merge Merge this particular revision to your choice
  • 103. Subversion Control System Sriee Gowthem Raaj 103 revision to
 Checkout Checkout this revision as a working copy Export Export the selected revision (without .svn folder) Edit Author Edit the author for a particular revision. Edit Log message Edit the existing log messages. This option is useful if you want to correct any log message. When you try to edit the log messages and author it will throw the following pre- revprop-change error. Figure 112 pre-revprop-change error This error occurs due to changing the revision property. By default this features can be change. In order to make changes you have to edit hook scripts present in Repository/hooks directory. To overcome this error Step 1. Go to /Repository/hooks directory. There you can see default template files with extension (.tmpl). Step 2. Rename the file as pre-revprop-change.bat Step 3. Delete all the contents present in the template file Step 4. Enter exit 0 and save the file. If you want to automate you can do it scripting. But overwriting the revision will again cause messy things. To avoid this you can automate the script such that only the administrator can edit the revisions.
  • 104. Subversion Control System Sriee Gowthem Raaj 104 The following figure shows the edited pre-revprop-change file Figure 113 pre-revprop-changed file Now you can edit the author name of a revision. Figure 114 Before Editing
  • 105. Subversion Control System Sriee Gowthem Raaj 105 Figure 115 After Editing Show revision properties Shows the properties assigned to that revision Copy to clipboard Copies the content to clipboard. You can use this content to mail to other members in the team or save it for your reference. Figure 116 Copy to clipboard Search log messages Searches the log messages II. Bottom Pane Figure 117 Bottom Pane
  • 106. Subversion Control System Sriee Gowthem Raaj 106 Bottom pane shows the path and action corresponding to each revision. Show All Shows all the log messages for all the revisions Show Range Shows only log messages for a range of revisions Next 100 Shows log messages for next 100 revisions For a large project there may be several log messages, comments etc. It may take long time to show log. At this time Show All/Show Range comes into handy. Stop on Copy/Rename Stops on branch/tag where files and folders are moved to the trunk. Include merged version If a feature were implemented in branch are successful and it is merged back to trunk. Without checking this option – It will show messages as normal commit With checking this option – It will show icon/grey text to indicate where merge has taken place. Statistics Another feature of SVN is to show statistical informatics. You can view many different kinds of graphs based on  Statistics  Commit by author  Commit by date  Percent of authorship
  • 107. Subversion Control System Sriee Gowthem Raaj 107 SVN supports the following graphical formats  The visual representation of these graphs even adds clarity to the project overall subversion log  It can be also used to determine the quality of the programmer, number of people who are actively contributing to the code base.  Context menu of Bottom pane are self-explanatory Stacked Line Graph Line Graph Stacked Bar Graph Bar Graph Pie Graph
  • 108. Subversion Control System Sriee Gowthem Raaj 108 Tortoise Merge Tortoise Merge is an inbuilt tool which comes along Tortoise SVN. It is the default application which will open when we are viewing the differences. You can also open Tortoise Merge as a separate tool. The selected file will be shown side by side with their differences highlighted. The figure below shows the merge tool. Figure 118 Tortoise Merge You will end up with Tortoise merge for the following options  Diff with previous version  Diff with working copy  Diff between files  Diff with URL
  • 109. Subversion Control System Sriee Gowthem Raaj 109 Tortoise IDiff Tortoise IDiff is the inbuilt tool of Tortoise SVN which is used to find the differences between images.  We can stack images either vertically or horizontally  Zoom in/Zoom out the images  Fit images in the space provided in the window  Overlay images one over the other  Lists the image info for both the images Figure 119 Tortoise IDiff
  • 110. Subversion Control System Sriee Gowthem Raaj 110 Blame Difference
  • 111. Subversion Control System Sriee Gowthem Raaj 111 Blame Differences What is Blame? Blame feature in SVN is used to find out who changed which content in a file. Tortoise SVN  Blame from context menu will open the Blame dialog box as shown in the figure. Figure 120 Context Menu --> Blame Figure 121 Blame Dialog Box  Blame can be applied only to a file. We can select from which revision to which revision we need to see the blame differences.  By default Tortoise Blame is used  It shows revision number/author and the line which has been modified. When we hover the mouse over to a particular revision, a small pop up window opens up displaying the log
  • 112. Subversion Control System Sriee Gowthem Raaj 112 messages entered by the author for that particular revision. This is shown in the figure below. Figure 122 Tool Tip on mouse hover  When you select a particular author, changes made by that author in that revision will be highlighted in bold colour and the modification made by the author in other revisions are shown in less highlighted colour. The selection is a sticky selection.
  • 113. Subversion Control System Sriee Gowthem Raaj 113 Figure 123 Sticky selection  There are also few Edit properties supported by SVN as shown in the figures below. Figure 124 Edit --> Go to Line
  • 114. Subversion Control System Sriee Gowthem Raaj 114 Figure 125 Edit --> Find What  Right Click on the Blame file brings up the context menu. The figure below shows the functionality of each menu item
  • 115. Subversion Control System Sriee Gowthem Raaj 115 Figure 126 Blame --> Context Menu **********************************************************************************