RFC: adding a 'qsplit' command to interactively split an mq patch

Frank Kingswood frank at kingswood-consulting.co.uk
Mon Apr 11 10:50:34 CDT 2011


On 11/04/11 10:37, Idan K wrote:
> Hi,
>
> I'm thinking of adding a 'qsplit' command to mq that lets the user
> accept/reject hunks from the current patch (or a specified one) to be
> moved to a new one. Selection will be done like shelve/record.
> This is mostly useful for splitting by content since splitting by files
> can be done with 'qrefresh' (see [1]).
>
> Usage might look like this: hg qsplit [existing-patch-to-split]
> <new-patch-name>

I'm using a script by the same name that does something different. If we call 
your semantics a "horizontal split", mine is a "vertical split": it splits a 
patch across files, e.g.

	hg-qsplit -n new-patch-name files...

takes the current tip in mq and removes files... from it,
then it creates a new patch in which it puts the changes from the
files in that. In shell that goes like this (modulo error handling):

	OLD="$(hg qtop)"
	hg qrename new-patch-name
	hg qrefresh files...
	hg qnew "$OLD"

Frank



More information about the Mercurial-devel mailing list