Brandon Leiran
Brandon Leiran

Reputation: 5451

In mercurial find all changesets that are outgoing and have a parent that is not outgoing

I have a large number of separate lists of changesets that I pulled from a co-worker. I want to strip these out.

I can identify all the changesets by using:

hg log -r "outgoing() and not author('Brandon Leiran')"

I could use a template to print only the node names and then use this for my strip list, but I'd really like to find only the "base" of each outgoing string of changesets. Can I do this with a revset query? Or something similar?

Upvotes: 4

Views: 869

Answers (2)

Martin Geisler
Martin Geisler

Reputation: 73808

Since version 1.7, the strip command lets you specify multiple changesets to strip and lets you use revsets. So

$ hg strip "outgoing() and not author('Brandon Leiran')"

will remove all changesets in one command. In other words, you do not need to find the base(s) yourself, strip will handle it for you.

However, if you want the bases to use in some other context, then use the roots function to compute them:

$ hg log -r "roots(outgoing() and not author('Brandon Leiran'))"

Upvotes: 4

Helgi
Helgi

Reputation: 5436

I assume you have no "important" (i.e. yours) changesets on top of any of the branches you pulled.

Now if it is so, and the number of separate branches (or lists as you called them) is low, you might probably want to strip the result of this selector several times until it yields no changesets:

min(outgoing() and not author('Brandon Leiran'))

As min returns the changeset with lowest revision number in set, it will be a base of one the branches, which you will strip.

Upvotes: 0

Related Questions