Search code examples
mercurial

Mercurial - listing a user's heads


Is there a way to list heads that were created by a specific user?

With the hg heads command I am unable to filter on user.

While with hg log I can filter on a user, but am unable to figure out how to list only the last changeset on a branch.

UPDATE:

Thanks to Tim Henigan's answer below. I arrived at the following conclusion.

log -r "head() and not closed() and user('<username>')"

In my particular case I wanted only the latest heads in reverse order so I made an alias for this functionality.

[alias]
myhist = log -r "reverse(head() and not closed() and user('<username>'))" --template "{rev}: {branches}\n" -l 10

so that calling hg myhist gives me up to ten recent changesets which are all the last one on their branch. I am using the --template option to only see the revision number and branch name so as to get a quick overview of my recent activity.


Solution

  • If you are using a newer version of Mercurial, you can build this query using revsets:

    hg log -r "heads(all()) and not closed() and user('<user>')"