mq ~ Mercurial Queues - Solaris Rss

This is a discussion on mq ~ Mercurial Queues - Solaris Rss ; I've been experimenting with Mercurial Queues with the idea of sharingtheir mysteries with OpenSolaris developers so we can all integratemultiple changesets and keep one fix per changeset.
Essentially mq allows you to take a snapshot of your changes andcreate a ...

mq ~ Mercurial Queues

I've been experimenting with Mercurial Queues with the idea of sharingtheir mysteries with OpenSolaris developers so we can all integratemultiple changesets and keep one fix per changeset.

Essentially mq allows you to take a snapshot of your changes andcreate a patch file. You may then make additional changes to beapplied to the same patch file (qrefresh) or create a new patch (qnew)These patches may then be removed (qpop) and reapplied (qpush)at your leisure. So that's the theory, lets take a look using an example:

Enabling mq

To enable mq on OpenSolaris simply add it to your extensions in.hgrc:

$ head -2 ~/.hgrc[extensions]mq=Some data to work on.

For the following examples I've created a repository and added to it asimple C 'First program' and a make(1) file to compile anddelete the program... Complete with some faults to fix.

Its likely that you'll start making changes before remembering tostart a patch with qnew. For those occasions the -f option comesto hand to place all un-committed changes in to the patch. Verifiedbelow with qdiff:

Lets assume we want to make another change to the Makefile, butwe want to keep just the one patch for changes to Makefile.To accomplish this we pop the other two patches off. In the followingthat's done by naming the patch to pop to:

$ hg qpop Makefilenow at: Makefile$ hg qseries -v0 A Makefile1 U fix12 U messageNote now that the other two patches are un-applied.

With the just the original patch applied modify the Makefile, updatethe patch using qrefresh and then re-apply all the other patchesusing qpush -a.

Some caution is needed when you want two patches that edit thesame file. Its doable but because underneath patch(1) is being usedyou may need to manually merge in rejects.

Another gotcha on older versions of Mercurial is if you add a file ina patch-queue. If the patch is popped off you may need to re-add it(hg add). Lets see that in action by adding a new file which ofcourse requires adding to the Makefile too... This seems to be fixedhowever in version 1.3.1:

Firstly, we save the series of patches using qsave, with someessential options:

-c : Copy Patch directory

-n : Specify name of directory - By default it uses patches.N where N is next number in series until an non-existent directory is found within the root .hg directory.-e : Empty the queue status file - The status file holds information about which patches are applied, so deleting it makes it look as though the patch queue is empty. The changesets are stripped of their special tags.

The final step is to remove the queues, as with those intact we'reunable to push. To accomplish this use qfinishBut before weclear the queues take a backup of them using qcommit and cloneas its likely we'll have to pull again as we raise to push.

Note: Simply doing a qcommit is not sufficient because qfinish tidiesup the patches, a peek into the working files shows this best - I'veavoided showing these details previously: