SlideShare a Scribd company logo
1 of 76
Systèmes de gestion de version décentralisés
                               Git & Mercurial

                       Sébastien Deleuze @sdeleuze
                       Loïc Frering      @loicfrering
Historique
1990         CVS


2000


2002



2005
                   Bazaar
Les systèmes centralisés
Travail en mode connecté
Efficacité des équipes
Branches




  Qui utilise régulièrement des branches avec Subversion ?
Branches




  Quelques courageux, mais la plupart évitent à tout prix
Lenteurs !

                 .svn .svn

       +     +     .svn
                 .svn
                      .svn
                             +
             =
Les systèmes distribués
Typologies des dépôts




     Centralisés   Décentralisés   Distribués
Systèmes distribués

Pas besoin de réseau pour :


       Faire un diff
       Manipuler l'historique
       Faire des commits
       Gérer les branches
Principe
Performances
Easy branching
Hello World!
Initialisation du projet

$ git clone                      $ hg clone
https://loicfrering@github.com   https://sdeleuze@bitbucket.org
/loicfrering/hello.git           /sdeleuze/hello
Initialized empty Git            destination directory: hello
repository in                    updating to branch default
/home/hello/.git/                0 files updated, 0 files
warning: You appear to have      merged, 0 files removed, 0
cloned an empty repository.      files unresolved
$ cd hello                       $ cd hello
$ tree -aL 1                     $ tree -aL 1
.                                .
└── .git                         └── .hg

1 directory, 0 files             1 directory, 0 files
HelloWorld.java

$ vim HelloWorld.java
$ cat HelloWorld.java
public class HelloWorld {
    public static void main(String[] args) {
        HelloWorld hello = new HelloWorld();
        System.out.println(hello.sayHello());
    }

    public String sayHello() {
        return "Hello World from Java!";
    }
}
Track HelloWorld.java

$ git status -s             $   hg status
?? HelloWorld.java          ?   HelloWorld.java
$ git add HelloWorld.java   $   hg add HelloWorld.java
$ git status -s             $   hg status
A- HelloWorld.java          A   HelloWorld.java
Premier commit

$ git commit -m "Hello Java"     $ hg commit -m "Hello Java"
[master (root-commit) 8866129]
Hello Java
 1 files changed, 10
insertions(+), 0 deletions(-)
 create mode 100644
HelloWorld.java
HelloWorld.php

$ vim HelloWorld.php
$ cat HelloWorld.php
<?php
class HelloWorld
{
    public function sayHello()
    {
        return 'Hello World from PHP!';
    }
}

$hello = new HelloWorld();
echo $hello->sayHello() . PHP_EOL;
Second commit

$ git add HelloWorld.php        $ hg add HelloWorld.php
$ git commit -m "Hello PHP"     $ hg commit -m "Hello PHP"
[master db9dd3c] Hello PHP
 1 files changed, 11
insertions(+), 0 deletions(-)
 create mode 100644
HelloWorld.php
Nouvelle fonctionnalité
HelloWorld.java

$ vim HelloWorld.java
$ cat HelloWorld.java
public class HelloWorld {
    public static void main(String[] args) {
        HelloWorld hello = new HelloWorld();
        System.out.println(hello.sayHello("LyonJUG"));
    }

    public String sayHello(String name) {
        return "Hello " + name + " from Java!";
    }
}
HelloWorld.php

$ vim HelloWorld.php
$ cat HelloWorld.php
<?php
class HelloWorld
{
    public function sayHello($name)
    {
        return 'Hello ' . $name . ' from PHP!';
    }
}

$hello = new HelloWorld();
echo $hello->sayHello('LyonJUG') . PHP_EOL;
Staging area

$ git status -s            $   hg status
-M HelloWorld.java         M   HelloWorld.java
-M HelloWorld.php          M   HelloWorld.php
$ git add HelloWold.java   $   hg commit -m "Hello2 Java&PHP"
$ git status -s
M- HelloWorld.java
-M HelloWorld.php
Staging area
Staging area

$ git status -s
M- HelloWorld.java
-M HelloWorld.php
$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   HelloWorld.java
#
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working
directory)
#
#       modified:   HelloWorld.php
#
Staging area

$ git commit -m "Hello2 Java"
[master 99eb692] Hello2 Java
 1 files changed, 3 insertions(+), 3 deletions(-)
$ git status -s
-M HelloWorld.php
$ git add HelloWorld.php
$ git commit -m "Hello2 PHP"
[master c262c26] Hello2 PHP
 1 files changed, 3 insertions(+), 3 deletions(-)
Historique

$ git log --pretty=oneline --   $ hg log
abbrev-commit                   changeset:   2:5eb829edb1a0
c262c26 Hello2 PHP              tag:         tip
99eb692 Hello2 Java             user:        sdeleuze
db9dd3c Hello PHP               date:        Mon Sep 20 ...
8866129 Hello Java              summary:     Hello2 Java and
                                PHP

                                changeset:   1:8e3a9a10985d
                                user:        sdeleuze
                                date:        Mon Sep 20 ...
                                summary:     Hello PHP

                                changeset:   0:cfeb26b9662d
                                user:        sdeleuze
                                date:        Mon Sep 20 ...
                                summary:     Hello Java
Et Ruby ?

            Travaillons dans une branche !
Branche

$ git branch                     $ hg branch
* master                         default
$ git branch helloruby           $ hg branch helloruby
  helloruby                      marked working directory as
* master                         branch helloruby
$ git checkout helloruby         $ hg branch
Switched to branch 'helloruby'   helloruby
$ git branch
* helloruby
  master
hello_world.rb

$ vim hello_world.rb
$ cat hello_world.rb
class HelloWorld
    def sayHello(name)
        "Hello " + name + " from Ruby!"
    end
end

hello = HelloWorld.new
puts hello.sayHello("LyonJUG")
Troisième commit

$ git status -s                  $   hg status
?? hello_world.rb                ?   hello_ruby.rb
$ git add hello_world.rb         $   hg add hello_world.rb
$ git commit -m "Hello Ruby"     $   hg commit -m "Hello Ruby"
[helloruby 149af0e] Hello Ruby
 1 files changed, 8
insertions(+), 0 deletions(-)
 create mode 100644
hello_world.rb
Agilité : correction isolée

$ git branch                       $ hg branch
* helloruby                        helloruby
  master                           $ hg update default
$ git checkout master              0 files updated, 0 files merged,
Switched to branch 'master'        1 files removed, 0 files
$ ls                               unresolved
HelloWorld.java HelloWorld.php     $ ls
$ vim HelloWorld.java              HelloWorld.java HelloWorld.php
$ vim HelloWorld.php               $ vim HelloWorld.java
$ git add .                        $ vim HelloWorld.php
$ git commit -m "Hello3            $ hg commit -m "Hello3 Java&PHP"
Java&PHP"                          created new head
[master 71832b3] Hello3 Java&PHP
 2 files changed, 2
insertions(+), 2 deletions(-)
Agilité : reprise du travail

$ git branch                       $ hg branches
  helloruby                        default    4:d4455bac12b2
* master                           helloruby 3:5c5b732498bf
$ git checkout helloruby           $ hg update helloruby
Switched to branch 'helloruby'     3 files updated, 0 files merged,
$ vim hello_world.rb               0 files removed, 0 files
$ git commit -a -m "Hello3 Ruby"   unresolved
[helloruby bb94cb2] Hello3 Ruby    $ vim hello_world.rb
 1 files changed, 1                $ hg commit -m "Hello3 Ruby"
insertions(+), 1 deletions(-)
Merge

$ ls                             $ ls
hello_world.rb HelloWorld.java   hello_world.rb HelloWorld.java
 HelloWorld.php                   HelloWorld.php
$ git checkout master            $ hg update default
Switched to branch 'master'      2 files updated, 0 files merged,
$ ls                             1 files removed, 0 files
HelloWorld.java HelloWorld.php   unresolved
$ git merge helloruby            $ ls
Merge made by recursive.         HelloWorld.java HelloWorld.php
 hello_ruby.rb |    8 ++++++++   $ hg merge helloruby
 1 files changed, 8              1 files updated, 0 files merged,
insertions(+), 0 deletions(-)    0 files removed, 0 files
 create mode 100644              unresolved
hello_ruby.rb                    (branch merge, don't forget to
$ ls                             commit)
hello_world.rb HelloWorld.java   $ ls
 HelloWorld.php                  hello_world.rb HelloWorld.java
                                  HelloWorld.php
Log

$ git log --graph --pretty=oneline   $ hg   log -G
--abbrev-commit                      @      changeset:   6:491d950b55ac
* 7a390ee Merge branch 'helloruby'   |     tag:         tip
|                                   | |    summary:     Merge
| * bb94cb2 Hello3 Ruby              | |
| * 149af0e Hello Ruby               | o    changeset:   5:89f865402568
* | 71832b3 Hello3 Java&PHP          | |    branch:      helloruby
|/                                   | |    summary:     Hello3 Ruby
* c262c26 Hello2 PHP                 | |
* 99eb692 Hello2 Java                o |    changeset:   4:d4455bac12b2
* db9dd3c Hello PHP                  | |    parent:      2:5eb829edb1a0
* 8866129 Hello Java                 | |    summary:     Hello3
                                     | |
                                     o |    changeset:   2:5eb829edb1a0
                                     | |    summary:     Hello2 Java
                                     | |
                                     | o    changeset:   3:5c5b732498bf
                                     |/     branch:      helloruby
                                     |      summary:     Hello Ruby
Push

$ git push origin master            $ hg push
Counting objects: 26, done.         pushing to
Delta compression using up to 2     https://sdeleuze@bitbucket.org/sde
Compressing objects: 100%           leuze/hello
(25/25), done.                      searching for changes
Writing objects: 100% (26/26),      adding changesets
2.56 KiB, done.                     adding manifests
Total 26 (delta 10), reused 0       adding file changes
(delta 0)                           added 8 changesets with 42 changes
To                                  to 3 files
https://loicfrering@github.com/lo
icfrering/hello.git
 * [new branch] master -> master
Pull

$ git pull origin master            $ hg pull -u
remote: Counting objects: 3,        pulling from
done.                               https://sdeleuze@bitbucket.org/sd
remote: Compressing objects: 100%   eleuze/hello
(2/2), done.
remote: Total 2 (delta 0), reused   searching for changes
0 (delta 0)                         adding changesets
Unpacking objects: 100% (2/2),      adding manifests
done.                               adding file changes
From                                added 1 changesets with 1 changes
git://github.com/loicfrering/hell   to 1 files
o.git                               1 files updated, 0 files merged,
 * 7a390ee..c84376b master     ->   0 files removed, 0 files
origin/master
                                    unresolved
Updating 7a390ee..c84376b
Fast-forward
 HelloWorld.py |    8 ++++++++
 1 files changed, 8
insertions(+), 0 deletions(-)
 create mode 100644 HelloWorld.py
Intégration au poste
 de développement
Console versus IHM

Constat :
- SVN = IHM d'abord, ligne de commande après
- Git/Mercurial = ligne de commande d'abord, IHM après
Intégration système Mercurial
 Excellent support multi-plateformes
 Support des proxy en entreprise
 Intégration Windows TortoiseHg
 hg serve très utile
Intégration système Git


 Intégration Windows
   msysGit / GitCheetah
   Cygwin
   TortoiseGit

 Support Windows un cran en dessous

 Support des proxy en entreprises
: MercurialEclipse

      Stable
      Performant
      Support complet
: EGit
 La Fondation Eclipse passe sous Git
 Basé sur JGit
 Part de loin mais progresse vite
 A terme, intégré nativement à Eclipse
: support Mercurial
 Support natif
 Bonne intégration
 Visualisation des branches un peu limitée
: NBGit


 Plugin encore jeune, mais utilisable
 Visualisation des branches
 Projet peu actif
Projets
Projets sous Mercurial
Projets sous Git
Forges
Forges "classiques"
Forges en entreprise


2 solutions :
   FaaS : Forge as a Service
   Forge interne

Intégration :
   Comptes utilisateurs
   Maven
   Intégration continue
Workflows
Systèmes centralisés
Open Source
Entreprise


Architecte
Resp qualité

 Lead dev
Gestion avancée des branches



Développement




                        Qualification - Recette




 Intégration continue                   Production
NoSQL ?
NoSQL !




      Comme solution de persistence :
         Gestion des versions
         Gestion des conflits
         Arborescence
         Stockage fichiers binaires
         Réplication
Conclusion
Synthèse




   Performances
   Multi-platforme
   Branches
   Formation
   Support proxy
   Intégration IDE
   Souplesse
  Popularité
2010 : les DVCS sont incontournables
          dans le monde Open Source




              2011 : les DVCS seront
       incontournables en entreprise
Liens

       Git Reference                     Hg Init
       Pro Git                           Mercurial: The definitive guide
       Git community book                Bitbucket
       GitHub




Analysis of Git and Mercurial
DVCS: A Not-So-Quick Guide Through
Why Git is better than X where X is one of hg, bzr, svn, perforce
Notre interview sur Git et Mercurial par Agnès Crepet des JDuchess
Crédits

Scott Chacon : Why git is better than X
Scott Chacon : Git 101
Chris Wanstrath : Git: The Lean, Mean, Distributed Machine
Vincent Driessen : A successful Git branching model
Curtis Newton : Green light = Go / Flickr
Gource : Software version control visualization

More Related Content

What's hot

"Mobage DBA Fight against Big Data" - NHN TE
"Mobage DBA Fight against Big Data" - NHN TE"Mobage DBA Fight against Big Data" - NHN TE
"Mobage DBA Fight against Big Data" - NHN TERyosuke IWANAGA
 
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pmRyosuke IWANAGA
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnAppWalter Heck
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configurationlutter
 
Redis - Usability and Use Cases
Redis - Usability and Use CasesRedis - Usability and Use Cases
Redis - Usability and Use CasesFabrizio Farinacci
 
PuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetPuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetWalter Heck
 
2005_Structures and functions of Makefile
2005_Structures and functions of Makefile2005_Structures and functions of Makefile
2005_Structures and functions of MakefileNakCheon Jung
 
How to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHow to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHiroshi SHIBATA
 
Counting on God
Counting on GodCounting on God
Counting on GodJames Gray
 
Apache CouchDB talk at Ontario GNU Linux Fest
Apache CouchDB talk at Ontario GNU Linux FestApache CouchDB talk at Ontario GNU Linux Fest
Apache CouchDB talk at Ontario GNU Linux FestMyles Braithwaite
 
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018) Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018) Zend by Rogue Wave Software
 
Redis SoCraTes 2014
Redis SoCraTes 2014Redis SoCraTes 2014
Redis SoCraTes 2014steffenbauer
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksCarlos Sanchez
 
Using ngx_lua in UPYUN 2
Using ngx_lua in UPYUN 2Using ngx_lua in UPYUN 2
Using ngx_lua in UPYUN 2Cong Zhang
 
Gemification plan of Standard Library on Ruby
Gemification plan of Standard Library on RubyGemification plan of Standard Library on Ruby
Gemification plan of Standard Library on RubyHiroshi SHIBATA
 
ZeroMQ Is The Answer: PHP Tek 11 Version
ZeroMQ Is The Answer: PHP Tek 11 VersionZeroMQ Is The Answer: PHP Tek 11 Version
ZeroMQ Is The Answer: PHP Tek 11 VersionIan Barber
 
RestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueRestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueGleicon Moraes
 

What's hot (20)

"Mobage DBA Fight against Big Data" - NHN TE
"Mobage DBA Fight against Big Data" - NHN TE"Mobage DBA Fight against Big Data" - NHN TE
"Mobage DBA Fight against Big Data" - NHN TE
 
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
 
Mesos university - Devoxx France 2015 - part 2
Mesos university - Devoxx France 2015 - part 2Mesos university - Devoxx France 2015 - part 2
Mesos university - Devoxx France 2015 - part 2
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnApp
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configuration
 
Redis - Usability and Use Cases
Redis - Usability and Use CasesRedis - Usability and Use Cases
Redis - Usability and Use Cases
 
PuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetPuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of Puppet
 
High Performance tDiary
High Performance tDiaryHigh Performance tDiary
High Performance tDiary
 
Puppet Camp 2012
Puppet Camp 2012Puppet Camp 2012
Puppet Camp 2012
 
2005_Structures and functions of Makefile
2005_Structures and functions of Makefile2005_Structures and functions of Makefile
2005_Structures and functions of Makefile
 
How to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHow to Begin Developing Ruby Core
How to Begin Developing Ruby Core
 
Counting on God
Counting on GodCounting on God
Counting on God
 
Apache CouchDB talk at Ontario GNU Linux Fest
Apache CouchDB talk at Ontario GNU Linux FestApache CouchDB talk at Ontario GNU Linux Fest
Apache CouchDB talk at Ontario GNU Linux Fest
 
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018) Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
 
Redis SoCraTes 2014
Redis SoCraTes 2014Redis SoCraTes 2014
Redis SoCraTes 2014
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
 
Using ngx_lua in UPYUN 2
Using ngx_lua in UPYUN 2Using ngx_lua in UPYUN 2
Using ngx_lua in UPYUN 2
 
Gemification plan of Standard Library on Ruby
Gemification plan of Standard Library on RubyGemification plan of Standard Library on Ruby
Gemification plan of Standard Library on Ruby
 
ZeroMQ Is The Answer: PHP Tek 11 Version
ZeroMQ Is The Answer: PHP Tek 11 VersionZeroMQ Is The Answer: PHP Tek 11 Version
ZeroMQ Is The Answer: PHP Tek 11 Version
 
RestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueRestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message Queue
 

Similar to Presentation DVCS - Git - Mercurial au LyonJug

Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control SystemVictor Wong
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With GitNick Quaranto
 
Get Good With Git
Get Good With GitGet Good With Git
Get Good With GitHoffman Lab
 
Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Brian K. Vagnini
 
Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlBecky Todd
 
Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHubLucas Videla
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about gitSothearin Ren
 
Git workshop
Git workshopGit workshop
Git workshopRay Toal
 
Working with multiple git repositories
Working with multiple git repositoriesWorking with multiple git repositories
Working with multiple git repositoriesJulien Pivotto
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for ArtistsDavid Newbury
 

Similar to Presentation DVCS - Git - Mercurial au LyonJug (20)

Git
GitGit
Git
 
Git presentation
Git presentationGit presentation
Git presentation
 
Loading...git
Loading...gitLoading...git
Loading...git
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
Get Good With Git
Get Good With GitGet Good With Git
Get Good With Git
 
Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615
 
Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version control
 
Get on with git
Get on with gitGet on with git
Get on with git
 
Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHub
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
 
Hello git
Hello git Hello git
Hello git
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
 
sample.pptx
sample.pptxsample.pptx
sample.pptx
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
git internals
git internalsgit internals
git internals
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
Git workshop
Git workshopGit workshop
Git workshop
 
Working with multiple git repositories
Working with multiple git repositoriesWorking with multiple git repositories
Working with multiple git repositories
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for Artists
 

More from Sébastien Deleuze

More from Sébastien Deleuze (9)

Dart JUG 2013
Dart JUG 2013Dart JUG 2013
Dart JUG 2013
 
Dart : one language to rule them all - MixIT 2013
Dart : one language to rule them all - MixIT 2013Dart : one language to rule them all - MixIT 2013
Dart : one language to rule them all - MixIT 2013
 
Resthub lyonjug
Resthub lyonjugResthub lyonjug
Resthub lyonjug
 
Resthub framework presentation
Resthub framework presentationResthub framework presentation
Resthub framework presentation
 
Openscales Foss4g 2010 presentation
Openscales Foss4g 2010 presentationOpenscales Foss4g 2010 presentation
Openscales Foss4g 2010 presentation
 
02 create first-map
02 create first-map02 create first-map
02 create first-map
 
01 configure your-project
01 configure your-project01 configure your-project
01 configure your-project
 
03 add markers
03 add markers03 add markers
03 add markers
 
Resthub
ResthubResthub
Resthub
 

Presentation DVCS - Git - Mercurial au LyonJug

  • 1. Systèmes de gestion de version décentralisés Git & Mercurial Sébastien Deleuze @sdeleuze Loïc Frering @loicfrering
  • 2. Historique 1990 CVS 2000 2002 2005 Bazaar
  • 4. Travail en mode connecté
  • 6. Branches Qui utilise régulièrement des branches avec Subversion ?
  • 7. Branches Quelques courageux, mais la plupart évitent à tout prix
  • 8. Lenteurs ! .svn .svn + + .svn .svn .svn + =
  • 10. Typologies des dépôts Centralisés Décentralisés Distribués
  • 11. Systèmes distribués Pas besoin de réseau pour : Faire un diff Manipuler l'historique Faire des commits Gérer les branches
  • 16. Initialisation du projet $ git clone $ hg clone https://loicfrering@github.com https://sdeleuze@bitbucket.org /loicfrering/hello.git /sdeleuze/hello Initialized empty Git destination directory: hello repository in updating to branch default /home/hello/.git/ 0 files updated, 0 files warning: You appear to have merged, 0 files removed, 0 cloned an empty repository. files unresolved $ cd hello $ cd hello $ tree -aL 1 $ tree -aL 1 . . └── .git └── .hg 1 directory, 0 files 1 directory, 0 files
  • 17. HelloWorld.java $ vim HelloWorld.java $ cat HelloWorld.java public class HelloWorld { public static void main(String[] args) { HelloWorld hello = new HelloWorld(); System.out.println(hello.sayHello()); } public String sayHello() { return "Hello World from Java!"; } }
  • 18. Track HelloWorld.java $ git status -s $ hg status ?? HelloWorld.java ? HelloWorld.java $ git add HelloWorld.java $ hg add HelloWorld.java $ git status -s $ hg status A- HelloWorld.java A HelloWorld.java
  • 19. Premier commit $ git commit -m "Hello Java" $ hg commit -m "Hello Java" [master (root-commit) 8866129] Hello Java 1 files changed, 10 insertions(+), 0 deletions(-) create mode 100644 HelloWorld.java
  • 20. HelloWorld.php $ vim HelloWorld.php $ cat HelloWorld.php <?php class HelloWorld { public function sayHello() { return 'Hello World from PHP!'; } } $hello = new HelloWorld(); echo $hello->sayHello() . PHP_EOL;
  • 21. Second commit $ git add HelloWorld.php $ hg add HelloWorld.php $ git commit -m "Hello PHP" $ hg commit -m "Hello PHP" [master db9dd3c] Hello PHP 1 files changed, 11 insertions(+), 0 deletions(-) create mode 100644 HelloWorld.php
  • 23. HelloWorld.java $ vim HelloWorld.java $ cat HelloWorld.java public class HelloWorld { public static void main(String[] args) { HelloWorld hello = new HelloWorld(); System.out.println(hello.sayHello("LyonJUG")); } public String sayHello(String name) { return "Hello " + name + " from Java!"; } }
  • 24. HelloWorld.php $ vim HelloWorld.php $ cat HelloWorld.php <?php class HelloWorld { public function sayHello($name) { return 'Hello ' . $name . ' from PHP!'; } } $hello = new HelloWorld(); echo $hello->sayHello('LyonJUG') . PHP_EOL;
  • 25. Staging area $ git status -s $ hg status -M HelloWorld.java M HelloWorld.java -M HelloWorld.php M HelloWorld.php $ git add HelloWold.java $ hg commit -m "Hello2 Java&PHP" $ git status -s M- HelloWorld.java -M HelloWorld.php
  • 27. Staging area $ git status -s M- HelloWorld.java -M HelloWorld.php $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: HelloWorld.java # # Changed but not updated: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: HelloWorld.php #
  • 28. Staging area $ git commit -m "Hello2 Java" [master 99eb692] Hello2 Java 1 files changed, 3 insertions(+), 3 deletions(-) $ git status -s -M HelloWorld.php $ git add HelloWorld.php $ git commit -m "Hello2 PHP" [master c262c26] Hello2 PHP 1 files changed, 3 insertions(+), 3 deletions(-)
  • 29. Historique $ git log --pretty=oneline -- $ hg log abbrev-commit changeset: 2:5eb829edb1a0 c262c26 Hello2 PHP tag: tip 99eb692 Hello2 Java user: sdeleuze db9dd3c Hello PHP date: Mon Sep 20 ... 8866129 Hello Java summary: Hello2 Java and PHP changeset: 1:8e3a9a10985d user: sdeleuze date: Mon Sep 20 ... summary: Hello PHP changeset: 0:cfeb26b9662d user: sdeleuze date: Mon Sep 20 ... summary: Hello Java
  • 30. Et Ruby ? Travaillons dans une branche !
  • 31. Branche $ git branch $ hg branch * master default $ git branch helloruby $ hg branch helloruby helloruby marked working directory as * master branch helloruby $ git checkout helloruby $ hg branch Switched to branch 'helloruby' helloruby $ git branch * helloruby master
  • 32. hello_world.rb $ vim hello_world.rb $ cat hello_world.rb class HelloWorld def sayHello(name) "Hello " + name + " from Ruby!" end end hello = HelloWorld.new puts hello.sayHello("LyonJUG")
  • 33. Troisième commit $ git status -s $ hg status ?? hello_world.rb ? hello_ruby.rb $ git add hello_world.rb $ hg add hello_world.rb $ git commit -m "Hello Ruby" $ hg commit -m "Hello Ruby" [helloruby 149af0e] Hello Ruby 1 files changed, 8 insertions(+), 0 deletions(-) create mode 100644 hello_world.rb
  • 34.
  • 35. Agilité : correction isolée $ git branch $ hg branch * helloruby helloruby master $ hg update default $ git checkout master 0 files updated, 0 files merged, Switched to branch 'master' 1 files removed, 0 files $ ls unresolved HelloWorld.java HelloWorld.php $ ls $ vim HelloWorld.java HelloWorld.java HelloWorld.php $ vim HelloWorld.php $ vim HelloWorld.java $ git add . $ vim HelloWorld.php $ git commit -m "Hello3 $ hg commit -m "Hello3 Java&PHP" Java&PHP" created new head [master 71832b3] Hello3 Java&PHP 2 files changed, 2 insertions(+), 2 deletions(-)
  • 36. Agilité : reprise du travail $ git branch $ hg branches helloruby default 4:d4455bac12b2 * master helloruby 3:5c5b732498bf $ git checkout helloruby $ hg update helloruby Switched to branch 'helloruby' 3 files updated, 0 files merged, $ vim hello_world.rb 0 files removed, 0 files $ git commit -a -m "Hello3 Ruby" unresolved [helloruby bb94cb2] Hello3 Ruby $ vim hello_world.rb 1 files changed, 1 $ hg commit -m "Hello3 Ruby" insertions(+), 1 deletions(-)
  • 37. Merge $ ls $ ls hello_world.rb HelloWorld.java hello_world.rb HelloWorld.java HelloWorld.php HelloWorld.php $ git checkout master $ hg update default Switched to branch 'master' 2 files updated, 0 files merged, $ ls 1 files removed, 0 files HelloWorld.java HelloWorld.php unresolved $ git merge helloruby $ ls Merge made by recursive. HelloWorld.java HelloWorld.php hello_ruby.rb | 8 ++++++++ $ hg merge helloruby 1 files changed, 8 1 files updated, 0 files merged, insertions(+), 0 deletions(-) 0 files removed, 0 files create mode 100644 unresolved hello_ruby.rb (branch merge, don't forget to $ ls commit) hello_world.rb HelloWorld.java $ ls HelloWorld.php hello_world.rb HelloWorld.java HelloWorld.php
  • 38. Log $ git log --graph --pretty=oneline $ hg log -G --abbrev-commit @ changeset: 6:491d950b55ac * 7a390ee Merge branch 'helloruby' | tag: tip | | | summary: Merge | * bb94cb2 Hello3 Ruby | | | * 149af0e Hello Ruby | o changeset: 5:89f865402568 * | 71832b3 Hello3 Java&PHP | | branch: helloruby |/ | | summary: Hello3 Ruby * c262c26 Hello2 PHP | | * 99eb692 Hello2 Java o | changeset: 4:d4455bac12b2 * db9dd3c Hello PHP | | parent: 2:5eb829edb1a0 * 8866129 Hello Java | | summary: Hello3 | | o | changeset: 2:5eb829edb1a0 | | summary: Hello2 Java | | | o changeset: 3:5c5b732498bf |/ branch: helloruby | summary: Hello Ruby
  • 39. Push $ git push origin master $ hg push Counting objects: 26, done. pushing to Delta compression using up to 2 https://sdeleuze@bitbucket.org/sde Compressing objects: 100% leuze/hello (25/25), done. searching for changes Writing objects: 100% (26/26), adding changesets 2.56 KiB, done. adding manifests Total 26 (delta 10), reused 0 adding file changes (delta 0) added 8 changesets with 42 changes To to 3 files https://loicfrering@github.com/lo icfrering/hello.git * [new branch] master -> master
  • 40. Pull $ git pull origin master $ hg pull -u remote: Counting objects: 3, pulling from done. https://sdeleuze@bitbucket.org/sd remote: Compressing objects: 100% eleuze/hello (2/2), done. remote: Total 2 (delta 0), reused searching for changes 0 (delta 0) adding changesets Unpacking objects: 100% (2/2), adding manifests done. adding file changes From added 1 changesets with 1 changes git://github.com/loicfrering/hell to 1 files o.git 1 files updated, 0 files merged, * 7a390ee..c84376b master -> 0 files removed, 0 files origin/master unresolved Updating 7a390ee..c84376b Fast-forward HelloWorld.py | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) create mode 100644 HelloWorld.py
  • 41. Intégration au poste de développement
  • 42. Console versus IHM Constat : - SVN = IHM d'abord, ligne de commande après - Git/Mercurial = ligne de commande d'abord, IHM après
  • 43. Intégration système Mercurial  Excellent support multi-plateformes  Support des proxy en entreprise  Intégration Windows TortoiseHg  hg serve très utile
  • 44. Intégration système Git  Intégration Windows  msysGit / GitCheetah  Cygwin  TortoiseGit  Support Windows un cran en dessous  Support des proxy en entreprises
  • 45. : MercurialEclipse  Stable  Performant  Support complet
  • 46. : EGit  La Fondation Eclipse passe sous Git  Basé sur JGit  Part de loin mais progresse vite  A terme, intégré nativement à Eclipse
  • 47. : support Mercurial  Support natif  Bonne intégration  Visualisation des branches un peu limitée
  • 48. : NBGit  Plugin encore jeune, mais utilisable  Visualisation des branches  Projet peu actif
  • 52.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64. Forges en entreprise 2 solutions :  FaaS : Forge as a Service  Forge interne Intégration :  Comptes utilisateurs  Maven  Intégration continue
  • 69. Gestion avancée des branches Développement Qualification - Recette Intégration continue Production
  • 71. NoSQL ! Comme solution de persistence :  Gestion des versions  Gestion des conflits  Arborescence  Stockage fichiers binaires  Réplication
  • 73. Synthèse  Performances  Multi-platforme  Branches  Formation  Support proxy  Intégration IDE  Souplesse Popularité
  • 74. 2010 : les DVCS sont incontournables dans le monde Open Source 2011 : les DVCS seront incontournables en entreprise
  • 75. Liens Git Reference Hg Init Pro Git Mercurial: The definitive guide Git community book Bitbucket GitHub Analysis of Git and Mercurial DVCS: A Not-So-Quick Guide Through Why Git is better than X where X is one of hg, bzr, svn, perforce Notre interview sur Git et Mercurial par Agnès Crepet des JDuchess
  • 76. Crédits Scott Chacon : Why git is better than X Scott Chacon : Git 101 Chris Wanstrath : Git: The Lean, Mean, Distributed Machine Vincent Driessen : A successful Git branching model Curtis Newton : Green light = Go / Flickr Gource : Software version control visualization