21
Mercurial John Paulett April 5, 2010 Modern Source Control Management

Mercurial: Modern Source Control Management

Embed Size (px)

DESCRIPTION

Discussion on Mercurial and migration from CVS.

Citation preview

Page 1: Mercurial: Modern Source Control Management

Mercurial

John Paulett

April 5, 2010

Modern Source Control Management

Page 2: Mercurial: Modern Source Control Management

Overview

CVS Issues

Modern Alternatives

Distributed Version Control

Mercurial

Next Steps

Page 3: Mercurial: Modern Source Control Management

2010.04.05 3

CVS Shortcomings

Network connectivity required

Lack of support for renaming/moving

Lack of atomic commits

Single point of failure

Expensive branch operations

Day-long merges

Page 4: Mercurial: Modern Source Control Management

2010.04.05 4

CVS Replacements

Subversion (2000) - svn● “CVS done right”

Git (2005) – git ● Created by Linus Torvalds for kernel

development

Mercurial (2005) – hg ● Created after Linux-Bitkeeper incident

Bazaar, darcs, monotone ...

Page 5: Mercurial: Modern Source Control Management

2010.04.05 5

Distributed Version Control (DVCS)

Complete, local repository

Branching & merging are trivial

Central server for sharing repositories

Page 6: Mercurial: Modern Source Control Management

2010.04.05 6

Mercurial

mercurial.selenic.com

Changesets, not files

Mozilla, OpenJDK, OpenSolaris, Python, Zen, OpenOffice, NetBeans

Page 7: Mercurial: Modern Source Control Management

2010.04.05 7

Create a new repository

$ hg init demo

$ cd demo

$ ls -a

. .. .hg

Page 8: Mercurial: Modern Source Control Management

2010.04.05 8

Add a file

$ echo "Hello world" > README

$ hg add README

$ hg status

A README

Page 9: Mercurial: Modern Source Control Management

2010.04.05 9

Commit the changeset

$ hg commit -m "Adding basic README"

$ hg log

0[tip] 9b1b9c995571 2010-01-13 12:37 -0600 jpaulett

Adding basic README

Page 10: Mercurial: Modern Source Control Management

2010.04.05 10

Push to remote repository

$ hg push ssh://[email protected]/nrg/demo/

pushing to ssh://[email protected]/nrg/demo/

searching for changes

remote: adding changesets

remote: adding manifests

remote: adding file changes

remote: added 1 changesets with 1 changes to 1 files

...

Page 11: Mercurial: Modern Source Control Management

2010.04.05 11

Clone Existing Repository

$ hg clone http://bitbucket.org/nrg/demo/

destination directory: demo

requesting all changes

adding changesets

adding manifests

adding file changes

added 1 changesets with 1 changes to 1 files

updating to branch default

1 files updated, 0 files merged, 0 files removed, 0 files unresolved

Page 12: Mercurial: Modern Source Control Management

2010.04.05 12

Get Updates

$ hg pull

pulling from https://[email protected]/nrg/demo/

searching for changes

adding changesets

adding manifests

adding file changes

added 1 changesets with 1 changes to 1 files

(run 'hg update' to get a working copy)

$ hg update

1 files updated, 0 files merged, 0 files removed, 0 files unresolved

Page 13: Mercurial: Modern Source Control Management

2010.04.05 13

Workflow

Multiple workflows are possible

“Integration Manager”

http://whygitisbetterthanx.com/#any-workflow

blessedrepository

integrationmanager

developerpublic

developerpublic

developerprivate

developerprivate

Page 14: Mercurial: Modern Source Control Management

2010.04.05 14

Workflow

mainline

cndajohn

1.4.1

1.4.2

changeset

repository

tag

Page 15: Mercurial: Modern Source Control Management

2010.04.05 15

Hosting

bitbucket.org

Self-hosted via Apache & SSH ● hg.xnat.org

Google Code / Sourceforge

Page 16: Mercurial: Modern Source Control Management

2010.04.05 16

Tools

$ hg

MercurialEclipse

TortoiseHg

CuteHg

Page 17: Mercurial: Modern Source Control Management

2010.04.05 17

Resources

mercurial.selenic.com

hgbook.red-bean.com

hginit.com

Page 18: Mercurial: Modern Source Control Management

2010.04.05 18

Resources

http://nrg.wikispaces.com/Mercurial

http://betterexplained.com/articles/intro-to-distributed-version-control-illustrated/

http://code.google.com/p/support/wiki/DVCSAnalysis

Page 19: Mercurial: Modern Source Control Management

2010.04.05 19

hg Advantages

Easy learning curve coming from CVS/SVN

Allows 3rd parties to more easily contribute

No more day long merges

Page 20: Mercurial: Modern Source Control Management

2010.04.05 20

Next Steps

Try out Mercurial:● bitbucket.org/nrg

Page 21: Mercurial: Modern Source Control Management

2010.04.05 21