wandisco free subversion training: getting started with svn

57
Getting Started with Subversion Presenter Michael Lester Wandisco Director of Training

Upload: wandisco-plc

Post on 07-Nov-2014

1.776 views

Category:

Documents


0 download

DESCRIPTION

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

TRANSCRIPT

Page 1: WANdisco Free Subversion Training:  Getting Started with SVN

Getting Started with Subversion

Presenter

Michael LesterWandisco

Director of Training

Page 2: WANdisco Free Subversion Training:  Getting Started with SVN

Getting Started with Subversion

Page 3: WANdisco Free Subversion Training:  Getting Started with SVN

3

Outline

Subversion Components Projects Layout Usual work cycle

Setup, checkout, commit demonstration

Branching Merging

Branching and merging demonstration

Page 4: WANdisco Free Subversion Training:  Getting Started with SVN

This training is done with the latest TortoiseSVN Version

http://www.wandisco.com/subversion/download

Page 5: WANdisco Free Subversion Training:  Getting Started with SVN

5

Repository SVN.EXE

WorkingCopy

WorkingCopy

TortoiseSVN

The central location of all versions of a project’s files.

Subversion Components

RepositoryA private work area created by checking out from Subversion

Working Copy

WorkingCopy

WorkingCopy

Repository

Page 6: WANdisco Free Subversion Training:  Getting Started with SVN

6

Subversion Organization

Repositories Projects

Folders

(subFolders)Files

Page 7: WANdisco Free Subversion Training:  Getting Started with SVN

7

Subversion Repositories

Repositories

• Can have a single or multiple repositories

• Can be on a server or local

• Can have access security

Page 8: WANdisco Free Subversion Training:  Getting Started with SVN

8

Subversion Projects

• Relates to a top level folder/directory

• Should have meaningful names

• Created (in repository) by the “IMPORT” or “COPY” command

Projects

Page 9: WANdisco Free Subversion Training:  Getting Started with SVN

9

Subversion Directories

• How projects are organized, just like folders

• Organized hierarchically• Created automatically via the

“IMPORT” command or “CREATE FOLDER” command

Folders

Page 10: WANdisco Free Subversion Training:  Getting Started with SVN

10

Subversion Files

• The end point

• All files must be in some directory

• Can exist in the repository and any number of working copies

Files

Page 11: WANdisco Free Subversion Training:  Getting Started with SVN

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

Page 12: WANdisco Free Subversion Training:  Getting Started with SVN

12

Repository Layout - the TTB Layout

/ --- root mail trunk tags branches calculator trunk tags branches spreadsheet trunk tags branches

trunk – Main line development

tags – Snapshots in time

branches – Special / temporary projects

Page 13: WANdisco Free Subversion Training:  Getting Started with SVN

13

Repository Layout - Project Layout Example

calculator trunk tags rel 1.0 rel 1.1 rel 2.0

branches mike test_new_DB_access bugfix_rel 1.1 rel 2.1 cust_page_change QA rel 2.0 05_23_2010 rel 2.0 06_13_2010

Page 14: WANdisco Free Subversion Training:  Getting Started with SVN

14

Populating the Repository

This may be done by the users or admin

Two methods

IMPORT command

CREATE FOLDER (MKDIR) command

Repository

Page 15: WANdisco Free Subversion Training:  Getting Started with SVN

15

IMPORT Command

May require a log message

Page 16: WANdisco Free Subversion Training:  Getting Started with SVN

16

Create Folder (MKDIR) Command

May require a log message

Page 17: WANdisco Free Subversion Training:  Getting Started with SVN

17

WorkingCopy

WorkingCopy

Working Copy

.svn folder - Means this is a working copy folderThis is created and maintained by Subversion. You should never need to access this area, but you should NEVER delete it either.

Page 18: WANdisco Free Subversion Training:  Getting Started with SVN

The Usual Work Cycle

Check out

Edit

Update

Commit

18

Page 19: WANdisco Free Subversion Training:  Getting Started with SVN

Check Out

Check out

Edit

Update

Commit

This step gets the latest repository version of a project, directory or file and copies it to a location where it can be edited.

19

Page 20: WANdisco Free Subversion Training:  Getting Started with SVN

Check Out

Check out

Edit

Update

Commit

Two main parameters

Where from

Repository

Where to

CurrentDirectory

Relative Directory

QualifiedDirectory

20

Page 21: WANdisco Free Subversion Training:  Getting Started with SVN

Check Out

Check out

Edit

Update

Commit

Two decisions to make

Where from Where to

CurrentDirectory

Create a New

Directory

21

Page 22: WANdisco Free Subversion Training:  Getting Started with SVN

22

Creating a Working Copy

The checkout command creates a working copy folder.

Page 23: WANdisco Free Subversion Training:  Getting Started with SVN

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

Page 24: WANdisco Free Subversion Training:  Getting Started with SVN

Icon Overlays

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.(You need to get a lock before you can edit this 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

Same symbol for folder or file

Page 25: WANdisco Free Subversion Training:  Getting Started with SVN

Status - Check for Changes

Scenario•project1 checked out to c:\source\project1_mike•project1 checked out to c:\source\project1_sue•project1_mike jobs.txt changed•days.txt added•props.txt deleted•project1_mike committed

Are there any

changes?

25

Page 26: WANdisco Free Subversion Training:  Getting Started with SVN

Status - Check for Changes

Remember, to compare this project with the repository you need to select this option.

26

Page 27: WANdisco Free Subversion Training:  Getting Started with SVN

Update

Check out

Edit

Update

CommitDownloads all changes that have been made to files in the Subversion repository to your local copy.

Repositoryupdate Local

(working) copy

27

Page 28: WANdisco Free Subversion Training:  Getting Started with SVN

Possible Update Effects

Check out

Edit

Update

Commit

28

No conflicts

Page 29: WANdisco Free Subversion Training:  Getting Started with SVN

Possible Update Effects

Check out

Edit

Update

Commit

29

Conflicts

Page 30: WANdisco Free Subversion Training:  Getting Started with SVN

Possible Update Effects

30

Page 31: WANdisco Free Subversion Training:  Getting Started with SVN

Possible Update Effects

31

Comparing two versions

Page 32: WANdisco Free Subversion Training:  Getting Started with SVN

Diff doesn’t work on binary files

32

Page 33: WANdisco Free Subversion Training:  Getting Started with SVN

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.

After svn ADD

Before svn ADD

33

Page 34: WANdisco Free Subversion Training:  Getting Started with SVN

Delete Work File

Deleting a file in a working directory does NOTremove 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

Page 35: WANdisco Free Subversion Training:  Getting Started with SVN

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

Page 36: WANdisco Free Subversion Training:  Getting Started with SVN

Commit

Check out

Edit

Update

Commit

Committing is where you store a set of changes into the repository.

RepositorycommitLocal (working) copy

36

Page 37: WANdisco Free Subversion Training:  Getting Started with SVN

Commit

When you commit multiple files they all are tagged by the newly created version number.

Both files are marked at revision 19 .

37

Page 38: WANdisco Free Subversion Training:  Getting Started with SVN

38

Repository

Revisions

Projects

Directories

Files

The repository and everything in it go through revisions

1,2,3,4,….

Page 39: WANdisco Free Subversion Training:  Getting Started with SVN

39

Atomic Revisions

All changes, adds, modifications, and deletions, are part of the same revision (10).

Page 40: WANdisco Free Subversion Training:  Getting Started with SVN

40

Atomic Revisions

Selecting the revision will show all changes incorporated by that revision.

Page 41: WANdisco Free Subversion Training:  Getting Started with SVN

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

Page 42: WANdisco Free Subversion Training:  Getting Started with SVN

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.

2nd branch

Original line of development

3rd branch

1st branch

Page 43: WANdisco Free Subversion Training:  Getting Started with SVN

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.

Page 44: WANdisco Free Subversion Training:  Getting Started with SVN

44

Creating Branches in Subversion

database

trunk

branches

Starting repository

Let’s assume that Tom wants to start working on the next release

Page 45: WANdisco Free Subversion Training:  Getting Started with SVN

45

Creating Branches in Subversion

Payroll

trunk

branches

Repository after the copy command

Tom can now check out the project starting at “tomNext” and know that any changes he makes will not effect anyone working on the “trunk” project”

tomNext

Page 46: WANdisco Free Subversion Training:  Getting Started with SVN

46

Merging in Subversion

Definition:Applying the differences between two sources to aworking copy path.

Example: svn merge file:///c:/svnrepos/projectOne -r346:348 foo.c

Page 47: WANdisco Free Subversion Training:  Getting Started with SVN

47

Merging Example

1 2 3

A development project is underway. A single file is represented. This file shows the list of offices in the company.

Since the beginning of this project we have made two changes.

Step 1.

offices.txt

Page 48: WANdisco Free Subversion Training:  Getting Started with SVN

48

Merging Example

Step 1. 3 4 5

Note: Revision 1 & 2 Created the trunk and branch folders

Page 49: WANdisco Free Subversion Training:  Getting Started with SVN

49

Rel 1.0

Step 2.

Merging Example

Create a new directory / branch named “Rel1.0”. Add this to the repository folder “Branch” After this, both the trunk and the new branch are changed independently.

For illustration, lets pretend thatIn the trunk a new office is added and in Rel1.0 a misspelling is corrected.

TRUNK

Page 50: WANdisco Free Subversion Training:  Getting Started with SVN

50

Merging Example

Step 2.

54TRUNK

Rel 1.0

Page 51: WANdisco Free Subversion Training:  Getting Started with SVN

51

Merging Example

A change is made to the latest version in the trunk directory.

A new office location is added.

Step 3.

TRUNK

Rel 1.0

Page 52: WANdisco Free Subversion Training:  Getting Started with SVN

52

Merging Example

The person responsible for “Rel 1.0” tells the person responsible for the “TRUNK” that they fixed a line of the file that should be propagated (MERGED) into the “TRUNK” .

Actually the merge happens into the workfile, then the workfile is committed back into the repository.

Step 4.

TRUNK

Rel 1.0

Page 53: WANdisco Free Subversion Training:  Getting Started with SVN

53

Merge Clarification

The merge DOESN’T EVER create a new version. A merge ALWAYS modifies a workfile.

The workfile can then be committed to the repository, which creates a new version.

The workfile created by the merge may be edited before the commit.

Step 4.

TRUNK

Rel 1.0

Workfile

Merge

We just show it like this for simplification

Page 54: WANdisco Free Subversion Training:  Getting Started with SVN

54

Merging Example

54

TRUNK

Rel 1.0

Step 4.

Page 55: WANdisco Free Subversion Training:  Getting Started with SVN

55

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.

Conclusions

Page 56: WANdisco Free Subversion Training:  Getting Started with SVN

56Copyright © 2011 WANdisco All rights reserved.

Presenter

Michael LesterWandisco

Director of Training

Feb 14thBranching Options for

Development

February 28th

Getting Info Out of

Subversion

Page 57: WANdisco Free Subversion Training:  Getting Started with SVN

What’s Next…

57

Save 30% on Enterprise SVN & Git Support

Our Support Engineers are the Sherpas of Source Control Management.

WANdisco support contracts include:

• Subversion Access Control

• Core SVN Developers & Git experts on

staff

• Guaranteed response times

• Indemnification coverage

Save 10% on SmartSVN Professional

SmartSVN is the world’s most popular SVN client for Linux, Mac and Windows.

SmartSVN Professional includes:

• Out of the box features

• A permanent license Key

• One year of free updates

• One year of free email support

www.smartsvn.com/buy

Use Discount Code: “SmartUpgrade10”

www.go/wandisco.com/getting-started-support-offer