Sending Changes via Email with the patchbomb Extension

Many projects have a culture of change review, in which people send their modifications to a mailing list for others to read and comment on before they commit the final version to a shared repository. Some projects have people who act as gatekeepers; they apply changes from other people to a repository to which those others don’t have access.

Mercurial makes it easy to send changes over email for review or application, via its patchbomb extension. The extension is so named because changes are formatted as patches, and it’s usual to send one changeset per email message. Sending a long series of changes by email is thus much like bombing the recipient’s inbox, hence patchbomb.

As usual, the basic configuration of the patchbomb extension takes just one or two lines in your /.hgrc.

[extensions]
patchbomb =

Once you’ve enabled the extension, you will have a new command available, named email.

The safest and best way to invoke the email command is to always run it first with the hg -n option. This will show you what the command would send, without actually sending anything. Once you’ve had a quick glance over the changes and verified that you are sending the right ones, you can rerun the same command, with the hg -n option removed.

The email command accepts the same kind of revision syntax as every other Mercurial command. For example, this command will send every revision between 7 and tip, inclusive.

hg email -n 7:tip

You can also ...

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.