Attention: stripped from crew-stable

Stuart W. Marks smarks at
Fri Aug 7 23:34:14 CDT 2009

Greg Ward wrote:
> On Fri, Aug 7, 2009 at 1:32 PM, Stuart W. Marks<smarks at> wrote:
>> The solution I found was to strip all of changesets reported by "outgoing"
>> which can be done easily in this case by stripping starting at the first
>> outgoing changeset. For me, this was ada93c6bf554. Thus:
> What fortuitous timing: this is a good, if obscure, use case for the
> "strip outgoing" idea I proposed on the user list a few days ago.  If
> anyone else feels like implementing it, go right ahead.  ;-)

How about

while node=$(hg out --template '{node}\n' | sed -n 3p)
       [[ $node != 'no changes found' ]]
     echo hg strip $node
     hg strip $node

? Seems to me like "strip outgoing" is a rare and dangerous enough case that I 
wouldn't really feel safe doing this. But if you do this regularly, then more 
power to you.

> (The competing idea that inspired mine was "find the root of this
> branch and strip it"; I think that would have worked here too.)

Yes, I've run across the need for "find the root of this branch" before, not 
only to strip the branch, but also to be able to understand the history. 
Perhaps better visualization tools would help, but on the other hand if the 
branch in question itself has branches and merges, visualization sometimes can 
be quite confusing. So I've wanted a "find the root of this branch" operation 
that's callable from the command line.

I'm not sure this is well-defined in the general case. But in this case there 
were two heads that had branched some time in the past with (probably) no 
cross-merges. HEAD1 was the head of the branch that had the good changesets, 
and HEAD2 was the head of the branch with the bad changesets. Before I thought 
of the "outgoing" approach, I did:

$ hg debugancestor HEAD1 HEAD2
=> this told me the ANCESTOR node
$ hg log -f -r HEAD2:ANCESTOR

The second-to-last changeset of this output is the "root" of the branch that 
ends at HEAD2. Seems kind of cumbersome. What might have helped would have been 
an operation that lists the children of a particular changeset. Hmmm. Hack, 
hack, hack....


More information about the Mercurial-devel mailing list