Search code examples
mercurialdvcs

Is there a children command to complement the parents command?


Mercurial provides the command parents to examine a given revision's parent(s). This can easily be used to Traverse the DAG backward. I need to traverse the DAG forward. Is there a hg children command?


Solution

  • If you're using Mercurial 1.6 or later, there is a built-in functional language for specifying sets of revisions; see hg help revsets for full details.

    In your case, you would use

    hg log -r "children(XXX)"
    

    to show immediate children of revision XXX, or

    hg log -r "descendants(XXX)"
    

    to show all changesets with XXX as an ancestor.