WANdisco Free Subversion Training
Webinar: Getting Started With Subversion
Date: January 24 2013
Going back to basics! This course is intended as a primer for new users or people who are thinking of making the jump to Subversion. This will be a short introduction to the way Subversion works.
All the topics that a new user needs to be exposed to. Topics covered:
- Repository basics, creating and organizing
- Checkouts, working folders, editing files and checkins
- Reporting on changes
- Simple branching
- Simple merging
4. This training is done with the latest
TortoiseSVN Version
http://www.wandisco.com/subversion/download
5. Subversion Components
Working
Copy
SVN.EXE
Repository
Working
Copy
TortoiseSVN
Working Copy
Repository
A private central location of all versions of a project’s files.
The work area created by checking out from Subversion
5
7. Subversion Repositories
Repositories
• Can have a single or multiple repositories
• Can be on a server or local
• Can have access security
7
8. Subversion Projects
Projects
• Relates to a top level folder/directory
• Should have meaningful names
• Created (in repository) by the “IMPORT” or
“COPY” command
8
9. Subversion Directories
Folders
• How projects are organized, just like folders
• Organized hierarchically
• Created automatically via the
“IMPORT” command or
“CREATE FOLDER” command
9
10. Subversion Files
Files
• The end point
• All files must be in some directory
• Can exist in the repository and any
number of working copies
10
11. Repository Layout
Many options
Main goal – minimize errors
Other goals
Reusability
Ease of use
Should be part of “Policies and Procedures”
Standardization easier on Admin tasks
Too many objects per level can be confusing
11
12. Repository Layout - the TTB Layout
/ --- root
mail
trunk
tags
trunk – Main line development
branches
calculator tags – Snapshots in time
trunk branches – Special / temporary
tags projects
branches
spreadsheet
trunk
tags
branches
12
17. Working Copy
Working
Copy
Working
Copy
This is created and maintained by Subversion.
.svn folder - Means this is a working copy folder
You should never need to access this area,
but you should NEVER delete it either.
17
19. Check Out
This step gets the latest repository
Check
out version of a project, directory or file
and copies it to a location where it
Commit Edit
can be edited.
Update
19
20. Check Out
Check
out
Commit Edit
Update
Two main parameters
Where
Where to
from
Current Relative Qualified
Repository
Directory Directory Directory
20
21. Check Out
Check
out
Commit Edit
Update Two decisions to make
Where
from Where to
Create a
Current
New
Directory
Directory
21
22. Creating a Working Copy
The checkout
command creates a
working copy folder.
22
23. Results of Checkout
Common Errors
• Picking a level too high
• Selecting an existing
working directory
• Checking out before
doing a commit
• Picking wrong
Repository or project
23
24. Indicates a fresh checked-out working copy of this
file
Indicates a file has been modified since it was
checked-out, and therefore needs commiting
Indicates a conflict while updating files
Indicates a svn:needs-lock property on the file.
I.e. it is read-only. Same symbol
(You need to get a lock before you can edit this
file) for folder or file
Indicates a locked, but normal file. This symbol
reminds you that you should unlock it for others to
access it
Indicates that some files/folders inside a folder
are scheduled for deletion, or a file under version
control is missing in a folder
Indicates that a file or folder is scheduled to be
added to version control
24
25. Scenario
• project1 checked out to c:sourceproject1_mike
• project1 checked out to c:sourceproject1_sue
• project1_mike jobs.txt changed
• days.txt added
• props.txt deleted
• project1_mike committed
Are there
any
changes?
25
26. Remember, to compare this project with the
repository you need to select this option.
26
27. Check
out
Downloads all changes that
Commit Edit
have been made to files in the
Subversion repository to your
Update local copy.
update Local
Repository (working) copy
27
33. Add a Work File
Adding a file to a working directory does NOT
add it to version control.
You need to use the SVN add command to let
Subversion know it is part of version control.
Before svn ADD
After svn ADD
33
34. Delete Work File
Deleting a file in a working directory does NOT
remove it from version control and the repository.
You need to use the svn DELETE command to let
Subversion know it is no longer part of version control.
34
35. Delete File from Repository
Deleting a file from the
repository does not
remove it from the
working directory.
It does remove it from
version control.
35
36. Commit
Check
out
Committing is where you store a set
Commit Edit
of changes into the repository.
Update
Local
(working) copy
commit Repository
36
37. Commit
When you commit multiple
files they all are tagged by
the newly created version
number.
Both files are
marked at
revision 19 .
37
38. Revisions
Repository
The repository
Projects and everything
in it go through
revisions
Directories
1,2,3,4,….
Files
38
39. Atomic Revisions
All changes, adds,
modifications, and
deletions, are part
of the same
revision (10).
39
40. Atomic Revisions
Selecting the
revision will show
all changes
incorporated by
that revision.
40
41. Branching, Merging and Conflicts
• Branches
– What are they
– Why we need them
• Merging
– When to merge
– When we never merge
– How to merge
• Conflicts
– Detecting conflicts
– Resolving conflicts
41
42. What is a Branch
The basic concept of a branch:
A line of development that exists
independently of another line
A branch always begins life as a copy of something,
and moves on from there, generating its own history.
3rd branch
1st branch
Original line of development
2nd branch
42
43. Why we Need Branches
Branches are needed so that
separate development efforts can
take place at the same time.
Without branching we could
never merge.
Branches make the development
process easier and more
understandable.
43
44. Creating Branches in Subversion
Starting repository
database
trunk
branches
Let’s assume that Tom
wants to start working on
the next release
44
45. Creating Branches in Subversion
Repository after the copy command
Payroll
Tom can now check out the
project starting at “tomNext”
trunk and know that any changes he
makes will not effect anyone
working on the “trunk” project”
branches
tomNext
45
46. Merging in Subversion
Definition:
Applying the differences between two sources to a
working copy path.
Example:
svn merge file:///c:/svnrepos/projectOne -r346:348 foo.c
46
47. Merging Example
Step 1. A development project is
underway. A single file is
1 2 3 represented. This file shows the
list of offices in the company.
offices.txt
Since the beginning of this
project we have made two
changes.
47
48. Merging Example
3 4 5
Step 1.
Note: Revision 1 & 2 Created the trunk and branch folders
48
49. Merging Example
Step 2. Create a new directory / branch
named “Rel1.0”. Add this to the
Rel 1.0 repository folder “Branch”
After this, both the trunk and the
new branch are changed
TRUNK independently.
For illustration, lets pretend that
In the trunk a new office is
added and in Rel1.0 a
misspelling is corrected.
49
51. Merging Example
Step 3.
Rel 1.0 A change is made to the latest
version in the trunk directory.
A new office location is added.
TRUNK
51
52. Merging Example
The person responsible for
Step 4. “Rel 1.0” tells the person
responsible for the “TRUNK”
Rel 1.0
that they fixed a line of the
file that should be
propagated (MERGED) into
the “TRUNK” .
TRUNK
Actually the merge happens
into the workfile, then the
workfile is committed back
into the repository.
52
53. Merge Clarification
Step 4.
Rel 1.0 The merge DOESN’T EVER
Merge
create a new version. A merge
ALWAYS modifies a workfile.
The workfile can then be
TRUNK Workfile
committed to the repository,
which creates a new version.
We just show The workfile created by the
it like this for merge may be edited before the
simplification commit.
53
55. Conclusions
1. Practice on a temporary repository
2. Implement Subversion on real
projects.
3. Get additional info, training,
reading etc.
4. Create “Policies & Procedures”
5. Modify “Policies & Procedures” as
you get more experienced.
55
57. What’s Next…
Our Support Engineers are the Sherpas SmartSVN is the world’s most popular
of Source Control Management. SVN client for Linux, Mac and
Windows.
WANdisco support contracts include:
SmartSVN Professional includes:
• Subversion Access Control
• Out of the box features
• Core SVN Developers & Git experts
• A permanent license Key
on staff
• One year of free updates
• Guaranteed response times
• One year of free email support
• Indemnification coverage
www.smartsvn.com/buy
www.go/wandisco.com/getting-
started-support-offer
57