Can I get hg log to print the history in reverse order?

Erik B picture Erik B · May 9, 2010 · Viewed 7.6k times · Source

If not, is this a feature that git has?

Answer

VonC picture VonC · May 9, 2010

YGL's answer is the right one for log, see this thread:

The hint from "hg help log" might be:
"If no revision range is specified, the default is tip:0". Combine this with the knowlegde from "hg help multirevs". That is:

hg log -r :

multirevs:

When Mercurial accepts more than one revision, they may be specified individually, or provided as a topologically continuous range, separated by the ":" character.

The syntax of range notation is [BEGIN]:[END], where BEGIN and END are revision identifiers.
Both BEGIN and END are optional.
If BEGIN is not specified, it defaults to revision number 0.
If END is not specified, it defaults to the tip.
The range ":" thus means "all revisions".

If BEGIN is greater than END, revisions are treated in reverse order.

A range acts as a closed interval. This means that a range of 3:5 gives 3, 4 and 5.
Similarly, a range of 9:6 gives 9, 8, 7, and 6.


Note: if you want to do the same with Graphlog (the glog that behaves like (a subset of) the normal log command except that it also prints a graph representing the revision history using ASCII characters to the left of the log.), you will need a patch.

I should warn you that it will be very slow for large graphs, particularly 0:tip.
See patch 1 and patch 2. I am working on improving that.