enhancement for mq

timeless timeless at gmail.com
Mon Jan 5 16:04:57 CST 2009


i'm looking for a feature to be added to mq. I want a single command
that can affect the qpush'd portion of mq (I don't care about the
qpop'd portion of the queue as it doesn't affect my working tree).

given a sequence:
seq1 (fileA, fileB)
seq2 (fileC, fileD)
seq3 (fileE, fileF)
seq4 (fileC, fileD)

hg qresequence seq3 seq4

would create a new branch

seq1 -> seq2 -> (apply seq4) -> (apply seq3)

change hg's concept of the working checkout to the new branch

destroy the old working branch seq1 -> seq2 -> seq3 -> seq4

the rules:
patches must not contain overlapping files (so you can't resequence
seq4, seq2, seq3)

i'm working on mozilla (which has thousands of files), I have 50-100
patches in my current patch series (and expect it to grow a lot).
These patches can easily contain hundreds of unrelated files.

Sadly, if i use qpop/qpush, my working tree changes which causes a
rebuild, which is horribly expensive.

given the constraint that resequenced bits must not overlap (and of
course must be in the qapplied portion of a qseries),
it should be fairly easy to create a new branch and apply them as described.

i basically want atomicity, speed, and no changes to the working
directory. because of the constraint, we know that the resulting
sequence will have the some file data as the orginal sequence.

i've looked, and it doesn't seem like there's a particularly fast way
to implement this, mq seems to have a patch reader which could be used
to prove that none of the patches contain overlappping files, there
should be an easy way to apply a patch to an arbitrary revision (hg
import seems vaguely promising, although i don't see a way to specify
the revision), changing the id for the working tree should be  easy
although I haven't looked, and one could use hg strip to remove the
old sequence)

a full plan:
1. verify sequence doesn't contain patches with overlapping files
2. write new branch
3. change id
4. update series file
5. destroy old branch (from the point where it diverges)


More information about the Mercurial-devel mailing list