Useful Tips for Developing with MQ

Organizing Patches in Directories

If you’re working on a substantial project with MQ, it’s not difficult to accumulate a large number of patches. For example, I have one patch repository that contains over 250 patches.

If you can group these patches into separate logical categories, you can store them in different directories if you like; MQ has no problems with patch names that contain path separators.

Viewing the History of a Patch

If you’re developing a set of patches over a long time, it’s a good idea to maintain them in a repository, as discussed in Managing Patches in a Repository. If you do so, you’ll quickly discover that using the hg diff command to look at the history of changes to a patch is unworkable. This is in part because you’re looking at the second derivative of the real code (a diff of a diff), but also because MQ adds noise to the process by modifying timestamps and directory names when it updates a patch.

However, you can use the extdiff extension, which is bundled with Mercurial, to turn a diff of two versions of a patch into something readable. To do this, you will need a third-party package called patchutils. This provides a command named interdiff, which shows the differences between two diffs as a diff. Used on two versions of the same diff, it generates a diff that represents the diff from the first to the second version.

You can enable the extdiff extension in the usual way, by adding a line to the extensions section of your ...

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.