Merging MQ Patches with Rebase

posted by Steve Losh on February 11, 2010

First of all: I want to try something new with this tip. This is the first tip that includes a screencast. It’s a complex topic and I think a screencast is the best way to talk about it. Please post a comment and let me know if you like it or if you think hgtip should stick to text-only tips!

This tip is for those of you that are familiar and comfortable with using MQ to handle patches. If you use MQ regularly you may have noticed some problems. One of the biggest problems appears when you have some patches and someone else commits something that changes the files you’re working on.

The normal workflow is to pull their changes, qpop your patches, update to the new repository (or branch) tip, and qpush your patches. Unfortunately MQ doesn’t keep track of the parents of patches, so it can’t intelligently merge changes when you qpush.

The way to get around this limitation is to use the rebase extension to rebase your MQ patches while they’re still applied. I’ll demonstrate how to do this in the screencast below:

MQ patches don’t usually merge well, but you can use the rebase extension to fix that!