An Introduction to Mercurial Version Control Software



Similar documents
An Introduction to Mercurial Version Control Software

Distributed Version Control with Mercurial and git

Version Control with Svn, Git and git-svn. Kate Hedstrom ARSC, UAF

Introduction to Version Control

Git Basics. Christopher Simpkins Chris Simpkins (Georgia Tech) CS 2340 Objects and Design CS / 22

1. History 2. Structure 3. Git Comparison 4. File Storage 5. File Tracking 6. Staging 7. Queues (MQ) 8. Merge Tools 9. Interfaces

Version Control with Git. Kate Hedstrom ARSC, UAF

Introduction to the Git Version Control System

Version control. with git and GitHub. Karl Broman. Biostatistics & Medical Informatics, UW Madison

Version Control with. Ben Morgan

Version Control with Mercurial and SSH

MATLAB & Git Versioning: The Very Basics

Software Version Control With Mercurial and Tortoise Hg

Version Control with Subversion

Version control with GIT

Version Control with Git. Dylan Nugent

Version Control with Git. Linux Users Group UT Arlington. Rohit Rawat

Introduction to Git. Markus Kötter Notes. Leinelab Workshop July 28, 2015

Version Control Systems

Source Control Systems

CPSC 491. Today: Source code control. Source Code (Version) Control. Exercise: g., no git, subversion, cvs, etc.)

CISC 275: Introduction to Software Engineering. Lab 5: Introduction to Revision Control with. Charlie Greenbacker University of Delaware Fall 2011

Using Git for Project Management with µvision

Annoyances with our current source control Can it get more comfortable? Git Appendix. Git vs Subversion. Andrey Kotlarski 13.XII.

Mercurial. Why version control (Single users)

Version control. HEAD is the name of the latest revision in the repository. It can be used in subversion rather than the latest revision number.

Version Control. Version Control

Version Control Script

Advanced Computing Tools for Applied Research Chapter 4. Version control

Data management on HPC platforms

Continuous Integration. CSC 440: Software Engineering Slide #1

Two Best Practices for Scientific Computing

CSE 374 Programming Concepts & Tools. Laura Campbell (Thanks to Hal Perkins) Winter 2014 Lecture 16 Version control and svn

CS 2112 Lab: Version Control

FEEG Applied Programming 3 - Version Control and Git II

Version Control with Git

Lab Exercise Part II: Git: A distributed version control system

Introduction to Version Control with Git

Using GitHub for Rally Apps (Mac Version)

Using SVN to Manage Source RTL

MOOSE-Based Application Development on GitLab

Distributed Version Control

Putting It All Together. Vagrant Drush Version Control

Introduc)on to Version Control with Git. Pradeep Sivakumar, PhD Sr. Computa5onal Specialist Research Compu5ng, NUIT

Content. Development Tools 2(63)

Version Control using Git and Github. Joseph Rivera

Introduction to Subversion

Derived from Chris Cannam's original at, an.

Git Basics. Christian Hanser. Institute for Applied Information Processing and Communications Graz University of Technology. 6.

Version Control Systems: SVN and GIT. How do VCS support SW development teams?

Work. MATLAB Source Control Using Git

Version Control Tutorial using TortoiseSVN and. TortoiseGit

Git. A Distributed Version Control System. Carlos García Campos carlosgc@gsyc.es

Using Git for Centralized and Distributed Version Control Workflows - Day 3. 1 April, 2016 Presenter: Brian Vanderwende

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger

Integrated version control with Fossil SCM

Using SVN to Manage Source RTL

VFP Version Control with Mercurial

Introduction to Software Engineering (2+1 SWS) Winter Term 2009 / 2010 Dr. Michael Eichberg Vertretungsprofessur Software Engineering Department of

Git - Working with Remote Repositories

Software Configuration Management. Slides derived from Dr. Sara Stoecklin s notes and various web sources.

CSCB07 Software Design Version Control

Version control with Subversion

SVN Starter s Guide Compiled by Pearl Guterman June 2005

Source code management systems

CS108, Stanford Handout #33. CVS in Eclipse

Software Engineering Practices for Python

Version Control with Subversion

Introduction to Version Control with Git

Version Control for Computational Economists: An Introduction

Source Code Management/Version Control

The Hitchhiker s Guide to Github: SAS Programming Goes Social Jiangtang Hu d-wise Technologies, Inc., Morrisville, NC

Introducing Xcode Source Control

Using Subversion in Computer Science

Version Control Tools

Modulo II Software Configuration Management - SCM

Version Control! Scenarios, Working with Git!

Revision control systems (RCS) and

Zero-Touch Drupal Deployment

Version Control with Subversion and Xcode

Software Configuration Management and Continuous Integration

Intro etckeeper bup ikiwiki git-annex vcsh mr Zsh Outro. Gitify your life. web, blog, configs, data, and backups

A Git Development Environment

Working Copy 1.4 users manual

Version Uncontrolled! : How to Manage Your Version Control

Git Fusion Guide August 2015 Update

Software configuration management

Version Control Using Subversion. Version Control Using Subversion 1 / 27

Transcription:

An Introduction to Mercurial Version Control Software CS595, IIT [Doc Updated by H. Zhang] Oct, 2010 Satish Balay balay@mcs.anl.gov

Outline Why use version control? Simple example of revisioning Mercurial introduction - Local usage - Remote usage - Normal user workflow - Organizing repositories [clones] Further Information [Demo]

What do we use Version Control for? Keep track of changes to files Enable multiple users editing files simultaneously Go back and check old changes: * what was the change * when was the change made * who made the change * why was the change made Manage branches [release versions vs development]

Simple Example of Revisioning File Changes main.c File Version 0 1 2 3 Delta

Simple Example Cont. main.c 0 1 2 3 makefile main.c 0 1 Repository Version -1 0 1 2 3 Changeset

Concurrent Changes to a File by Multiple Users & Subsequent Merge of Changes Line1 Line2 Line3 Line4 Line1 UserA Line2 Line3 Line4 Line1 Line2 Line3 UserB Line4 Line1 UserA Line2 Line3 UserB Line4 Initial file UserA edit UserB edit Merge edits by both users r-1 Branch r-2 Merge r-4 Merge tools: kdiff3 meld Merge types: 2-way 3-way Revision Graph r-3

Some Definitions Delta: a single change [to a file] Changeset: a collection of deltas [perhaps to multiple files] that are collectively tracked. This captures a snapshot of the current state of the files [as a revision] Branch: Concurrent development paths for the same sources Merge: Joining changes done in multiple branches into a single path. Repository: collection of files we intend to keep track of. This includes the revision graph/history [or metadata] Version [or Source] Control Tool: Enables us to keep track of all the changes [to all files] in a repository

Version Control Tools File Level Control SCCS RCS Centralized [or Client/Server] CVS Subversion Distributed Mercurial Git http://en.wikipedia.org/wiki/list_of_revision_control_software

Mercurial Distributed version control tool. Open Source [GPL] Started by Matt Mackall in 2005, has many contributors Written in python Works on Linux, Windows, OS X and other systems. Reasonably efficient [handles 10,000+ changesets in PETSc] Active mailing list: mercurial@selenic.com http://www.selenic.com/mercurial

Usage: Creating a Repository mkdir project cd project hg init Initializes the directory 'project' as a mercurial repo. It is currently an empty repository [i.e no files added] All 'hg' commands are invoked inside the repository All commands are in the form 'hg command'. For example : hg help Stores metadata in the subdirectory project/.hg

Usage: Adding/Modifying Files cd project touch main.c [create or edit a file] hg add main.c hg commit emacs main.c [edits to file] hg commit [recommend alternative: hg qct ] 'add' indicates the file is now part of the repository. 'commit' creates a changeset for the current changes. [prompts the user to enter comments] Note: use hg commit -A to add/commit all new files

Illustration of Changes repository file changes repository workingmetadata files [.hg/ ] hg commit repository changeset Revision Graph View [Metadata] Parent version of working files Working files

Repository Data vs Working Files Repository data is the revision history and graph of all the changes. Its stored in project/.hg directory Working files are the reset of the files in project. User edits the working files. hg tip [show the tip revision of the repository graph] hg parent [show the parent revision of the working dir] Note: Working files can correspond to any revision of the repository. So one has to be careful about this point [and not assume the parent is always the tip revision] hg update REV [update working copy to REV version]

Checking Status/History hg status [list the current modified, unknown files] hg diff [list the diff of the changed files in patch form] hg log [list the revision history of all changes] hg view [extension: GUI tool to check changeset graph] hg qct [external: GUI tool to check and commit changes] Note: So far we have covered local operations on the repository

Distributed Model Information flows between repositories as changesets. Each operation is between two repositories [metadata]. hg clone /home/balay/repoa repob cd repob [Local repository to invoke commands] hg pull [repoa] [get remote changesets and apply locally] hg push [repoa] [apply local changesets to the remote repo] Notes: Every clone repository has complete revision history [metadata]. Peer to peer: all copies of repositories are equivalent. One can switch roles of repoa & repob. Remote operations are between repositories [as opposed to local operations discussed in the previous slides]

hg help pull URLs/ Communication Mechanism /home/balay/petsc-dev [documentation of urls] ssh://petsc@petsc.cs.iit.edu//hg/petsc/petsc-dev http://petsc.cs.iit.edu/petsc/petsc-dev [readonly] http-old://www.mcs.anl.gov/~petsc/project [readonly] https:// [read/write support] Notes: 'hg clone' stores the URL for remote repository [in.hg/hgrc]. When push/pull operations are invoked, default URL is used. Require [remote] read access for pull, write access for push. Email changesets via 'hg bundle' [if necessary].

Organizing Repositories [clones] Any to Any Methods of communicating changes clone/push/pull [changesets] import/export [email patch] bundle/unbundle [email changesets] Shared Common The relations are not hardcoded

Syncing Two Repositories with Changesets to Remote Repository repository-local working files metadata Remote repo has extra changesets repository-remote repository-local hg pull repository-remote repository-local hg update repository-remote

Syncing Two Repositories with Changesets to Local Repository repository-remote working files metadata Local repo has extra changesets repository-local repository-remote hg push repository-local Updating Working copy of remote is not done.

Syncing Two Repositories with Changesets to both Repositories repository-local A working metadata files Both repos have extra changesets repository-remote B Revision Graph Change [Local Repository] A Initial repository-local A B hg pull repository-remote B Initial A B repository-local A B hg merge repository-remote B Normally working files have 1 parent, but in the merge process, they have 2 parents. repository-local A+B A B hg commit repository-remote B Initial A B A+B repository-local A+B A B hg push repository-remote A+B A B A: local repo changeset B: remote repo changeset A+B: merge changeset

Normal User Work Flow: [Making local changes and updating Shared Common Repository] <make changes to working files> hg commit [commit local changes] hg pull [check & obtain remote changes] hg merge [if remote changes exist, auto merge. Or a manual merge via external tool like kdiff3] hg commit [commit the merge changeset] hg push [push local changesets + merge changesets to the remote repository] Note: Merge is always done in the local repository [hence the order: pull, merge, push]

Qct: Graphical Commit Tool Helps reviewing changes before commiting. hg qct Equivalent to the following normal work flow hg status hg diff hg commit External tool from http://qct.sourceforge.net/ It requires PyQt4.

Multiple Users: Communicating Changesets using a Shared Repository Shared repository shared read only, via http read/write via ssh external-user user1-clone User Clone Repos user2-clone user3-clone temp-clone-1 temp-clone-2

Managing Patches to Release Versions Shared Repos dev-shared release-shared 2. Pull/Merge/Push to shared release repo 4. Pull/Merge/Push to shared dev repo 1. Apply fix User Clone Repos dev-clone release-clone 3. Pull/merge [from dev-clone]

Browsing changes hg view hg log hg annotate filename [REV] hg update [REV] hg serv [starts a web server] Use a web browser to browse changes

Mercurial at ada.cs.iit.edu mercurial 1.6.2 is installed on the linux machine Further Information http://www.selenic.com/mercurial/ http://hgbook.red-bean.com/hgbook.html mercurial@selenic.com