6

I've been going through the tutorial at hginit.com, but I've found a rather inconvenient aspect of the hg log feature. Basically, when I type it, I get the newest changes on top, and the oldest at the bottom. But this is simply annoying, as most of the time, you want to see the newest revisions. So... say I have 100 changesets, and I want to have a look over the 98th one. Do I scroll all the way up? Or is there a way to make Hg (Mercurial) list the changes the other way around?

tshepang
  • 10,772
  • 21
  • 84
  • 127
XLR3204S
  • 199
  • 1
  • 1
  • 9

4 Answers4

5

Use hg log -r:

Niall C.
  • 10,718
  • 7
  • 66
  • 60
  • Both this and David Sykes' responses work, so I've upvoted both. I'm choosing this because I have to choose an 'accepted answer' and this is the shorter way :) – XLR3204S Aug 02 '10 at 14:42
  • It's clearly the better way, I also upvoted, but left mine in as it might be helpful – David Sykes Aug 05 '10 at 07:00
4

Just limit the display of hg log with -l/--limit.

E.g. hg log -l 100 to only display 100 changes.

If you want to avoid scrolling, you can also pipe the output to a pager (e.g. hg log | less) or use the pager extension.

tonfa
  • 22,402
  • 2
  • 32
  • 39
  • No, this is not what I had in mind. So basically, when I write `hg log`, I get something like *latest change*\ *second latest change*\ *thirst latest change*\ *...*\ *first change*\ But I want it to be *first change*\ *second change*\ *...*\ *latest change*\ I don't need to limit the number of changesets displayed. – XLR3204S Aug 02 '10 at 11:55
  • Umm, if you limit the number of changes to 5, then you'll see latest change, second latest change, ..., fourth latest change, fifth latest change. – ebynum Aug 02 '10 at 12:48
  • @XLR3204S, I think your problem is because the latest changes are on top. So you want to avoid scrolling? Just use a pager, or display less revisions (with `--limit`). – tonfa Aug 02 '10 at 13:02
2
hg log | tail -r
David Sykes
  • 43,314
  • 17
  • 65
  • 77
0

For me second part of @tonfa's answer is the right one, useful in all cases (you can search with /, etc...)

If you want to avoid scrolling, you can also pipe the output to a pager (e.g. hg log | less) or use the pager extension.

By now, seems if you want the pager to work with your alias you must say specifically on your .hgrc (the same for hg help, esencial)

Example

[extensions]
pager =  

[pager]
pager = LESS='FRX' less
attend = help logg

[alias]
logg = log -G --template '\x1B[33m{node|short}\x1B[0m | {date|isodatesec} | \x1B[32m{author|user}\x1B[0m: {desc|strip|firstline}\n'
albfan
  • 10,988
  • 2
  • 49
  • 74