views:

116

answers:

1

I've been playing with Mercurial and mercurial queues, and now have a fairly reasonable working version. However, before I submit a patch, I'd like to take that spagetti-history and merge it into discrete, logical steps, rather than the semi-overlapping repeated do-undo-redo-slightly-differently mess it is now, if only to reduce the number of patches.

How do I do that?

+1  A: 

hg qfold is the way to go. Be very careful with it. Make sure you have read all the instructions beforehands. It's reasonable to version your patchqueue too (as a nested repoository), so you have backups:

hg qinit [-c]

init a new queue repository

The queue repository is unversioned by default. If -c is specified, qinit will create a separate nested repository for patches (qinit -c may also be run later to convert an unversioned patch repository into a versioned one). You can use qcommit to commit changes to this queue repository.

Johannes Rudolph
Thanks, that worked! Someone else claimed that `hg export ... > combined.patch` would have been just as effective without requiring MQ - is that so?
Eamon Nerbonne
With mercurial 1.5 onwards you can also import multiple patches in a row, so no need to combine them in the export though. You'll still need MQ to strip your changes, or you'd need to clone a clean repo and apply the combined patches there, then abandon your branch. Too much work IMHO.
Johannes Rudolph