Revset filter to show merges / splits of named branches

231 views Asked by At

I want to filter commits in TortoiseHg in such a way that only commits are shown that:

  1. Have at least one parent commit in a different named branch; or
  2. Have at least one child commit in different named branch; or
  3. Are the original starting point (commit 0); or
  4. Are the head of a named branch or closing commit of a named branch;

Basically: how can I get a condensed graph showing how named branches flow?

As an example, I want to condense this kind of revision graph:

Example revision graph

Into a form where these are omitted:

  • Rev 15 (green)
  • Rev 14 (green)
  • Rev 13 (blue)
  • Rev 10 (blue)
  • Rev 7 (blue)
  • Rev 4 (red)
  • Rev 1 (blue)

I've tried using the concrete suggestion I got in this answer at SoftwareRecs:

children(branchpoint() or merge()) or parents(branchpoint() or merge())

However, that doesn't work as I want it to, it still includes several commits that don't have any details on branching, and cuts e.g. the default branch short by showing too early a commit:

result of the abovementioned filter

How can I change the revset filter so that I get a more condensed graph? Is it even possible? As a sub-optimal solution I guess it would also be acceptable if no distinction was made between branches being named or not.

1

There are 1 answers

0
Edward On

This should get you what you're looking for, minus the comparison between branch names:

merge() or parents(merge()) or branchpoint() or children(branchpoint())

This should give you all merge changesets, the direct parents of the merges, all branchpoint changesets, and the direct children of the branchpoints.

In the example in your question post you are including the children of merge changesets and the parents of branchpoints because of the compound nature of the revsets you set up. By breaking those apart, the results are trimmed down a bit.