hg equivalent to "bk collapse"?

Brendan Cully brendan at kublai.com
Mon Mar 19 22:36:01 UTC 2007


On Saturday, 17 March 2007 at 18:19, Giorgos Keramidas wrote:
> On 2007-03-16 14:08, Mike Kupfer <mike.kupfer at sun.com> wrote:
> > "Mark" == Mark Atwood <me at mark.atwood.name> writes:
> > Mark> With "bk collapse", you can do a lot of checkins into your local
> > Mark> tree, which generate a lot of change history.  And then "collapse"
> > Mark> them all together, for when you checkin to the upstream tree.
> > Mark> Thus everyone else doesn't have to see all your "nope, that didnt
> > Mark> work either, trying something else" changelog entries.
> > 
> > We're working on something like that for OpenSolaris's use of
> > Mercurial.  Unfortunately, I don't know of any web pages that I can
> > point you at for more information.  If you want, you could try asking
> > for details on tools-discuss at opensolaris.org.
> 
> I'm using MQ to do something similar so far.
> 
> For instance, when I'm working on two bugs, which should be resolved in
> the same commit, I make a clone of the repository and start with:
> 
>   cd ws/project
>   hg clone trunk gker
>   cd gker
>   hg qinit -c
>   hg qnew -fm '144361 summary of bug 144361' 144361
>   hg qnew -fm '144342 summary of bug 144361' 144342
> 
> This lets me work with the two patches as a 'pair', but I can also
> push/pop them at will or even re-order them.
> 
> At various times, when I have a 'stable' version of the patches which I
> want to test, I use qcommit to save the patch state:
> 
>   hg qcommit -m 'summary of patch state'
> 
> When I'm satisfied that it all works, and I want to push the patches
> upstream, I pop them off the tip of the 'gker' repository, and I use 'hg
> import' to make them real changesets on top of the tip.
> 
>   hg qpop -a
>   hg import .hg/patches/144361 && hg qdelete 144361
>   hg import .hg/patches/144342 && hg qdelete 144342
> 
> Then I can either 'hg push' two changesets, or hg diff with the last
> version of the trunk tip which I pulled and 'import' that diff.

You might want to have a look at hg qimport -r and hg qdel -r, as well
as qfold.

qimport -r will convert existing hg changesets into mq patches, and
qdel -r will convert applied mq patches into regular hg
changesets. So, for instance, you could replace

>   hg qpop -a
>   hg import .hg/patches/144361 && hg qdelete 144361
>   hg import .hg/patches/144342 && hg qdelete 144342

with hg qdel -r qbase:qtip (or whatever revs you want to commit).

If you only want one patch, you might prefer this:

hg qpop 144361
hg qfold 144342
hg qdel -r 144361



More information about the Mercurial mailing list