JavaEdge 2008: Your next version control system

Post on 17-May-2015

1.524 views 0 download

Tags:

description

The next generation of VCS has a clear target ahead of them: making branching and merging easier. Until recently, Subversion was dominating the world of Version Control Systems, but now, Distributed Version Control Systems are growing in popularity and everywhere you go you hear about Git or Mercurial, and how they make branching and merging a breeze. But the Subversion team isn't going down quietly, they have a new weapon: the 1.5 version. Learn about the next generation of Version Control Systems is planning to solve your problems.

Transcript of JavaEdge 2008: Your next version control system

1

Gilad Garon

Your next

Version Control System

December 18th 2008

Agenda

• Introduction

• Branching

• Merging

• Subversion 1.5

• Distributed Version Control

2

Introduction

• What’s every VCS user worst nightmare?

• Nope. It’s…3

Agenda

• Introduction

• Branching

• Merging

• Subversion 1.5

• Distributed Version Control

4

Development Cycle

• Our repository layout should behave like our development cycle:

• Development Phase

• Testing Phase

• Release Final Product

• Our VCS should accommodate us and not the other way, no matter what’s our development process.

5

Single Development Line

• One branch holds all phases of the develop cycle.

6

Development Line with Support Line

7

Simple Denies ability to support production code

Stops development during testing phase

Pros Con

s

Development Line with Support Line

• One branch holds our development code.

• A second branch holds our production code for continued support.

8

Development Line with Support Line

9

Simple Stops development during testing phase

Allows support of production code

Bug fixing on production branch

Pros Con

s

Three Level Build

• A classic layout for a three phase development cycle.

• Release candidates are for the testing phase and support phase.

• The production branch is sterile.

10

Development Line with Support Line

11

Robust Complex projects can collide on development line

Continue developing while testing the next version

Merging

Pros Con

s

Multiple Feature Support Build #1

• Feature branches allow for even more code separation on complex projects

12

Multiple Feature Support Build #2

13

• Release Candidates can be closed when development cycle is complete

Development Line with Support Line

14

Robust Complex Merging

Supports large project

Pros Con

s

Branching is good for you

• Branches are great for code separation.

• Branches are cheap

• Branches are easy to create

So, what’s the catch?

15

Agenda

• Introduction

• Branching

• Merging

• Subversion 1.5

• Distributed Version Control

16

Merging

Seems Familiar?

Override everythin

g!

What the?!

17

Why merges are hard?

• Requires knowledge of the code

• Resolving conflicts by hand takes time

• Large projects require some planning

• Can cause logical bugs which aren’t easily detected

18

Making merges easier

• Merge daily!

• Let the VCS do the merge for you

• Don’t merge at the last minute, allocate merging time in your time table.

• Keep tabs on your code, keep notes on your changes.

19

Merge Tracking

• Merge tracking means that the VCS remembers what was merged and when.

• No more revision calculations

• Cherry Pick your changes

• See incoming changes

• Refactor code without fear

My Hero!

20

Common Myths

• Branching is easy?

• Merges are hard?

• Daily merges helps?

• Automatic merges are dangerous?

• Merging takes days of preparation?

21

Agenda

• Introduction

• Branching

• Merging

• Subversion 1.5

• Distributed Version Control

22

What’s New?

• Merge tracking

• Sparse checkouts

• Interactive conflict resolution

• Changelist support

• Speed improvements, cancellation response improvements

• Bug Fixes

23

Merge Tracking

• Create a branch

• Work on your branch

• Update your branch with trunk’s changes

svn copy http://yourserver.com/svn/project-x/trunk http://yourserver.com/svn/project-x/branches/feature-z -m "Creating a feature branch of /project-x/trunk."

svn checkout http://yourserver.com/svn/project-x/branches/feature-z… work …svn commit - m “committing my work."

svn merge http://yourserver.com/svn/project-x/trunk --- Merging r20 through r45 into '.': U GridView.java

24

Merge Tracking

• What has been merged so far?

• Which changes are available from trunk?

svn propget svn:mergeinfo . /trunk:20-45

# or

svn mergeinfo http://yourserver.com/svn/project-x/trunk r20r21…r44r45

svn mergeinfo http://yourserver.com/svn/project-x/trunk --show-revs eligible r46r47

25

Merge Tracking

Merging back your branch:

What’s the catch?

• No support for renames \ moves

• Mergeinfo is sometimes generated when no merge was done

$ cd /workspace/project-x/trunk$ svn merge --reintegrate http://yourserver.com/svn/project-x/branches/feature-z--- Merging differences between repository URLs into '.': … changes list …# build, test, verify, ... $ svn commit -m “Merging feature-z back into trunk!"

26

More New Features

• Sparse checkouts

• Interactive conflict resolution

• Changelist support

$ svn checkout URI --depth=[empty,files,immediates,infinity]# command support - checkout, switch, update, status, info

$ svn up U project-x/trunk/GridView.javaConflict discovered in 'project-x/trunk/GridView.java'.Select: (p) postpone, (df) diff-full, (e) edit, (s) show all options:

$ svn changelist bug-fix-1 GridView.javaPath 'GridView.java' is now a member of changelist 'bug-fix-1'.$ svn status --- Changelist ‘bug-fix-1': M GridView.java

27

Upgrading to Subversion 1.5 Server

1. Backup everything

2. Install Subversion 1.5 Server

3. Upgrade existing repositories with:

4. Populate indexes (Optional):

5. Upgrade clients

6. Pray to god 28

$ svnadmin upgrade REPOS_PATH

$ svn-populate-node-origins-index REPOS-PATH

TortoiseSVN 1.5

29

• TortoiseSVN is upgraded to support Subversion 1.5

• The Merge process is simplified and merge tracking is supported

• The repository now more resembles the Windows explorer

• Changelist support is supported

• Hook Scripts and Issue Trackers are supported

TortoiseSVN 1.5 Merge

30

New Feature Compatibility Table

New Feature Minimum

Client

Minimum Server

Minimum Repositor

y

Merge tracking 1.5 1.5 1.5

Sparse checkouts 1.5 any any

Interactive conflict resolution 1.5 any any

Changelist support 1.5 any any

Relative URLs, peg revisions in svn:externals 1.5 any any

Improvements to copy and move 1.5 any*, 1.5 any

Speed improvements, cancellation response improvements 1.5 any any

31

Agenda

• Introduction

• Branching

• Merging

• Subversion 1.5

• Distributed Version Control

32

What is DVCS?

• Distributed VCS does NOT mean the physical distribution of the repository over several machines.

• Distributed VCS means the repository is located on your machine.

33

Terminology

In DVCS we…

• Do not check out from the repository, we clone the repository.

• Do not update our working copy, we pull changes from other repositories.

• Do not check in our changes,we push changes to other repositories.

34

Advantages

You are the repository

• Performance, no network overhead.

• Work offline, work where ever you want.

• Experiment, no commit rights required.

• Local Commits, the repository is in your workspace.

• Flexible repository topology

35

Disadvantages

But…

• Sparse checkouts are not fully supported if at all.

• Most vendors do not support branching, you must clone.

• Merge Tracking needs to mature a bit.

• More suited to Open Source projects than commercial.

36

Centralized Workflow

37

Decentralized Workflow

38

Decentralized with shared mainlineWorkflow

39

Decentralized with GatekeeperWorkflow

40

Git

• Project started on April 2005

• Invented by Linus Torvalds to replace BitKeeper

• Toolkit design

• Used in - Linux Kernel, VLC, Ruby On Rails, Fedora, Android

• IDE Support - Eclipse, NetBeansIntelliJ (Native)

Subversion is the devil,

use Git.

41

Git Shell

42

Gitk

43

Git Pros & Cons

44

Fast Limited Windows Support

Gitk Over 150 Commands

Supports Branching The repository requires periodic optimization with git-gc

Pros Con

s

Bazaar

• Project started on March 2005

• Started as a branch of Arch

• Sponsored by Canonical (Ubuntu)

• Used in - Ubuntu, MySQL, Drupal, APT, Linux Foundation

• IDE Support - Eclipse, IntelliJ (Native)

45

Tortoise Bazaar

46

Bazaar Pros & Cons

47

Good support for workflows

Slower than Git and Mercurial

Good plug-ins Smallest user base

Version directories No NetBeans support

Shared Repositories

Pros Con

s

Mercurial

• Project started on April 2005

• Very Similar to Subversion

• Adopted by Sun Microsystems

• Used in - Mozilla, NetBeans, OpenJDK, OpenSolaris

• IDE Support - Eclipse, NetBeans,IntelliJ

48

Mercurial Serve

49

Tortoise Mercurial

50

Mercurial Pros & Cons

51

Very similar to Subversion

Slower than Git

TortoiseHG Does not version directories

Simple No local branches, must clone

HG Serve

Pros Con

s

Comparison

Rename Support Poor Yes Yes Yes

Merge Tracking Needs work Yes Yes Yes

Version Directories

Yes No No Yes

Partial Checkout Yes No No No

IDE Plugins IntelliJ, Eclipse, NetBeans

IntelliJ, Eclipse, NetBeans

IntelliJ, Eclipse, NetBeans

IntelliJ, Eclipse

Platforms Cross Platform Poor Windows Support

Cross Platform Cross Platform

UI Windows TortoiseSVN, VisualSVN

MIA TortoiseHG TortoiseBzr

UI Linux RapidSVN, KdeSVN, eSVN

gitk, git-gui TortoiseHG bzr-gtk, BzrLog

Documentation Good Good Good Good

52

Conclusion

And the Winner is?

• Experiment with the tools

• Choose the tool which works with your workflow

53

References

• Subversion

• Home Page: http://subversion.tigris.org/

• Tortoise: http://tortoisesvn.tigris.org/

• SVNKit: http://svnkit.com/

• Eclipse Plug-in: http://subclipse.tigris.org/

• NetBeans Plug-in: http://subversion.netbeans.org/

• Git

• Home Page: http://git.or.cz/

• msysgit (Git Windows) : http://code.google.com/p/msysgit/

• Eclipse Plug-in: http://git.or.cz/gitwiki/EclipsePlugin

• NetBeans Plug-in: http://code.google.com/p/nbgit/54

References

• Mercurial

• Home Page: http://www.selenic.com/mercurial/wiki/

• TortoiseHG: http://www.selenic.com/mercurial/wiki/index.cgi/TortoiseHg

• Eclipse Plug-in: http://www.vectrace.com/mercurialeclipse

• Bazaar

• Home Page: http://bazaar-vcs.org/

• IDE Plug-ins: http://bazaar-vcs.org/IDEIntegration

55

Thank You !

56