43
Advanced Branching and Merging We will begin in a few moments Presenter Michael Lester Wandisco Director of Training

03.13.13 WANDisco SVN Training: Advanced Branching & Merging

Embed Size (px)

DESCRIPTION

Get more out of branching and merging in this one-hour, free online training course that will get you leveraging the full potential of Subversion's branching and merging functionality. * Definition of concurrent development * What is a branch? * What triggers a branch? * Types of merges * How to do a merge Presented by Mike Lester. Mike, a 33 year veteran of the software industry, has spent the past 26 years delivering consulting and training services for Subversion and other software configuration management systems. He has taught over 700 classes covering various aspects of implementing and using Subversion and other SCMs. Mike is currently WANdisco’s Director of Subversion Training.

Citation preview

Page 1: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

Advanced Branching and Merging

We will begin in a few moments

Presenter

Michael LesterWandisco

Director of Training

Page 2: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

Advanced Branching and Merging

Page 3: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

3

Outline

Definition of concurrent development

What is a branch What triggers a branch Not all branches require a merge

Branching Demonstration Types of Merges How to do a merge Merge info

Merging Demonstration Conclusions

Page 4: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

This training is done with the latest TortoiseSVN Version

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

Page 5: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

5

Concurrent Development

Definition When the same code/project has multiple developers working at the same time.

Page 6: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

6

Concurrent Development

Subversion tools that support concurrent development

Branching

Merging

Author identification

Hook scripts

Difference reporting

Page 7: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

7

Who changed / created / deleted what

Page 8: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

8

Who changed / created / deleted what

Author information is availablethrough svnlook command

And statistics

svnlook author -r 40 /var/svn/repos

Page 9: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

9

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.

Original line of development1st branch

2nd branch

3rd branch

Page 10: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

10

Reasons for Branching

• Releasing patches for systems already in production.

• Preparing interim releases for testing and user evaluation.

• Working on more than one major version of the same code-base.

• Major changes require independent development

Page 11: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

11

Release patches (bug-fix)

Payroll application

Trunk

Rel 1.0

Trunk

Rel 1.0

Page 12: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

12

When to branch

• Concurrent development• To isolate development

• To create tag projects• Keep track of released code

• Custom branch• Limited use• To test unapproved changes

Page 13: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

13

When NOT to branch

• Small changes

• From “TAGS” folder

Page 14: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

14

Branching from working copy

Page 15: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

15

Branching from the TAGS folder

Pros and Cons

There is a bug in Rel 1.0What do you do?

1. Create a bug fix branch1. Create a bug fix branch2. Fix the bug1. Create a bug fix branch2. Fix the bug3. Create another “release”

tags folder branchCheck out

Edit

Update

Commit

Page 16: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

16

Extending the TAGS folder

Pros and Cons

There is a bug in Rel 1.0What do you do?

Check out

Edit

Update

Commit

1. Checkout and Commit to the Rel1.0 branch

Page 17: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

17

How do you keep track of “What is the actual release”

Page 18: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

18

Identifying Branches in Subversion

Page 19: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

19

Deleting Branches

Remember:The directory (project) can always be recovered, but willnot display in the list command unless a specific revision (53) is specified.

Page 20: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

20

Merging in actionBug fix / concurrent development

Page 21: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

21

Merging in action

Now the branch changes

While the trunk changes

onetwothreefourfivesixSeveneight

onetwotwothreefourfivesixSeven7eight

onetwothreefour5sixSevenEight

Page 22: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

22

Merging in action – modification occurs

After both commits

mike-bigfix-01172011

Trunk

Page 23: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

23

Merging in action

You always start from a working

folder

mike-bigfix-01172011

Page 24: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

24

Merging in action – changes are made

onetwotwothreefour5sixSeven7eight

Page 25: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

25

Merging in action – Commit to trunk

Page 26: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

26

Merging in action – mergeinfo

The property svn:mergeinfo is added automatically

Page 27: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

27

Merging in action

The revision numbers 9 – 11 are the starting and ending changes in the branch

Page 28: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

28

Merge information

You can view the branchinformation graphically

Page 29: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

29

Merging in action – collision ahead

Now the branch changes

While the trunk changes

onetwothreefourfivesixSeveneight

onetwotwothreefourfivesixSeven7eight

onetwo22twothreefour5sixSevenEight

Page 30: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

30

Merging in action

Page 31: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

31

Merging in action

Page 32: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

32

Merging in action – Resolve the conflict

Before you can do a commit you must tell Subversion that the conflicts have been resolved

Remember – you still have to do a commit to update the repository

Page 33: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

33

Special merging situations – no change in trunk

After branch changes

bigfix-20311

Trunk

7 8

1211

9

13 14

Do I have to merge ?Check out the trunk HEAD version

Merge like normalsvn:mergeinfo /payroll/bugfix-20311:11-14

Page 34: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

34

Using the hidden menu to merge

Shift/right click

Page 35: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

35

Include merged revisions in Log Messages

Page 36: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

36

Command line mergeinfo command

C:\source\newFeature>svn mergeinfo c:\source\payroll --show-revs mergedr15r18

C:\source\newFeature>svn mergeinfo c:\source\payroll --show-revs eligibler21

This can be used to show what has been merged and what could be merged

Page 37: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

37

Cherrypicking

This refers to choosing one specific changeset from a branch and replicating it to another.

TRUNK

Custom Branch

This fixed a bug

reproducable in the trunk This added a

new feature for a unique

customer

Page 38: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

38

Cherrypicking

How does the other branch find out about the useful code?

I fixed a bug in my custom project that probably

exists in the trunk.

It was logged as bug fix 1655.

Something about “customer sort”.

Page 39: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

39

Another reason for Log Messages

How does the other branch find out about the useful code?

Page 40: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

40

Searching for log messages

Page 41: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

41

Merge from log messages

Page 42: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

42

1. Practice

2. Practice

3. Add branching and merging to “Policies & Procedures”

4. Train staff

5. Revise your policies & Procedures

Conclusions

Page 43: 03.13.13 WANDisco SVN Training: Advanced Branching & Merging

43Copyright © 2013 WANdisco.com All rights reserved.

Presenter

Michael LesterWandisco

Director of Training

April 4th

SubversionAdministration

April 18th

Introduction to SmartSVN