Contents

Contents
Preface
 0.1 This book is a work in progress
 0.2 About the examples in this book
 0.3 Colophon—this book is Free
1 Introduction
 1.1 About revision control
  1.1.1 Why use revision control?
  1.1.2 The many names of revision control
 1.2 A short history of revision control
 1.3 Trends in revision control
 1.4 A few of the advantages of distributed revision control
  1.4.1 Advantages for open source projects
  1.4.2 Advantages for commercial projects
 1.5 Why choose Mercurial?
 1.6 Mercurial compared with other tools
  1.6.1 Subversion
  1.6.2 Git
  1.6.3 CVS
  1.6.4 Commercial tools
2 A tour of Mercurial: the basics
 2.1 Installing Mercurial on your system
  2.1.1 Linux
  2.1.2 Mac OS X
  2.1.3 Solaris
  2.1.4 Windows
 2.2 Getting started
  2.2.1 Built-in help
 2.3 Working with a repository
  2.3.1 Making a local copy of a repository
  2.3.2 What’s in a repository?
 2.4 A tour through history
  2.4.1 Changesets, revisions, and talking to other people
  2.4.2 Viewing specific revisions
  2.4.3 More detailed information
 2.5 All about command options
 2.6 Making and reviewing changes
 2.7 Recording changes in a new changeset
  2.7.1 Setting up a username
  2.7.2 Writing a commit message
  2.7.3 Writing a good commit message
  2.7.4 Aborting a commit
  2.7.5 Admiring our new handiwork
 2.8 Sharing changes
  2.8.1 Pulling changes from another repository
  2.8.2 Updating the working directory
  2.8.3 Pushing changes to another repository
  2.8.4 Sharing changes over a network
3 A tour of Mercurial: merging work
 3.1 Merging streams of work
  3.1.1 Head changesets
  3.1.2 Performing the merge
  3.1.3 Committing the results of the merge
 3.2 Merging conflicting changes
  3.2.1 Using a graphical merge tool
  3.2.2 A worked example
 3.3 Simplifying the pull-merge-commit sequence
4 Behind the scenes
 4.1 Mercurial’s historical record
  4.1.1 Tracking the history of a single file
  4.1.2 Managing tracked files
  4.1.3 Recording changeset information
  4.1.4 Relationships between revisions
 4.2 Safe, efficient storage
  4.2.1 Efficient storage
  4.2.2 Safe operation
  4.2.3 Fast retrieval
  4.2.4 Identification and strong integrity
 4.3 Revision history, branching, and merging
 4.4 The working directory
  4.4.1 What happens when you commit
  4.4.2 Creating a new head
  4.4.3 Merging heads
 4.5 Other interesting design features
  4.5.1 Clever compression
  4.5.2 Read/write ordering and atomicity
  4.5.3 Concurrent access
  4.5.4 Avoiding seeks
  4.5.5 Other contents of the dirstate
5 Mercurial in daily use
 5.1 Telling Mercurial which files to track
  5.1.1 Explicit versus implicit file naming
  5.1.2 Aside: Mercurial tracks files, not directories
 5.2 How to stop tracking a file
  5.2.1 Removing a file does not affect its history
  5.2.2 Missing files
  5.2.3 Aside: why tell Mercurial explicitly to remove a file?
  5.2.4 Useful shorthand—adding and removing files in one step
 5.3 Copying files
  5.3.1 The results of copying during a merge
  5.3.2 Why should changes follow copies?
  5.3.3 How to make changes not follow a copy
  5.3.4 Behaviour of the “hg copy” command
 5.4 Renaming files
  5.4.1 Renaming files and merging changes
  5.4.2 Divergent renames and merging
  5.4.3 Convergent renames and merging
  5.4.4 Other name-related corner cases
 5.5 Recovering from mistakes
6 Collaborating with other people
 6.1 Mercurial’s web interface
 6.2 Collaboration models
  6.2.1 Factors to keep in mind
  6.2.2 Informal anarchy
  6.2.3 A single central repository
  6.2.4 Working with multiple branches
  6.2.5 Feature branches
  6.2.6 The release train
  6.2.7 The Linux kernel model
  6.2.8 Pull-only versus shared-push collaboration
  6.2.9 Where collaboration meets branch management
 6.3 The technical side of sharing
 6.4 Informal sharing with “hg serve
  6.4.1 A few things to keep in mind
 6.5 Using the Secure Shell (ssh) protocol
  6.5.1 How to read and write ssh URLs
  6.5.2 Finding an ssh client for your system
  6.5.3 Generating a key pair
  6.5.4 Using an authentication agent
  6.5.5 Configuring the server side properly
  6.5.6 Using compression with ssh
 6.6 Serving over HTTP using CGI
  6.6.1 Web server configuration checklist
  6.6.2 Basic CGI configuration
  6.6.3 Sharing multiple repositories with one CGI script
  6.6.4 Downloading source archives
  6.6.5 Web configuration options
7 File names and pattern matching
 7.1 Simple file naming
 7.2 Running commands without any file names
 7.3 Telling you what’s going on
 7.4 Using patterns to identify files
  7.4.1 Shell-style glob patterns
  7.4.2 Regular expression matching with re patterns
 7.5 Filtering files
 7.6 Ignoring unwanted files and directories
 7.7 Case sensitivity
  7.7.1 Safe, portable repository storage
  7.7.2 Detecting case conflicts
  7.7.3 Fixing a case conflict
8 Managing releases and branchy development
 8.1 Giving a persistent name to a revision
  8.1.1 Handling tag conflicts during a merge
  8.1.2 Tags and cloning
  8.1.3 When permanent tags are too much
 8.2 The flow of changes—big picture vs. little
 8.3 Managing big-picture branches in repositories
 8.4 Don’t repeat yourself: merging across branches
 8.5 Naming branches within one repository
 8.6 Dealing with multiple named branches in a repository
 8.7 Branch names and merging
 8.8 Branch naming is generally useful
9 Finding and fixing your mistakes
 9.1 Erasing local history
  9.1.1 The accidental commit
  9.1.2 Rolling back a transaction
  9.1.3 The erroneous pull
  9.1.4 Rolling back is useless once you’ve pushed
  9.1.5 You can only roll back once
 9.2 Reverting the mistaken change
  9.2.1 File management errors
 9.3 Dealing with committed changes
  9.3.1 Backing out a changeset
  9.3.2 Backing out the tip changeset
  9.3.3 Backing out a non-tip change
  9.3.4 Gaining more control of the backout process
  9.3.5 Why “hg backout” works as it does
 9.4 Changes that should never have been
  9.4.1 Protect yourself from “escaped” changes
 9.5 Finding the source of a bug
  9.5.1 Using the bisect extension
  9.5.2 Cleaning up after your search
 9.6 Tips for finding bugs effectively
  9.6.1 Give consistent input
  9.6.2 Automate as much as possible
  9.6.3 Check your results
  9.6.4 Beware interference between bugs
  9.6.5 Bracket your search lazily
10 Handling repository events with hooks
 10.1 An overview of hooks in Mercurial
 10.2 Hooks and security
  10.2.1 Hooks are run with your privileges
  10.2.2 Hooks do not propagate
  10.2.3 Hooks can be overridden
  10.2.4 Ensuring that critical hooks are run
 10.3 Care with pretxn hooks in a shared-access repository
  10.3.1 The problem illustrated
 10.4 A short tutorial on using hooks
  10.4.1 Performing multiple actions per event
  10.4.2 Controlling whether an activity can proceed
 10.5 Writing your own hooks
  10.5.1 Choosing how your hook should run
  10.5.2 Hook parameters
  10.5.3 Hook return values and activity control
  10.5.4 Writing an external hook
  10.5.5 Telling Mercurial to use an in-process hook
  10.5.6 Writing an in-process hook
 10.6 Some hook examples
  10.6.1 Writing meaningful commit messages
  10.6.2 Checking for trailing whitespace
 10.7 Bundled hooks
  10.7.1 acl—access control for parts of a repository
  10.7.2 bugzilla—integration with Bugzilla
  10.7.3 notify—send email notifications
 10.8 Information for writers of hooks
  10.8.1 In-process hook execution
  10.8.2 External hook execution
  10.8.3 Finding out where changesets come from
 10.9 Hook reference
  10.9.1 changegroup—after remote changesets added
  10.9.2 commit—after a new changeset is created
  10.9.3 incoming—after one remote changeset is added
  10.9.4 outgoing—after changesets are propagated
  10.9.5 prechangegroup—before starting to add remote changesets
  10.9.6 precommit—before starting to commit a changeset
  10.9.7 preoutgoing—before starting to propagate changesets
  10.9.8 pretag—before tagging a changeset
  10.9.9 pretxnchangegroup—before completing addition of remote changesets
  10.9.10 pretxncommit—before completing commit of new changeset
  10.9.11 preupdate—before updating or merging working directory
  10.9.12 tag—after tagging a changeset
  10.9.13 update—after updating or merging working directory
11 Customising the output of Mercurial
 11.1 Using precanned output styles
  11.1.1 Setting a default style
 11.2 Commands that support styles and templates
 11.3 The basics of templating
 11.4 Common template keywords
 11.5 Escape sequences
 11.6 Filtering keywords to change their results
  11.6.1 Combining filters
 11.7 From templates to styles
  11.7.1 The simplest of style files
  11.7.2 Style file syntax
 11.8 Style files by example
  11.8.1 Identifying mistakes in style files
  11.8.2 Uniquely identifying a repository
  11.8.3 Mimicking Subversion’s output
12 Managing change with Mercurial Queues
 12.1 パッチ
 12.2 Mercurial Queues
  12.2.1 A patchwork quilt ぎはぎの
  12.2.2 patchwork quilt から Mercurial Queues
 12.3 MQ きな
 12.4 パッチ
 12.5 Mercurial Queues 利用
  12.5.1 しいパッチ
  12.5.2 パッチrefresh
  12.5.3 パッチねと
  12.5.4 パッチねの
  12.5.5 パッチ(push) および(pop)
  12.5.6 とその
  12.5.7 パッチ
 12.6 パッチしてしく
  12.6.1
  12.6.2 パッチ
  12.6.3 パッチ
  12.6.4 あいまいさに
  12.6.5 された hunk
 12.7 MQ 最高すために
 12.8 パッチ
 12.9 パッチ
 12.10 っておくと便
 12.11 リポジトリにおけるパッチ
  12.11.1 MQ パッチリポジトリサポ
  12.11.2 つかの
 12.12 パッチのためのドパティ
 12.13 パッチ方法
 12.14 MQ クックブック
  12.14.1 些細パッチ
  12.14.2 パッチ全体
  12.14.3 パッチパッチへの
 12.15 quilt MQ
13 Advanced uses of Mercurial Queues
 13.1 The problem of many targets
  13.1.1 Tempting approaches that don’t work well
 13.2 によるパッチ
 13.3 パッチする
 13.4 使する選択
 13.5 MQ パッチ
 13.6 Trimming the work environment
 13.7 Dividing up the series file
 13.8 Maintaining the patch series
  13.8.1 The art of writing backport patches
 13.9 Useful tips for developing with MQ
  13.9.1 Organising patches in directories
  13.9.2 Viewing the history of a patch
14 Adding functionality with extensions
 14.1 Improve performance with the inotify extension
 14.2 Flexible diff support with the extdiff extension
  14.2.1 Defining command aliases
 14.3 Cherrypicking changes with the transplant extension
 14.4 Send changes via email with the patchbomb extension
  14.4.1 Changing the behaviour of patchbombs
A Installing Mercurial from source
 A.1 On a Unix-like system
 A.2 On Windows
B Open Publication License
 B.1 Requirements on both unmodified and modified versions
 B.2 Copyright
 B.3 Scope of license
 B.4 Requirements on modified works
 B.5 Good-practice recommendations
 B.6 License options
Bibliography
Index