Jon Nylander
Jon Nylander

Reputation: 8963

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.

Upvotes: 7

Views: 2797

Answers (2)

Sahir Moosvi
Sahir Moosvi

Reputation: 598

The above suggestion got me close but didn't quite work. this one worked better

hg log -u smoosvi -r "head() and not closed()"

Upvotes: 0

Tim Henigan
Tim Henigan

Reputation: 62168

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>')"

Upvotes: 10

Related Questions