How can I list a series of revisions using 'hg log'?

17.1k views Asked by At

I'm attempting to use the hg log command to show a series of revisions, x through y.

When I do this:

hg log -r 1+5

I get this:

changeset:   1:7320d2a9baa5
user:        Tim Post <[email protected]>
date:        Fri Sep 30 20:38:29 2011 +0800
summary:     Foo foo everywhere is foo

changeset:   5:8d6bea76ce60
user:        Tim Post <[email protected]>
date:        Fri Sep 30 20:51:42 2011 +0800
summary:     Blah blah blah

Which is Mercurial understanding that I want to see revisions one and five instead of one through five.

Oddly enough, this works:

hg log -r 1+2+3+4+5

But, that gets extremely cumbersome, especially when trying to get a summary between revisions that are +500 away from each other.

Is there a way to get logs for revisions x through y instead of x and y without concatenating every revision in the series?

I'm using the output in order to determine how many commitments each developer made in a given series. If I simply can't do that using the hg command, I'm more than open to using the Mercurial API. I resorted to the hg command because I did not see an obvious way of doing it via the API.

By API, I mean just using Python via a hook or extension.

1

There are 1 answers

4
anton.burger On BEST ANSWER

hg log -r1:5.

Mercurial has an entire mini-language devoted to selecting revisions for commands (not just for logs). For more information, see hg help revsets (needs Mercurial 1.6+).