Your SlideShare is downloading. ×
0
Barcamp Scotland 2008
      Introduction to Mercurial
  How to improve your source control.

                           Ta...
Introduction




  What Is Covered?
      A (Short) History of Source Control




         Tane Piper digitalspaghetti@gma...
Introduction




  What Is Covered?
      A (Short) History of Source Control
      Distributed Source Control




       ...
Introduction




  What Is Covered?
      A (Short) History of Source Control
      Distributed Source Control
      Mercu...
Introduction




  What Is Covered?
      A (Short) History of Source Control
      Distributed Source Control
      Mercu...
Introduction




  What Is Covered?
      A (Short) History of Source Control
      Distributed Source Control
      Mercu...
A (Short) History of Source Control I




      SCCS (Source Code Control System)
      Marc Rochkind wrote at Bell Labs, ...
A (Short) History of Source Control I




      SCCS (Source Code Control System)
      Marc Rochkind wrote at Bell Labs, ...
A (Short) History of Source Control I




      SCCS (Source Code Control System)
      Marc Rochkind wrote at Bell Labs, ...
A (Short) History of Source Control II




      Dick Grune developed CVS (Concurrent Versions System).




         Tane ...
A (Short) History of Source Control II




      Dick Grune developed CVS (Concurrent Versions System).
      CVS let deve...
A (Short) History of Source Control II




      Dick Grune developed CVS (Concurrent Versions System).
      CVS let deve...
A (Short) History of Source Control III



      In 2001 Jim Blandy and Karl Fogel developed Subversion.




         Tane...
A (Short) History of Source Control III



      In 2001 Jim Blandy and Karl Fogel developed Subversion.
      Subversion,...
A (Short) History of Source Control III



      In 2001 Jim Blandy and Karl Fogel developed Subversion.
      Subversion,...
A (Short) History of Source Control III



      In 2001 Jim Blandy and Karl Fogel developed Subversion.
      Subversion,...
A (Short) History of Source Control III



      In 2001 Jim Blandy and Karl Fogel developed Subversion.
      Subversion,...
Distributed Version Control




                What is Distributed Version Control?




         Tane Piper digitalspaghe...
Distributed Version Control (DVCS)




     Both git and Mercurial were announced in April 2005 to
     replace the withdr...
Distributed Version Control (DVCS)




     Both git and Mercurial were announced in April 2005 to
     replace the withdr...
Distributed Version Control (DVCS)




     Both git and Mercurial were announced in April 2005 to
     replace the withdr...
An Example of the DVCS Model




       Figure: An example of the Mercurial distributed model.


        Tane Piper digita...
Simple description of the DVCS model




     No repository is king - no ”central” repository except for one
     agreed i...
Simple description of the DVCS model




     No repository is king - no ”central” repository except for one
     agreed i...
Simple description of the DVCS model




     No repository is king - no ”central” repository except for one
     agreed i...
Simple description of the DVCS model




     No repository is king - no ”central” repository except for one
     agreed i...
Mercurial Itself



      Excellent support on Windows / Unix / MacOSX




         Tane Piper digitalspaghetti@gmail.com ...
Mercurial Itself



      Excellent support on Windows / Unix / MacOSX
      Tools such as TortoiseHG for Windows, QCT, Pu...
Mercurial Itself



      Excellent support on Windows / Unix / MacOSX
      Tools such as TortoiseHG for Windows, QCT, Pu...
Mercurial Itself



      Excellent support on Windows / Unix / MacOSX
      Tools such as TortoiseHG for Windows, QCT, Pu...
Mercurial Itself



      Excellent support on Windows / Unix / MacOSX
      Tools such as TortoiseHG for Windows, QCT, Pu...
Mercurial Commands I




     ’hg init <name>’ - This initialises the local repository. You
     can do this command withi...
Mercurial Commands I




     ’hg init <name>’ - This initialises the local repository. You
     can do this command withi...
Mercurial Commands I




     ’hg init <name>’ - This initialises the local repository. You
     can do this command withi...
Mercurial Commands I




     ’hg init <name>’ - This initialises the local repository. You
     can do this command withi...
Mercurial Commands II



     ’hg pull’ - This will pull the content to your local
     repository from the remote reposit...
Mercurial Commands II



     ’hg pull’ - This will pull the content to your local
     repository from the remote reposit...
Mercurial Commands II



     ’hg pull’ - This will pull the content to your local
     repository from the remote reposit...
Mercurial Commands II



     ’hg pull’ - This will pull the content to your local
     repository from the remote reposit...
How Mercurial Changesets Work




  Figure: A example of linear changesets. This is very common in
  repositories from one...
Simultaneous Local Changesets




     Figure: Two local repositories with different changeset histories.




         Tane...
Results of pulling a changeset into your local repository.




  Figure: Pulling a remote repository’s tip into your local...
Results of merging heads.




  Figure: Merging the two heads together creates a new head. This can
  now be pushed or pul...
Thank you for listning.




      Check out more about Mercurial at http://tinyurl.com/3xphcz




         Tane Piper digi...
Thank you for listning.




      Check out more about Mercurial at http://tinyurl.com/3xphcz
      SHAMELESS PLUG - Follo...
Thank you for listning.




      Check out more about Mercurial at http://tinyurl.com/3xphcz
      SHAMELESS PLUG - Follo...
Thank you for listning.




      Check out more about Mercurial at http://tinyurl.com/3xphcz
      SHAMELESS PLUG - Follo...
Upcoming SlideShare
Loading in...5
×

Introduction to Mercurial

4,471

Published on

A short talk on Mercurial i gave at Barcamp Scotland 2008

Published in: Technology
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,471
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
145
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

Transcript of "Introduction to Mercurial"

  1. 1. Barcamp Scotland 2008 Introduction to Mercurial How to improve your source control. Tane Piper digitalspaghetti@gmail.com http://digitalspaghetti.me.uk http://twitter.com/tanepiper February 2nd, 2008 Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  2. 2. Introduction What Is Covered? A (Short) History of Source Control Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  3. 3. Introduction What Is Covered? A (Short) History of Source Control Distributed Source Control Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  4. 4. Introduction What Is Covered? A (Short) History of Source Control Distributed Source Control Mercurial itself Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  5. 5. Introduction What Is Covered? A (Short) History of Source Control Distributed Source Control Mercurial itself How to import your project Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  6. 6. Introduction What Is Covered? A (Short) History of Source Control Distributed Source Control Mercurial itself How to import your project Download from http://tinyurl.com/2spv4h Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  7. 7. A (Short) History of Source Control I SCCS (Source Code Control System) Marc Rochkind wrote at Bell Labs, in the early 1970s. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  8. 8. A (Short) History of Source Control I SCCS (Source Code Control System) Marc Rochkind wrote at Bell Labs, in the early 1970s. SCCS operated on individual files and every author had access to a shared workspace on a single system. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  9. 9. A (Short) History of Source Control I SCCS (Source Code Control System) Marc Rochkind wrote at Bell Labs, in the early 1970s. SCCS operated on individual files and every author had access to a shared workspace on a single system. It was common for people to lock files, and later forget to unlock them, preventing anyone else from modifying those files without the help of an administrator. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  10. 10. A (Short) History of Source Control II Dick Grune developed CVS (Concurrent Versions System). Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  11. 11. A (Short) History of Source Control II Dick Grune developed CVS (Concurrent Versions System). CVS let developers work simultaneously and somewhat independently in their own personal workspaces. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  12. 12. A (Short) History of Source Control II Dick Grune developed CVS (Concurrent Versions System). CVS let developers work simultaneously and somewhat independently in their own personal workspaces. They had to merge their edits prior to committing changes to the central repository. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  13. 13. A (Short) History of Source Control III In 2001 Jim Blandy and Karl Fogel developed Subversion. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  14. 14. A (Short) History of Source Control III In 2001 Jim Blandy and Karl Fogel developed Subversion. Subversion, does not stray from CVS’s centralised client/server model. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  15. 15. A (Short) History of Source Control III In 2001 Jim Blandy and Karl Fogel developed Subversion. Subversion, does not stray from CVS’s centralised client/server model. Added features such as multi-file atomic commits and better namespace management. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  16. 16. A (Short) History of Source Control III In 2001 Jim Blandy and Karl Fogel developed Subversion. Subversion, does not stray from CVS’s centralised client/server model. Added features such as multi-file atomic commits and better namespace management. At the same time Graydon Hoare was working on Monotone. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  17. 17. A (Short) History of Source Control III In 2001 Jim Blandy and Karl Fogel developed Subversion. Subversion, does not stray from CVS’s centralised client/server model. Added features such as multi-file atomic commits and better namespace management. At the same time Graydon Hoare was working on Monotone. Featured cryptographic hashes as identifiers, and has an integral notion of ”trust” for code from different sources. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  18. 18. Distributed Version Control What is Distributed Version Control? Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  19. 19. Distributed Version Control (DVCS) Both git and Mercurial were announced in April 2005 to replace the withdrawal of free BitKeeper VC software, which was used to control the Linux kernel. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  20. 20. Distributed Version Control (DVCS) Both git and Mercurial were announced in April 2005 to replace the withdrawal of free BitKeeper VC software, which was used to control the Linux kernel. git developed by Linus Torvalds to manage the Linux kernel. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  21. 21. Distributed Version Control (DVCS) Both git and Mercurial were announced in April 2005 to replace the withdrawal of free BitKeeper VC software, which was used to control the Linux kernel. git developed by Linus Torvalds to manage the Linux kernel. Mercurial was also developed for kernel, but git won out. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  22. 22. An Example of the DVCS Model Figure: An example of the Mercurial distributed model. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  23. 23. Simple description of the DVCS model No repository is king - no ”central” repository except for one agreed in a social fashion. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  24. 24. Simple description of the DVCS model No repository is king - no ”central” repository except for one agreed in a social fashion. Can be thought of as ”the bittorrent of the DVCS world”, compaired to CVS/SVN model which is akin to a FTP. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  25. 25. Simple description of the DVCS model No repository is king - no ”central” repository except for one agreed in a social fashion. Can be thought of as ”the bittorrent of the DVCS world”, compaired to CVS/SVN model which is akin to a FTP. Cloning repositories locally allows for more experimentation. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  26. 26. Simple description of the DVCS model No repository is king - no ”central” repository except for one agreed in a social fashion. Can be thought of as ”the bittorrent of the DVCS world”, compaired to CVS/SVN model which is akin to a FTP. Cloning repositories locally allows for more experimentation. As simple to set up as typing ’hg init’. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  27. 27. Mercurial Itself Excellent support on Windows / Unix / MacOSX Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  28. 28. Mercurial Itself Excellent support on Windows / Unix / MacOSX Tools such as TortoiseHG for Windows, QCT, Push Me Pull You, etc make usage easy. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  29. 29. Mercurial Itself Excellent support on Windows / Unix / MacOSX Tools such as TortoiseHG for Windows, QCT, Push Me Pull You, etc make usage easy. Functionality can be added through an extension API with hooks (e.g. pre and post commit). Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  30. 30. Mercurial Itself Excellent support on Windows / Unix / MacOSX Tools such as TortoiseHG for Windows, QCT, Push Me Pull You, etc make usage easy. Functionality can be added through an extension API with hooks (e.g. pre and post commit). Doesn’t pollute the namespace - keeps everything in one ’.hg’ directory. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  31. 31. Mercurial Itself Excellent support on Windows / Unix / MacOSX Tools such as TortoiseHG for Windows, QCT, Push Me Pull You, etc make usage easy. Functionality can be added through an extension API with hooks (e.g. pre and post commit). Doesn’t pollute the namespace - keeps everything in one ’.hg’ directory. Provides it’s own web interface - hgweb (hgwebdir for a collection of repositories). Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  32. 32. Mercurial Commands I ’hg init <name>’ - This initialises the local repository. You can do this command within the root folder too. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  33. 33. Mercurial Commands I ’hg init <name>’ - This initialises the local repository. You can do this command within the root folder too. ’hg add’ - This will add any files within the directory structure to the local repository. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  34. 34. Mercurial Commands I ’hg init <name>’ - This initialises the local repository. You can do this command within the root folder too. ’hg add’ - This will add any files within the directory structure to the local repository. ’hg commit’ - This will commit any changes to your local repository. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  35. 35. Mercurial Commands I ’hg init <name>’ - This initialises the local repository. You can do this command within the root folder too. ’hg add’ - This will add any files within the directory structure to the local repository. ’hg commit’ - This will commit any changes to your local repository. ’hg push’ - This will push any changes to your repository. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  36. 36. Mercurial Commands II ’hg pull’ - This will pull the content to your local repository from the remote repository set in the config file. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  37. 37. Mercurial Commands II ’hg pull’ - This will pull the content to your local repository from the remote repository set in the config file. ’hg update’ - Updates and merges pulls to local repository where no heads are created (i.e. if you have made no local changes since your last pull). Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  38. 38. Mercurial Commands II ’hg pull’ - This will pull the content to your local repository from the remote repository set in the config file. ’hg update’ - Updates and merges pulls to local repository where no heads are created (i.e. if you have made no local changes since your last pull). ’hg merge’ - This will merge any heads created by pushing/pulling from repositories. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  39. 39. Mercurial Commands II ’hg pull’ - This will pull the content to your local repository from the remote repository set in the config file. ’hg update’ - Updates and merges pulls to local repository where no heads are created (i.e. if you have made no local changes since your last pull). ’hg merge’ - This will merge any heads created by pushing/pulling from repositories. ’hg log’ - View a list of changesets. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  40. 40. How Mercurial Changesets Work Figure: A example of linear changesets. This is very common in repositories from one developer and once branch. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  41. 41. Simultaneous Local Changesets Figure: Two local repositories with different changeset histories. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  42. 42. Results of pulling a changeset into your local repository. Figure: Pulling a remote repository’s tip into your local repository creates 2 heads. These need to be merged before you can continue. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  43. 43. Results of merging heads. Figure: Merging the two heads together creates a new head. This can now be pushed or pulled to other repositories and merged with other heads. Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  44. 44. Thank you for listning. Check out more about Mercurial at http://tinyurl.com/3xphcz Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  45. 45. Thank you for listning. Check out more about Mercurial at http://tinyurl.com/3xphcz SHAMELESS PLUG - Follow the progress of Mercurial Frontend at http://digitalspaghetti.me.uk Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  46. 46. Thank you for listning. Check out more about Mercurial at http://tinyurl.com/3xphcz SHAMELESS PLUG - Follow the progress of Mercurial Frontend at http://digitalspaghetti.me.uk Comments welcome at digitalspaghetti@gmail.com Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  47. 47. Thank you for listning. Check out more about Mercurial at http://tinyurl.com/3xphcz SHAMELESS PLUG - Follow the progress of Mercurial Frontend at http://digitalspaghetti.me.uk Comments welcome at digitalspaghetti@gmail.com You can download these slides from http://hg.digitalspaghetti.me.uk/hgtalk Tane Piper digitalspaghetti@gmail.com Introduction to Mercurial
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×