mq extension#
manage a stack of patches
This extension lets you work with a stack of patches in a Mercurial repository. It manages two stacks of patches - all known patches, and applied patches (subset of known patches).
Known patches are represented as patch files in the .hg/patches directory. Applied patches are both patch files and changesets.
Common tasks (use `hg help COMMAND` for more details):
create new patch qnew
import existing patch qimport
print patch series qseries
print applied patches qapplied
add known patch to applied stack qpush
remove patch from applied stack qpop
refresh contents of top applied patch qrefresh
By default, mq will automatically use git patches when required to avoid losing file mode changes, copy records, binary files or empty files creations or deletions. This behavior can be configured with:
[mq]
git = auto/keep/yes/no
If set to 'keep', mq will obey the [diff] section configuration while preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq will override the [diff] section and always generate git or regular patches, possibly losing data in the second case.
It may be desirable for mq changesets to be kept in the secret phase (see `hg help phases`), which can be enabled with the following setting:
[mq]
secret = True
You will by default be managing a patch queue named "patches". You can create other, independent patch queues with the `hg qqueue` command.
If the working directory contains uncommitted files, qpush, qpop and qgoto abort immediately. If -f/--force is used, the changes are discarded. Setting:
[mq]
keepchanges = True
make them behave as if --keep-changes were passed, and non-conflicting local changes will be tolerated and preserved. If incompatible options such as -f/--force or --exact are passed, this setting is ignored.
This extension used to provide a strip command. This command now lives in the strip extension.
Commands
qapplied: print the patches already applied
qclone: clone main and patch repository at same time
qcommit: commit changes in the queue repository (DEPRECATED)
qdelete: remove patches from queue
qdiff: diff of the current patch and subsequent modifications
qfinish: move applied patches into repository history
qfold: fold the named patches into the current patch
qgoto: push or pop patches until named patch is at top of stack
qguard: set or print guards for a patch
qheader: print the header of the topmost or specified patch
qimport: import a patch or existing changeset
qinit: init a new queue repository (DEPRECATED)
qnew: create a new patch
qnext: print the name of the next pushable patch
qpop: pop the current patch off the stack
qprev: print the name of the preceding applied patch
qpush: push the next patch onto the stack
qqueue: manage multiple patch queues
qrefresh: update the current patch
qrename: rename a patch
qrestore: restore the queue state saved by a revision (DEPRECATED)
qsave: save current queue state (DEPRECATED)
qselect: set or print guarded patches to push
qseries: print the entire series file
qtop: print the name of the current patch
qunapplied: print the patches not yet applied