SlideShare una empresa de Scribd logo
1 de 74
Mercurial
Distributed Source Control
Presented by David Stockton for
Front Range PHP User Group
April 28, 2010
“If debugging is the process
of removing bugs, then
programming must be the
process of putting them in.”
	 	 	 - Anonymous
Source Control in a Nutshell
 A great way to avoid catastrophic mistakes with your
 code
 Essential - If your code is more than a few lines long
 and you’re not using source control, you must not think
 very highly of your work.
 If you’re not using source control, start now. Even CVS
 is better than no source control. (Not sure about VSS
 though)
Source Control in a Nutshell
 If you are working with a team (read, one or more other
 people) source control is essential
 If you’re working by yourself and you’ve ever made a
 mistake, source control is essential
 If you ever wished you could undo something you just
 did, source control is essential
 If you need to maintain different versions of the same
 code, source control is essential.
I could go on, but...
I could go on, but...


 The bottom line is...
I could go on, but...


 The bottom line is...

 Source control is absolutely
 essential!
Questions?



Questions about source control in general?
Goals of Source Control

Keep your source code safe
Allow you to look at different versions of your code
Allow multiple developers to work simultaneously
Allow multiple “branches” of code to be worked on at
the same time
Common/Popular Source
Control Tools
CVS
SVN (Subversion)
ClearCase
Perforce
Microsoft Visual SourceSafe
Git
Mercurial
Common/Popular Source
Control Tools
BitKeeper
Telelogic Synergy
Visual Studio Team System
StarTeam
RCS
Tons of others...
Types of Source Control


Client Server Model (CVS, SVN, etc)
Distributed (Git, Mercurial)
Mercurial


 Distributed Version Control System
 Works the way you want it instead of forcing you to use
 it in a certain way
 Used by lots of big projects
Who uses Mercurial?
Adium
Audacious
BitBucket
Growl
Linux HA
LinuxTV
Who uses Mercurial?
Mozilla
Netbeans
Mutt
OpenOffice
OpenJDK
OpenSolaris
How does it work?


Probably not the way you’d think if you’ve used CVS or
SVN or other client server VCS
(Version Control System)
How it’s different
 No central server
   ... or at least not one that’s required
 Works on changesets, not file or repository versions
 Changesets allow merges (shudder) to be simple
   This is a good thing since you’ll be merging a lot
   Learn to not be afraid of the merge
What else?

Doing a checkout gives you a full copy of the repository
  Including all changes, etc
Lose a server?
  Just clone another copy of the repository
What can you do with it?

Pretty much anything
Clone a repository to try out some experimental code
  If it works, keep it
  If not, delete it, no harm done
    And no evidence of your failed attempt
What can you do with it?

Work on a plane (and still check in code)
Collaborate with a colleague in a coffee shop
Pick and choose what you want in your repository
Push, pull and clone from other repositories
Make your VCS work how
you do!
Work on the road
Work from home
Work from work
Work from a plane
Work from a train
Work in an automobile (if you’re not driving)
#1 Awesome Thing


Branches are easy
... But they’re pretty easy in CVS and SVN too
Branches
If you’re working on Feature A and I am working on
Feature B, we’ve essentially branched
Two or more people working on code based on the
same thing creates branches
Named branches
Unnamed branches
Branches by cloning
#2 Awesome Thing

Branches being easy is great, but only if...
Merges are super easy!
Most merges handled automatically
Merge conflicts can be handled by a tool of your choice
  I like kdiff3
#3 Awesome Thing


No network? No problem
Work from anywhere
Collaborate with a colleague in the middle of nowhere
Installation
 Mercurial is cross platform with excellent support on
 Windows, Linux and Mac
 http://mercurial.selenic.com/
 Download binary for Windows or Mac
 ... or
   apt-get install mercurial
   yum install mercurial
   ermerge mercurial
   pkg install SUNWmercurial
Create a new Repository
What’d that do?
You now have a working
repository
If you don’t do command line there are other ways
IDE Integration - Eclipse, NetBeans, IntelliJ, Emacs,
Vim, TextMate, Visual Studio
Windows integration with TortoiseHg
Build/Management tools with Hg support:
CruiseControl, JIRA, Trac, Maven, Redmine, Hudson,
ant, etc
Add some code

Use ‘hg add’ to tell Mercurial about the files you want it
to track
Use ‘hg commit’ to tell Mercurial to check in code
  hg ci
  hg com
Adding and Committing
Look at the repository
Look at the repository
Make some more changes
Easy peasy...
Enter developer #2
Developer 2 Commits
What does that commit look
like?
Pretty much the same
Why?
Luke Skywalker
has his own
repository
How can I get Luke’s
Change?
Use ‘hg push’ from Luke’s instance
Use ‘hg pull’ on my instance to Luke’s instance
What’d that do?
What does it do to me?
Where are the changes?
Pushes do not
affect the working
copy
Why?
Updating the workspace could make me lose my work
How to see those changes?


Use ‘hg up’
Update your own
workspace
Let’s mix it up


 Dave makes a change to cookie to specify flour
 amount
 Luke makes a change to cookie to add eggs
A matter of timing...
Dave commits changes
Luke commits changes
But then...



 Don’t use -f to force... Don’t do it...
Let’s merge
Quick recap

First check-in goes in
Second check-in based on same code needs merge
‘hg pull’ + ‘hg merge’ took a fraction of a second
Merge was correct
Luke now needs to commit the merge and push back
to Dave’s server
Merge Check-in
And it now looks like...
Still too easy...

 Let’s try a merge conflict...
 Dave needs more flour in the recipe
   Also, Dave hasn’t updated his workspace with the
   merge results
 Luke wants to use cake flour
Merge conflict in the making
Now the fun part
Luke uses the force and does a check in and push
before Dave does a check-in
Here comes trouble...
 Dave tries to commit




 ... And it works ...
But... it created a new head
To get Luke’s changes...
Merge 2 heads into 1
All that junk is kdiff3 launching. I should fix that...
Merge in kdiff3
 Notice that the eggs part was automatically resolved
Merge completed
Commit the merge
What’d that do?
Crazy branch/merges

The example to the right was done with
just 5 users but I was purposely trying
to make lots of weird branch merge
situations occur.
Command overview
hg clone - clone a repository
hg merge - merge changes together
hg add - tell Mercurial to start caring about some files
hg commit - commit a new changeset
hg push - send your changesets to another server
hg pull - retrieve changesets from another server
Command overview cont...
hg update - Update your local workspace with the stuff
from hg pull
hg annotate - show which changeset is responsible for
each line in a file
hg diff - show the differences between files in your
workspace and the committed file
hg export - dump the header and diffs for one or more
changesets
Command overview cont...

hg forget - Forget the specified files (remove from
repository, not from workspace) when you commit
hg log - show revision history
hg remove - delete file and remove from repository
when you commit
hg serve - simple http server to show the repository
(useful for coffee shop working)
hg addremove - add all new files, remove deleted files

hg backout - reverse effect of earlier changeset

hg bisect - search changesets (DEMO)

hg branch - set or show branch names

hg branches - list all branches

hg copy - mark file as copied for next commit (DEMO)

hg heads - show repository or branch heads
hg help - Where I’m getting this list of commands

hg identify - identify the working copy

hg incoming - show new changesets in source

hg init - create a new repository

hg outgoing - show changesets not in destination

hg parents - show parents of working directory or
revision
Command overview cont...
hg status - Show what’s going to happen when you
commit
hg summary - Summarize state of working directory

hg paths - show aliases for remote repositories

hg rename - rename a file (same as hg copy + hg
remove) (DEMO)

hg tag - tag a revision

hg tags - show tags in repository
Holy crap...


 That wasn’t even all the commands
 Or all the coolness
As time permits...

 hg bisect demo
 hg copy demo
 hg rename demo
 hg mq - Patching, orthogonal mutable changesets
Other sweet awesomeness


Hooks
Attic
ACL
Excellent Resources

Quick and easy overview:
http://hginit.com - Joel Spolsky’s explanation of
Mercurial
Mercurial: The Definitive Guide
Available online at http://hgbook.red-bean.com/read/
Or buy from Amazon.com or O’Reilly Media
Questions?

Más contenido relacionado

La actualidad más candente

DevOps Workflow and Build Pipeline
DevOps Workflow and Build PipelineDevOps Workflow and Build Pipeline
DevOps Workflow and Build PipelineLeroy Dunn
 
2021 ZAP Automation in CI/CD
2021 ZAP Automation in CI/CD2021 ZAP Automation in CI/CD
2021 ZAP Automation in CI/CDSimon Bennetts
 
Git이란 (Git 소개 및 기초 이론)
Git이란 (Git 소개 및 기초 이론)Git이란 (Git 소개 및 기초 이론)
Git이란 (Git 소개 및 기초 이론)승용 윤
 
DEVSECOPS: Coding DevSecOps journey
DEVSECOPS: Coding DevSecOps journeyDEVSECOPS: Coding DevSecOps journey
DEVSECOPS: Coding DevSecOps journeyJason Suttie
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsLee Hanxue
 
Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6Ido Flatow
 
When To Use Ruby On Rails
When To Use Ruby On RailsWhen To Use Ruby On Rails
When To Use Ruby On Railsdosire
 
Introduction To DevOps | Devops Tutorial For Beginners | DevOps Training For ...
Introduction To DevOps | Devops Tutorial For Beginners | DevOps Training For ...Introduction To DevOps | Devops Tutorial For Beginners | DevOps Training For ...
Introduction To DevOps | Devops Tutorial For Beginners | DevOps Training For ...Simplilearn
 
오픈소스 개발을 위한 Git 사용법 실습
오픈소스 개발을 위한 Git 사용법 실습오픈소스 개발을 위한 Git 사용법 실습
오픈소스 개발을 위한 Git 사용법 실습BJ Jang
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS Ganesh Kondal
 
git, 이해부터 활용까지
git, 이해부터 활용까지git, 이해부터 활용까지
git, 이해부터 활용까지jylee1229
 
Here Be Dragons: The Unexplored Land of Active Directory ACLs
Here Be Dragons: The Unexplored Land of Active Directory ACLsHere Be Dragons: The Unexplored Land of Active Directory ACLs
Here Be Dragons: The Unexplored Land of Active Directory ACLsAndy Robbins
 
Travailler avec git et eclipse
Travailler avec git et eclipseTravailler avec git et eclipse
Travailler avec git et eclipseFrancois ANDRE
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOpsAhmed Adel
 
DevSecOps reference architectures 2018
DevSecOps reference architectures 2018DevSecOps reference architectures 2018
DevSecOps reference architectures 2018Sonatype
 

La actualidad más candente (20)

DevOps Workflow and Build Pipeline
DevOps Workflow and Build PipelineDevOps Workflow and Build Pipeline
DevOps Workflow and Build Pipeline
 
2021 ZAP Automation in CI/CD
2021 ZAP Automation in CI/CD2021 ZAP Automation in CI/CD
2021 ZAP Automation in CI/CD
 
Sql Injection 0wning Enterprise
Sql Injection 0wning EnterpriseSql Injection 0wning Enterprise
Sql Injection 0wning Enterprise
 
Git이란 (Git 소개 및 기초 이론)
Git이란 (Git 소개 및 기초 이론)Git이란 (Git 소개 및 기초 이론)
Git이란 (Git 소개 및 기초 이론)
 
DEVSECOPS: Coding DevSecOps journey
DEVSECOPS: Coding DevSecOps journeyDEVSECOPS: Coding DevSecOps journey
DEVSECOPS: Coding DevSecOps journey
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6
 
DevOps for beginners
DevOps for beginnersDevOps for beginners
DevOps for beginners
 
When To Use Ruby On Rails
When To Use Ruby On RailsWhen To Use Ruby On Rails
When To Use Ruby On Rails
 
Introduction To DevOps | Devops Tutorial For Beginners | DevOps Training For ...
Introduction To DevOps | Devops Tutorial For Beginners | DevOps Training For ...Introduction To DevOps | Devops Tutorial For Beginners | DevOps Training For ...
Introduction To DevOps | Devops Tutorial For Beginners | DevOps Training For ...
 
오픈소스 개발을 위한 Git 사용법 실습
오픈소스 개발을 위한 Git 사용법 실습오픈소스 개발을 위한 Git 사용법 실습
오픈소스 개발을 위한 Git 사용법 실습
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS
 
git, 이해부터 활용까지
git, 이해부터 활용까지git, 이해부터 활용까지
git, 이해부터 활용까지
 
Here Be Dragons: The Unexplored Land of Active Directory ACLs
Here Be Dragons: The Unexplored Land of Active Directory ACLsHere Be Dragons: The Unexplored Land of Active Directory ACLs
Here Be Dragons: The Unexplored Land of Active Directory ACLs
 
Travailler avec git et eclipse
Travailler avec git et eclipseTravailler avec git et eclipse
Travailler avec git et eclipse
 
Introduction to devops
Introduction to devopsIntroduction to devops
Introduction to devops
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
 
Redux toolkit
Redux toolkitRedux toolkit
Redux toolkit
 
DevSecOps reference architectures 2018
DevSecOps reference architectures 2018DevSecOps reference architectures 2018
DevSecOps reference architectures 2018
 
Git
GitGit
Git
 

Destacado

Distributed Version Control (DVCS) With Mercurial
Distributed Version Control (DVCS) With MercurialDistributed Version Control (DVCS) With Mercurial
Distributed Version Control (DVCS) With MercurialTed Naleid
 
Mercurial DVCS
Mercurial DVCSMercurial DVCS
Mercurial DVCSHosam Aly
 
Mercurial: Beginners (v1)
Mercurial: Beginners (v1)Mercurial: Beginners (v1)
Mercurial: Beginners (v1)Michael Wales
 
4. hg init – a mercurial tutorial by tortoise hg merging
4. hg init – a mercurial tutorial by tortoise hg   merging4. hg init – a mercurial tutorial by tortoise hg   merging
4. hg init – a mercurial tutorial by tortoise hg mergingMickey SJ Lee
 
5. hg init – a mercurial tutorial by tortoise hg repository architecture
5. hg init – a mercurial tutorial by tortoise hg   repository architecture5. hg init – a mercurial tutorial by tortoise hg   repository architecture
5. hg init – a mercurial tutorial by tortoise hg repository architectureMickey SJ Lee
 
Mercurial intro
Mercurial introMercurial intro
Mercurial introRealNitro
 
Mercurial DVCS presentation to DevJam 11/4/2009
Mercurial DVCS presentation to DevJam 11/4/2009Mercurial DVCS presentation to DevJam 11/4/2009
Mercurial DVCS presentation to DevJam 11/4/2009Ted Naleid
 
3. hg init – a mercurial tutorial by tortoies hg fixing goofs
3. hg init – a mercurial tutorial by tortoies hg   fixing goofs3. hg init – a mercurial tutorial by tortoies hg   fixing goofs
3. hg init – a mercurial tutorial by tortoies hg fixing goofsMickey SJ Lee
 
2. hg init – a mercurial tutorial by tortoies hg setting up for a team
2. hg init – a mercurial tutorial by tortoies hg   setting up for a team2. hg init – a mercurial tutorial by tortoies hg   setting up for a team
2. hg init – a mercurial tutorial by tortoies hg setting up for a teamMickey SJ Lee
 

Destacado (12)

Mercurial
MercurialMercurial
Mercurial
 
Mercurial
MercurialMercurial
Mercurial
 
Distributed Version Control (DVCS) With Mercurial
Distributed Version Control (DVCS) With MercurialDistributed Version Control (DVCS) With Mercurial
Distributed Version Control (DVCS) With Mercurial
 
Mercurial DVCS
Mercurial DVCSMercurial DVCS
Mercurial DVCS
 
Mercurial: Beginners (v1)
Mercurial: Beginners (v1)Mercurial: Beginners (v1)
Mercurial: Beginners (v1)
 
4. hg init – a mercurial tutorial by tortoise hg merging
4. hg init – a mercurial tutorial by tortoise hg   merging4. hg init – a mercurial tutorial by tortoise hg   merging
4. hg init – a mercurial tutorial by tortoise hg merging
 
5. hg init – a mercurial tutorial by tortoise hg repository architecture
5. hg init – a mercurial tutorial by tortoise hg   repository architecture5. hg init – a mercurial tutorial by tortoise hg   repository architecture
5. hg init – a mercurial tutorial by tortoise hg repository architecture
 
Mercurial intro
Mercurial introMercurial intro
Mercurial intro
 
The Mercurial SCM
The Mercurial SCMThe Mercurial SCM
The Mercurial SCM
 
Mercurial DVCS presentation to DevJam 11/4/2009
Mercurial DVCS presentation to DevJam 11/4/2009Mercurial DVCS presentation to DevJam 11/4/2009
Mercurial DVCS presentation to DevJam 11/4/2009
 
3. hg init – a mercurial tutorial by tortoies hg fixing goofs
3. hg init – a mercurial tutorial by tortoies hg   fixing goofs3. hg init – a mercurial tutorial by tortoies hg   fixing goofs
3. hg init – a mercurial tutorial by tortoies hg fixing goofs
 
2. hg init – a mercurial tutorial by tortoies hg setting up for a team
2. hg init – a mercurial tutorial by tortoies hg   setting up for a team2. hg init – a mercurial tutorial by tortoies hg   setting up for a team
2. hg init – a mercurial tutorial by tortoies hg setting up for a team
 

Similar a Mercurial Distributed Version Control

Cloudops fundamentals management, tdd, test driven design, continuous integra...
Cloudops fundamentals management, tdd, test driven design, continuous integra...Cloudops fundamentals management, tdd, test driven design, continuous integra...
Cloudops fundamentals management, tdd, test driven design, continuous integra...Bret Piatt
 
Devops interview questions 2 www.bigclasses.com
Devops interview questions  2  www.bigclasses.comDevops interview questions  2  www.bigclasses.com
Devops interview questions 2 www.bigclasses.combigclasses.com
 
No Hugging, No Learning
No Hugging, No LearningNo Hugging, No Learning
No Hugging, No LearningOlaf Alders
 
Cfgmgmt Challenges aren't technical anymore
Cfgmgmt Challenges aren't technical anymoreCfgmgmt Challenges aren't technical anymore
Cfgmgmt Challenges aren't technical anymoreJulien Pivotto
 
Continuous Integration: How I stopped guessing if that merge was bad
Continuous Integration: How I stopped guessing if that merge was badContinuous Integration: How I stopped guessing if that merge was bad
Continuous Integration: How I stopped guessing if that merge was badJoe Ferguson
 
Source Code Management Slides
Source Code Management SlidesSource Code Management Slides
Source Code Management Slidesdaschuck
 
WordCamp Belfast DevOps for Beginners
WordCamp Belfast DevOps for BeginnersWordCamp Belfast DevOps for Beginners
WordCamp Belfast DevOps for BeginnersStewart Ritchie
 
Random Ruby Tips - Ruby Meetup 27 Jun 2018
Random Ruby Tips - Ruby Meetup 27 Jun 2018Random Ruby Tips - Ruby Meetup 27 Jun 2018
Random Ruby Tips - Ruby Meetup 27 Jun 2018Kenneth Teh
 
Jbossworld Presentation
Jbossworld PresentationJbossworld Presentation
Jbossworld PresentationDan Hinojosa
 
Front-End Modernization for Mortals
Front-End Modernization for MortalsFront-End Modernization for Mortals
Front-End Modernization for Mortalscgack
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernizationdevObjective
 
PVS-Studio Now Supports Any Build System under Windows and Any Compiler. Easy...
PVS-Studio Now Supports Any Build System under Windows and Any Compiler. Easy...PVS-Studio Now Supports Any Build System under Windows and Any Compiler. Easy...
PVS-Studio Now Supports Any Build System under Windows and Any Compiler. Easy...Andrey Karpov
 
Migraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sitesMigraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sitesdrupalindia
 
Austin Web Architecture
Austin Web ArchitectureAustin Web Architecture
Austin Web Architecturejoaquincasares
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Fabrice Bernhard
 
Future proofing design work with Web components
Future proofing design work with Web componentsFuture proofing design work with Web components
Future proofing design work with Web componentsbtopro
 
Enhance your Agility with DevOps
Enhance your Agility with DevOpsEnhance your Agility with DevOps
Enhance your Agility with DevOpsEdureka!
 

Similar a Mercurial Distributed Version Control (20)

Cloudops fundamentals management, tdd, test driven design, continuous integra...
Cloudops fundamentals management, tdd, test driven design, continuous integra...Cloudops fundamentals management, tdd, test driven design, continuous integra...
Cloudops fundamentals management, tdd, test driven design, continuous integra...
 
Devops interview questions 2 www.bigclasses.com
Devops interview questions  2  www.bigclasses.comDevops interview questions  2  www.bigclasses.com
Devops interview questions 2 www.bigclasses.com
 
Git Makes Me Angry Inside
Git Makes Me Angry InsideGit Makes Me Angry Inside
Git Makes Me Angry Inside
 
Power Of Zero
Power Of ZeroPower Of Zero
Power Of Zero
 
No Hugging, No Learning
No Hugging, No LearningNo Hugging, No Learning
No Hugging, No Learning
 
Cfgmgmt Challenges aren't technical anymore
Cfgmgmt Challenges aren't technical anymoreCfgmgmt Challenges aren't technical anymore
Cfgmgmt Challenges aren't technical anymore
 
Continuous Integration: How I stopped guessing if that merge was bad
Continuous Integration: How I stopped guessing if that merge was badContinuous Integration: How I stopped guessing if that merge was bad
Continuous Integration: How I stopped guessing if that merge was bad
 
Source Code Management Slides
Source Code Management SlidesSource Code Management Slides
Source Code Management Slides
 
WordCamp Belfast DevOps for Beginners
WordCamp Belfast DevOps for BeginnersWordCamp Belfast DevOps for Beginners
WordCamp Belfast DevOps for Beginners
 
Random Ruby Tips - Ruby Meetup 27 Jun 2018
Random Ruby Tips - Ruby Meetup 27 Jun 2018Random Ruby Tips - Ruby Meetup 27 Jun 2018
Random Ruby Tips - Ruby Meetup 27 Jun 2018
 
Jbossworld Presentation
Jbossworld PresentationJbossworld Presentation
Jbossworld Presentation
 
Front-End Modernization for Mortals
Front-End Modernization for MortalsFront-End Modernization for Mortals
Front-End Modernization for Mortals
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernization
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernization
 
PVS-Studio Now Supports Any Build System under Windows and Any Compiler. Easy...
PVS-Studio Now Supports Any Build System under Windows and Any Compiler. Easy...PVS-Studio Now Supports Any Build System under Windows and Any Compiler. Easy...
PVS-Studio Now Supports Any Build System under Windows and Any Compiler. Easy...
 
Migraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sitesMigraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sites
 
Austin Web Architecture
Austin Web ArchitectureAustin Web Architecture
Austin Web Architecture
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
Future proofing design work with Web components
Future proofing design work with Web componentsFuture proofing design work with Web components
Future proofing design work with Web components
 
Enhance your Agility with DevOps
Enhance your Agility with DevOpsEnhance your Agility with DevOps
Enhance your Agility with DevOps
 

Más de David Stockton

Phone calls and sms from php
Phone calls and sms from phpPhone calls and sms from php
Phone calls and sms from phpDavid Stockton
 
The Art of Transduction
The Art of TransductionThe Art of Transduction
The Art of TransductionDavid Stockton
 
Using queues and offline processing to help speed up your application
Using queues and offline processing to help speed up your applicationUsing queues and offline processing to help speed up your application
Using queues and offline processing to help speed up your applicationDavid Stockton
 
Intermediate OOP in PHP
Intermediate OOP in PHPIntermediate OOP in PHP
Intermediate OOP in PHPDavid Stockton
 
Building APIs with Apigilty and Zend Framework 2
Building APIs with Apigilty and Zend Framework 2Building APIs with Apigilty and Zend Framework 2
Building APIs with Apigilty and Zend Framework 2David Stockton
 
Intermediate OOP in PHP
Intermediate OOP in PHPIntermediate OOP in PHP
Intermediate OOP in PHPDavid Stockton
 
Hacking sites for fun and profit
Hacking sites for fun and profitHacking sites for fun and profit
Hacking sites for fun and profitDavid Stockton
 
Common design patterns in php
Common design patterns in phpCommon design patterns in php
Common design patterns in phpDavid Stockton
 
Intermediate oop in php
Intermediate oop in phpIntermediate oop in php
Intermediate oop in phpDavid Stockton
 
Hacking sites for fun and profit
Hacking sites for fun and profitHacking sites for fun and profit
Hacking sites for fun and profitDavid Stockton
 
Hacking sites for fun and profit
Hacking sites for fun and profitHacking sites for fun and profit
Hacking sites for fun and profitDavid Stockton
 
Increasing code quality with code reviews (poetry version)
Increasing code quality with code reviews (poetry version)Increasing code quality with code reviews (poetry version)
Increasing code quality with code reviews (poetry version)David Stockton
 
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSHTame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSHDavid Stockton
 
Regular expressions and php
Regular expressions and phpRegular expressions and php
Regular expressions and phpDavid Stockton
 

Más de David Stockton (19)

Phone calls and sms from php
Phone calls and sms from phpPhone calls and sms from php
Phone calls and sms from php
 
The Art of Transduction
The Art of TransductionThe Art of Transduction
The Art of Transduction
 
Using queues and offline processing to help speed up your application
Using queues and offline processing to help speed up your applicationUsing queues and offline processing to help speed up your application
Using queues and offline processing to help speed up your application
 
Intermediate OOP in PHP
Intermediate OOP in PHPIntermediate OOP in PHP
Intermediate OOP in PHP
 
Building APIs with Apigilty and Zend Framework 2
Building APIs with Apigilty and Zend Framework 2Building APIs with Apigilty and Zend Framework 2
Building APIs with Apigilty and Zend Framework 2
 
API All the Things!
API All the Things!API All the Things!
API All the Things!
 
Intermediate OOP in PHP
Intermediate OOP in PHPIntermediate OOP in PHP
Intermediate OOP in PHP
 
Hacking sites for fun and profit
Hacking sites for fun and profitHacking sites for fun and profit
Hacking sites for fun and profit
 
Beginning OOP in PHP
Beginning OOP in PHPBeginning OOP in PHP
Beginning OOP in PHP
 
Common design patterns in php
Common design patterns in phpCommon design patterns in php
Common design patterns in php
 
Intermediate oop in php
Intermediate oop in phpIntermediate oop in php
Intermediate oop in php
 
Grokking regex
Grokking regexGrokking regex
Grokking regex
 
Hacking sites for fun and profit
Hacking sites for fun and profitHacking sites for fun and profit
Hacking sites for fun and profit
 
Hacking sites for fun and profit
Hacking sites for fun and profitHacking sites for fun and profit
Hacking sites for fun and profit
 
Increasing code quality with code reviews (poetry version)
Increasing code quality with code reviews (poetry version)Increasing code quality with code reviews (poetry version)
Increasing code quality with code reviews (poetry version)
 
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSHTame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
 
Regular expressions and php
Regular expressions and phpRegular expressions and php
Regular expressions and php
 
PHP 5 Magic Methods
PHP 5 Magic MethodsPHP 5 Magic Methods
PHP 5 Magic Methods
 
FireBug And FirePHP
FireBug And FirePHPFireBug And FirePHP
FireBug And FirePHP
 

Último

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 

Último (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Mercurial Distributed Version Control

  • 1. Mercurial Distributed Source Control Presented by David Stockton for Front Range PHP User Group April 28, 2010
  • 2. “If debugging is the process of removing bugs, then programming must be the process of putting them in.” - Anonymous
  • 3. Source Control in a Nutshell A great way to avoid catastrophic mistakes with your code Essential - If your code is more than a few lines long and you’re not using source control, you must not think very highly of your work. If you’re not using source control, start now. Even CVS is better than no source control. (Not sure about VSS though)
  • 4. Source Control in a Nutshell If you are working with a team (read, one or more other people) source control is essential If you’re working by yourself and you’ve ever made a mistake, source control is essential If you ever wished you could undo something you just did, source control is essential If you need to maintain different versions of the same code, source control is essential.
  • 5. I could go on, but...
  • 6. I could go on, but... The bottom line is...
  • 7. I could go on, but... The bottom line is... Source control is absolutely essential!
  • 8. Questions? Questions about source control in general?
  • 9. Goals of Source Control Keep your source code safe Allow you to look at different versions of your code Allow multiple developers to work simultaneously Allow multiple “branches” of code to be worked on at the same time
  • 10. Common/Popular Source Control Tools CVS SVN (Subversion) ClearCase Perforce Microsoft Visual SourceSafe Git Mercurial
  • 11. Common/Popular Source Control Tools BitKeeper Telelogic Synergy Visual Studio Team System StarTeam RCS Tons of others...
  • 12. Types of Source Control Client Server Model (CVS, SVN, etc) Distributed (Git, Mercurial)
  • 13. Mercurial Distributed Version Control System Works the way you want it instead of forcing you to use it in a certain way Used by lots of big projects
  • 16. How does it work? Probably not the way you’d think if you’ve used CVS or SVN or other client server VCS (Version Control System)
  • 17. How it’s different No central server ... or at least not one that’s required Works on changesets, not file or repository versions Changesets allow merges (shudder) to be simple This is a good thing since you’ll be merging a lot Learn to not be afraid of the merge
  • 18. What else? Doing a checkout gives you a full copy of the repository Including all changes, etc Lose a server? Just clone another copy of the repository
  • 19. What can you do with it? Pretty much anything Clone a repository to try out some experimental code If it works, keep it If not, delete it, no harm done And no evidence of your failed attempt
  • 20. What can you do with it? Work on a plane (and still check in code) Collaborate with a colleague in a coffee shop Pick and choose what you want in your repository Push, pull and clone from other repositories
  • 21. Make your VCS work how you do! Work on the road Work from home Work from work Work from a plane Work from a train Work in an automobile (if you’re not driving)
  • 22. #1 Awesome Thing Branches are easy ... But they’re pretty easy in CVS and SVN too
  • 23. Branches If you’re working on Feature A and I am working on Feature B, we’ve essentially branched Two or more people working on code based on the same thing creates branches Named branches Unnamed branches Branches by cloning
  • 24. #2 Awesome Thing Branches being easy is great, but only if... Merges are super easy! Most merges handled automatically Merge conflicts can be handled by a tool of your choice I like kdiff3
  • 25. #3 Awesome Thing No network? No problem Work from anywhere Collaborate with a colleague in the middle of nowhere
  • 26. Installation Mercurial is cross platform with excellent support on Windows, Linux and Mac http://mercurial.selenic.com/ Download binary for Windows or Mac ... or apt-get install mercurial yum install mercurial ermerge mercurial pkg install SUNWmercurial
  • 27. Create a new Repository
  • 29. You now have a working repository If you don’t do command line there are other ways IDE Integration - Eclipse, NetBeans, IntelliJ, Emacs, Vim, TextMate, Visual Studio Windows integration with TortoiseHg Build/Management tools with Hg support: CruiseControl, JIRA, Trac, Maven, Redmine, Hudson, ant, etc
  • 30. Add some code Use ‘hg add’ to tell Mercurial about the files you want it to track Use ‘hg commit’ to tell Mercurial to check in code hg ci hg com
  • 32. Look at the repository
  • 33. Look at the repository
  • 34. Make some more changes
  • 38. What does that commit look like? Pretty much the same Why? Luke Skywalker has his own repository
  • 39. How can I get Luke’s Change? Use ‘hg push’ from Luke’s instance Use ‘hg pull’ on my instance to Luke’s instance
  • 41. What does it do to me? Where are the changes? Pushes do not affect the working copy Why? Updating the workspace could make me lose my work
  • 42. How to see those changes? Use ‘hg up’ Update your own workspace
  • 43. Let’s mix it up Dave makes a change to cookie to specify flour amount Luke makes a change to cookie to add eggs
  • 44. A matter of timing...
  • 47. But then... Don’t use -f to force... Don’t do it...
  • 49. Quick recap First check-in goes in Second check-in based on same code needs merge ‘hg pull’ + ‘hg merge’ took a fraction of a second Merge was correct Luke now needs to commit the merge and push back to Dave’s server
  • 51. And it now looks like...
  • 52. Still too easy... Let’s try a merge conflict... Dave needs more flour in the recipe Also, Dave hasn’t updated his workspace with the merge results Luke wants to use cake flour
  • 53. Merge conflict in the making
  • 54. Now the fun part Luke uses the force and does a check in and push before Dave does a check-in
  • 55. Here comes trouble... Dave tries to commit ... And it works ...
  • 56. But... it created a new head
  • 57. To get Luke’s changes...
  • 58. Merge 2 heads into 1 All that junk is kdiff3 launching. I should fix that...
  • 59. Merge in kdiff3 Notice that the eggs part was automatically resolved
  • 63. Crazy branch/merges The example to the right was done with just 5 users but I was purposely trying to make lots of weird branch merge situations occur.
  • 64. Command overview hg clone - clone a repository hg merge - merge changes together hg add - tell Mercurial to start caring about some files hg commit - commit a new changeset hg push - send your changesets to another server hg pull - retrieve changesets from another server
  • 65. Command overview cont... hg update - Update your local workspace with the stuff from hg pull hg annotate - show which changeset is responsible for each line in a file hg diff - show the differences between files in your workspace and the committed file hg export - dump the header and diffs for one or more changesets
  • 66. Command overview cont... hg forget - Forget the specified files (remove from repository, not from workspace) when you commit hg log - show revision history hg remove - delete file and remove from repository when you commit hg serve - simple http server to show the repository (useful for coffee shop working)
  • 67. hg addremove - add all new files, remove deleted files hg backout - reverse effect of earlier changeset hg bisect - search changesets (DEMO) hg branch - set or show branch names hg branches - list all branches hg copy - mark file as copied for next commit (DEMO) hg heads - show repository or branch heads
  • 68. hg help - Where I’m getting this list of commands hg identify - identify the working copy hg incoming - show new changesets in source hg init - create a new repository hg outgoing - show changesets not in destination hg parents - show parents of working directory or revision
  • 69. Command overview cont... hg status - Show what’s going to happen when you commit hg summary - Summarize state of working directory hg paths - show aliases for remote repositories hg rename - rename a file (same as hg copy + hg remove) (DEMO) hg tag - tag a revision hg tags - show tags in repository
  • 70. Holy crap... That wasn’t even all the commands Or all the coolness
  • 71. As time permits... hg bisect demo hg copy demo hg rename demo hg mq - Patching, orthogonal mutable changesets
  • 73. Excellent Resources Quick and easy overview: http://hginit.com - Joel Spolsky’s explanation of Mercurial Mercurial: The Definitive Guide Available online at http://hgbook.red-bean.com/read/ Or buy from Amazon.com or O’Reilly Media

Notas del editor