mercurial – revision control system. overview of revision control systems (ibm) rational...

15
Mercurial – Revision Control System

Upload: philip-gardner

Post on 04-Jan-2016

217 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Mercurial – Revision Control System. Overview of Revision Control Systems (IBM) Rational ClearQuest Perforce Centralized systems – CVS, Subversion/SVN

Mercurial – Revision Control System

Page 2: Mercurial – Revision Control System. Overview of Revision Control Systems (IBM) Rational ClearQuest Perforce Centralized systems – CVS, Subversion/SVN

Overview of Revision Control Systems

• (IBM) Rational ClearQuest• Perforce• Centralized systems – CVS, Subversion/SVN • Distributed systems – GIT, Mercurial• (Also Microsoft systems – MS Visual Source

Safe, Visual Studio Team System)

Page 3: Mercurial – Revision Control System. Overview of Revision Control Systems (IBM) Rational ClearQuest Perforce Centralized systems – CVS, Subversion/SVN

Centralized vs. Distributed

Page 4: Mercurial – Revision Control System. Overview of Revision Control Systems (IBM) Rational ClearQuest Perforce Centralized systems – CVS, Subversion/SVN

Mercurial (or Hg)

• Key features– distributed– computationally efficient– works over HTTP– open source– hosted also on code.google.com

Page 5: Mercurial – Revision Control System. Overview of Revision Control Systems (IBM) Rational ClearQuest Perforce Centralized systems – CVS, Subversion/SVN

Installing Mercurial

• WindowsXP – TortoiseHg • Ubuntu/Debian – apt-get install mercurial• Fedora/CentOS – yum install mercurial• Eclipse plugins??

Page 6: Mercurial – Revision Control System. Overview of Revision Control Systems (IBM) Rational ClearQuest Perforce Centralized systems – CVS, Subversion/SVN

Some commands

• hg init (empty repository)• hg clone http://hg.serpentine.com/tutorial/hello

(similar to physical copy)• hg log (read commit history and comments by

users)• hg log -r 3 (What was done for revision number 3)• hg status (which files are modified locally, merge

conflicts, etc.)• hg pull• hg commit

Page 7: Mercurial – Revision Control System. Overview of Revision Control Systems (IBM) Rational ClearQuest Perforce Centralized systems – CVS, Subversion/SVN

Changesets

Page 8: Mercurial – Revision Control System. Overview of Revision Control Systems (IBM) Rational ClearQuest Perforce Centralized systems – CVS, Subversion/SVN

Implementation: File Logs

Page 9: Mercurial – Revision Control System. Overview of Revision Control Systems (IBM) Rational ClearQuest Perforce Centralized systems – CVS, Subversion/SVN

Implementation: Snapshots and Diffs

Page 10: Mercurial – Revision Control System. Overview of Revision Control Systems (IBM) Rational ClearQuest Perforce Centralized systems – CVS, Subversion/SVN

Revlog Hierarchy

Page 11: Mercurial – Revision Control System. Overview of Revision Control Systems (IBM) Rational ClearQuest Perforce Centralized systems – CVS, Subversion/SVN

Displaying Events

• $ hg log -v -r 3 changeset: 3:0272e0d5a517 user: Bryan O'Sullivan <[email protected]> date: Sat Aug 16 22:08:02 2008 +0200 files: Makefile description: Get make to generate the final binary from a .o file.

• hg log -v -p -r 2(-p is “patch option” that displays diff-files)

Page 12: Mercurial – Revision Control System. Overview of Revision Control Systems (IBM) Rational ClearQuest Perforce Centralized systems – CVS, Subversion/SVN

diff and patch• $ echo 'this is my original thought' > oldfile • $ echo 'i have changed my mind' > newfile • $ diff -u oldfile newfile > tiny.patch • $ cat tiny.patch

--- oldfile 2009-05-05 06:44:39.554480179 +0000 +++ newfile 2009-05-05 06:44:39.554480179 +0000 @@ -1 +1 @@ -this is my original thought +i have changed my mind

• $ patch < tiny.patch patching file oldfile

• $ cat oldfile i have changed my mind

Page 13: Mercurial – Revision Control System. Overview of Revision Control Systems (IBM) Rational ClearQuest Perforce Centralized systems – CVS, Subversion/SVN

Collaboration Models

• Anarchy• Single Central Repository• Multiple Branches• Feature Branches• Release Train• Linux Kernel – use case

Page 14: Mercurial – Revision Control System. Overview of Revision Control Systems (IBM) Rational ClearQuest Perforce Centralized systems – CVS, Subversion/SVN

Backouts• hg backout -m 'back out second change' tip

Page 15: Mercurial – Revision Control System. Overview of Revision Control Systems (IBM) Rational ClearQuest Perforce Centralized systems – CVS, Subversion/SVN

Backouts – A Complex Scenario