Mercurial: The Definitive Guide
Format: PDF / Kindle (mobi) / ePub
This instructive book takes you step by step through ways to track, merge, and manage both open source and commercial software projects with Mercurial, using Windows, Mac OS X, Linux, Solaris, and other systems. Mercurial is the easiest system to learn when it comes to distributed revision control. And it's a very flexible tool that's ideal whether you're a lone programmer working on a small project, or part of a huge team dealing with thousands of files.
Mercurial permits a countless variety of development and collaboration methods, and this book offers several concrete suggestions to get you started. This guide will help you:
- Learn the basics of working with a repository, changesets, and revisions
- Merge changes from separate repositories
- Set up Mercurial to work with files on a daily basis, including which ones to track
- Get examples and tools for setting up various workflow models
- Manage a project that's making progress on multiple fronts at once
- Find and fix mistakes by isolating problem sources
- Use hooks to perform actions automatically in response to repository events
- Customize the output of Mercurial
Mercurial: The Definitive Guide maintains a strong focus on simplicity to help you learn Mercurial quickly and thoroughly.
built-in command that Mercurial provides. This command is called hg clone, because it makes an identical copy of an existing repository. $ hg clone http://hg.serpentine.com/tutorial/hello destination directory: hello requesting all changes adding changesets adding manifests adding file changes added 5 changesets with 5 changes to 2 files updating working directory 2 files updated, 0 files merged, 0 files removed, 0 files unresolved One advantage of using hg clone is that, as we can see above, it
conflict left updating working directory 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg clone conflict right updating working directory 1 files updated, 0 files merged, 0 files removed, 0 files unresolved In one clone, we’ll modify the file in one way. $ cd left $ echo left >> myfile.txt $ hg ci -m left In another, we’ll modify the file differently. $ cd ../right $ echo right >> myfile.txt $ hg ci -m right Dealing with Tricky Merges | 71 Next, we’ll pull each set
authorized keys for whatever user you’re logging in remotely as. For servers using OpenSSH (the vast majority), this will mean adding the public key to a list in a file called authorized_keys in their .ssh directory. On a Unix-like system, your public key will have a .pub extension. If you’re using puttygen on Windows, you can save the public key to a file of your choosing, or paste it from the window it’s displayed in straight into the authorized_keys file. Using an Authentication Agent An
provides an important safeguard against bad merges by refusing to commit unresolved files, but human ingenuity guarantees that it is still possible to mess a merge up and commit it. Given a bad merge that has been committed, usually the best way to approach it is to simply try to repair the damage by hand. A complete disaster that cannot be easily fixed up by hand ought to be very rare, but the hg backout command may help in making the cleanup easier. It offers a --parent option, which lets you
28 29 30 30 31 3. A Tour of Mercurial: Merging Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Merging Streams of Work Head Changesets Performing the Merge Committing the Results of the Merge Merging Conflicting Changes Using a Graphical Merge Tool A Worked Example Simplifying the Pull-Merge-Commit Sequence Renaming, Copying, and Merging 33 34 35 37 38 38 40 42 43 4. Behind the Scenes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .