Mercurial – Revision Control System. Overview of Revision Control Systems (IBM) Rational...

Preview:

Citation preview

Mercurial – Revision Control System

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)

Centralized vs. Distributed

Mercurial (or Hg)

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

Installing Mercurial

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

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

Changesets

Implementation: File Logs

Implementation: Snapshots and Diffs

Revlog Hierarchy

Displaying Events

• $ hg log -v -r 3 changeset: 3:0272e0d5a517 user: Bryan O'Sullivan <bos@serpentine.com> 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)

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

Collaboration Models

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

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

Backouts – A Complex Scenario