The Huge Advantage of MQ

I cannot overstate the value that MQ offers through the unification of patches and revision control.

A major reason that patches have persisted in the free software and open source world—in spite of the availability of increasingly capable revision control tools over the years—is the agility they offer.

Traditional revision control tools make a permanent, irreversible record of everything that you do. While this has great value, it’s also somewhat stifling. If you want to perform a wild-eyed experiment, you have to be careful in how you go about it, or you risk leaving unnecessary—or worse, misleading or destabilizing—traces of your missteps and errors in the permanent revision record.

By contrast, MQ’s marriage of distributed revision control with patches makes it much easier to isolate your work. Your patches live on top of normal revision history, and you can make them disappear or reappear at will. If you don’t like a patch, you can drop it. If a patch isn’t quite as you want it to be, simply fix it—as many times as you need to, until you have refined it into the form you desire.

As an example, the integration of patches with revision control makes understanding patches and debugging their effects—and their interplay with the code they’re based on—enormously easier. Since every applied patch has an associated changeset, you can give hg log a filename to see which changesets and patches affected the file. You can use the hg bisect command to binary-search ...

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.