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.


  • -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 ...

Get Mercurial: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.