gquilt PyGTK GUI wrapper for quilt gets a Mercurial queues (mq) back end

Michael Haggerty mhagger at alum.mit.edu
Wed Feb 7 17:55:26 UTC 2007


Peter Williams wrote:
> I may be overly cautious but I would have thought it would be best to do
> such splitting when the patch isn't applied.  Something like:
> 
> 1. push/pop so that the patch you wish to split is one above the top
> patch (i.e. the next that will be applied by a qpop).
> 2. use qnew to create and name a new patch -- this will end up on the
> queue ahead of the one being split.
> 3. qpush this new patch
> 4. apply the parts of the patch being split that you want to be split
> out and do a qrefresh (this is where a patch editor would come in handy)
> 5. qpush the old patch -- the parts that have been moved to the new
> patch should be rejected as already applied
> 6. qrefresh and it's all over

Instead of steps 5 and 6 (which rely on the two split patches having no
conflicts) one could use the following steps, which are guaranteed to
succeed:

5a. Create the second partial patch and push it on the stack:

    quilt new part2

5b. Fold the first partial patch, in reverse, into part2:

    interdiff -p1 patches/part1 /dev/null | quilt fold

This uses "interdiff", from patchutils.  The text after this step is the
same as before patch part1 was applied, even though part1 is still on
the stack.  However, "quilt fold" ensures that the correct files have
been added to part2.

5c. Apply the original, full patch in full:

    quilt fold <patches/fullpatch

This step cannot have any conflicts as long as fullpatch originally
applied without conflicts.

5d. Refresh part2.

5e. Delete the original fullpatch.  Applying part1 followed by part2 is
now identical to the original fullpatch.

It sure would be nice to have other utilities for tidying up patches
before commit.  For example:

- swapping the order of two patches.  This can be done automatically if
the patches don't conflict, but requires hand-fixing otherwise.

- combining two adjacent patches into a single one

Michael



More information about the Mercurial mailing list