How can I list a series of revisions using 'hg log'?
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+).
![Tim Post](https://i.stack.imgur.com/Y3pvv.jpg?s=256&g=1)
Tim Post
I'm Tim, and I used to work at Stack Overflow as the Community Evangelist. You'll notice that I've written quite a few things on many of our meta sites, and I hope you find some value in it! My day-to-day effort here goes mostly into moderation and helping to guide the community, as I've done since 2011. I'm also the Co-founder and General Manager of Echoreply Media, a company that markets strictly to developers. The best way to reach me is Twitter if you need to speak with me directly.
Updated on June 05, 2022Comments
-
Tim Post about 2 years
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
throughy
instead ofx
andy
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 thehg
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.
-
Tim Post over 12 yearsThank you. Strange that they don't include breadcrumbs to that in the output of
hg log --help
. -
anton.burger over 12 yearsDefinitely one of the most enlightened features I've ever seen in any software :) A more recent version (1.9? Not sure) adds the equivalent capability anywhere a list of files (rather than changesets) is expected as an argument.
-
Tim Post over 12 yearsI think I'm going to re-subscribe to the user's list, so I don't miss neat stuff like this coming in. Over the years I've come up with 'interesting' ways to do things with Mercurial, mostly working around features it didn't have. This particular feature gets rid of a few clumsy kludges :)
-
Lazy Badger over 12 yearsQuote from
hg help log
"If no revision range is specified, the default is "tip:0" unless --follow is set, in which case the working directory parent is used as the starting revision. You can specify a revision set for log, see "hg help revsets" for more information. "