Online Book Reader

Home Category

Mercurial_ The Definitive Guide - Bryan O'Sullivan [114]

By Root 1026 0

svn diff hg diff

svn export hg archive

svn help hg help

svn import hg addremove; hg commit

svn info hg parents Shows what revision is checked out

svn info hg showconfig paths.parent Shows what URL is checked out

svn list hg manifest

svn log hg log

svn merge hg merge

svn mkdir n/a Mercurial does not track directories

svn move (svn rename) hg rename

svn resolved hg resolve -m

svn revert hg revert

svn status hg status

svn update hg pull -u

Useful Tips for Newcomers

Under some revision control systems, printing a diff for a single committed revision can be painful. For instance, with Subversion, to see what changed in revision 104654, you must type svn diff -r104653:104654. Mercurial eliminates the need to type the revision ID twice in this common case. For a plain diff, type hg export 104654. For a log message followed by a diff, type hg log -r104654 -p.

When you run hg status without any arguments, it prints the status of the entire tree, with paths relative to the root of the repository. This makes it tricky to copy a filename from the output of hg status into the command line. If you supply a file or directory name to hg status, it will print paths relative to your current location instead. So to get tree-wide status from hg status, with paths that are relative to your current directory and not the root of the repository, feed the output of hg root into hg status. You can easily do this as follows on a Unix-like system:

$ hg status `hg root`

Appendix B. Mercurial Queues Reference

MQ Command Reference

For an overview of the commands provided by MQ, use the command hg help mq.

qapplied—Print Applied Patches

The qapplied command prints the current stack of applied patches. Patches are printed in oldest-to-newest order, so the last patch in the list is the “top” patch.

qcommit—Commit Changes in the Queue Repository

The qcommit command commits any outstanding changes in the .hg/patches repository. This command only works if the .hg/patches directory is a repository, i.e., you created the directory using hg qinit -c or ran hg init in the directory after running qinit.

This command is shorthand for hg commit --cwd .hg/patches.

qdelete—Delete a Patch from the Series File

The qdelete command removes the entry for a patch from the series file in the .hg/patches directory. It does not pop the patch if the patch is already applied. By default, it does not delete the patch file; use the -f option to do that.

Option:

-f: Delete the patch file.

qdiff—Print a Diff of the Topmost Applied Patch

The qdiff command prints a diff of the topmost applied patch. It is equivalent to hg diff -r-2:-1.

qfold—Move Applied Patches into Repository History

The hg qfinish command converts the specified applied patches into permanent changes by moving them out of MQ’s control so that they will be treated as normal repository history.

qfold—Merge (fold) Several Patches into One

The qfold command merges multiple patches into the topmost applied patch, so that the topmost applied patch makes the union of all the changes in the patches in question.

The patches to fold must not be applied; qfold will exit with an error if this is the case. The order in which patches are folded is significant: hg qfold a b means “apply the current topmost patch, followed by a, followed by b”.

The comments from the folded patches are appended to the comments of the destination patch, with each block of comments separated by three asterisk (*) characters. Use the -e option to edit the commit message for the combined patch/changeset after the folding has completed.

Options:

-e: Edit the commit message and patch description for the newly folded patch.

-l: Use the contents of the given file as the new commit message and patch description for the folded patch.

-m: Use the given text as the new commit message and patch description for the folded patch.

qheader—Display the Header/Description of a Patch

The qheader command prints the header, or description, of a patch.

Return Main Page Previous Page Next Page

®Online Book Reader