问题
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?
回答1:
Use hg log -r:
回答2:
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.
回答3:
hg log | tail -r
回答4:
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'
来源:https://stackoverflow.com/questions/3386758/mercurial-log-interface