Search code examples
mercurialtortoisehg

Overview of branch relationships in mercurial


I have a repo with a long history and various long-running named branches, some closed and some still open. I would like to know which branches depend on which, so that I can tell, for example, if branch A is effectively a twig or if other branches depend on it. Is there a way to see a high-level overview, or simplified diagrams, of the relationships between branches?

                       y-y-y-y-y
                      /
...o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-
      \         /           
       x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x

For example, in the above I cannot drop the entire x branch, since the default o depends on part of it. But scrolling down hundreds of entries in the output of hg log --graph, I might not notice the merge.

Basically I'm looking for a record of splits and merges, as if long sequences of commits in the same branch were collapsed into a single commit. (Of course it would be useful to know which ranges were collapsed.) Alternately, a very compact graphic representation might make an overview possible in some other way, or there might be a non-visual (textual) way to summarize the dependencies.

                  y--y
                 /
...o--o ---- o--o--o
       \    /
        x--x 

I use both commandline hg and tortoise HG, so I'm happy with solutions based on either one. Any ideas?


Solution

  • In TortoiseHg, you can enable a filter and use:

    head() or merge() or parents(merge())
    

    This should only show heads, merges and parents of merges so you can see how everything interrelates.

    Another useful one is not follow(). If updated to the tip of o above, it would show the stubs of x and y that aren't merged into o.