Mecurial.inifile for Windows or the
$HOME/.hgrcfile for Linux and macOS:
gitline. This allows changing binary files in your patches. The
unifiedline give 8 lines patch.
hg qnew -m "Bug ###### - fixing something amazing" patch-name. Let's quickly analyze this command:
qnewis the command to initial a new patch.
-mis the command that allows you to write a commit message.
"Bug ###### - fixing something amazing"is the format we recommend using for the commit message, specifying the number of the Bug you're working on and a small description stating what you fixed.
patch-nameis, obviously, the name of your patch, and that can be anything.
.hg/patchesdirectory under the repository.
hg qrefreshcommand in order to update your current patch with the latest changes. Do a
hg diffbefore you issue
hg qefreshto see which changes will be added to your patch. If you use multiple patches (see section below), it may be a good idea to do a
hg qseriesto make sure the right patch is on top. Otherwise the changes will be added to the wrong patch.
hg qdiff. All the diffs will be listed in your terminal.
hg qdifftake a
-wargument to ignore white-space in case you reindented blocks and it's hard to see the net changes.
hg qpop -ato "pop" all your patches and revert the code base to its original status.
hg pull -uto pull all the recent changes from upstream.
hg qpushto apply once again your patch. Trigger this command as many times as you need in order to apply all the patches in sequence.
qrefreshcommand will only update the code to the patch at the top of you series.
hg qseriescommand to visualize a list of currently applied patches and their order.
hg qpush --move. For example:
filenameis used as the patch-name. You can directly import a Bugzilla patch by using the Bugzilla attachment URL as the argument. In that case you may also want to use
-n patch-nameto specify the patch name.
qimportbzextension installed, you can also import by specifying a bug number:
hg export qtip > ~/bug-123456-fix.patchis not necessary since all the patches reside in the
.hg/patchesdirectory in your repository.
hg qseries. If that looks right, do a
hg diffto see the latest changes which aren't in your patch yet. You can either add them to the patch using
hg qrefreshor remove them with
hg revert --all. Your best friend is the
hg outcommand, it shows all the changesets you have locally which aren't pushed to the repository yet. If for some reason you committed a patch to push it (using
hg qfinish), an action that only the sheriff does, or accidentally used
hg importinstead of
hg outwill show changes that are not controlled by patches in a MQ. In this case you can strip all changeset
hg outshows using
hg strip -rwith the lowest revision shown. After that, do
hg update -C default.
hg qref, etc.
hg qdeleteor rename them with
hg qrename. If you decide to combine patches, there is
hg qfold, that will merge the first unapplied patch into the patch at the tip of your apply queue. Use with care since the merged patch will be removed and the applied patch will be irreversibly changed.