hgtip-content-ja / advanced / 2010-02-11-merging-mq-patches-with-rebase.html

{% extends "_tip.html" %}
    title: Merging MQ Patches with Rebase
    author_name: Steve Losh
    created: 2010-02-11

{% block excerpt %}
MQ patches don't usually merge well, but you can use the rebase extension to
fix that!
{% endblock %}

{% block tip %}

**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:

[rebase extension]:

<div class="screencast">
<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase=',0,115,0' width='560' height='345'><param name='movie' value='' /><param name='flashvars' value='i=46386' /><param name='allowFullScreen' value='true' /><embed src='' flashvars='i=46386' allowFullScreen='true' width='560' height='345' pluginspage=''></embed></object>

{% endblock %}