Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 539
Tim Post Avatar asked Oct 17 '11 09:10

Tim Post


People also ask

What is hg command?

The hg command provides a command line interface to the Mercurial system.

What is Mercurial changeset?

A changeset (sometimes abbreviated "cset") is an atomic collection of changes to files in a repository. It contains all recorded local modification that lead to a new revision of the repository. A changeset is identified uniquely by a changeset ID. In a single repository, you can identify it using a revision number.

What is hg status?

hg status shows the status of a repository. Files are stored in a project's working directory (which users see), and the local repository (where committed snapshots are permanently recorded). hg add tells Mercurial to track files. hg commit creates a snapshot of the changes to 1 or more files in the local repository.

How do you Uncommit in Heartgold?

A simple way to 'uncommit' your last commit is to use hg strip -r -1 -k. In case the link breaks, the documentation mentioned by @phb states: hg rollback Roll back the last transaction (DANGEROUS) (DEPRECATED) Please use 'hg commit --amend' instead of rollback to correct mistakes in the last commit.


1 Answers

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+).

like image 108
anton.burger Avatar answered Oct 21 '22 10:10

anton.burger