When I run Mercurial’s “hg log” command from a terminal window, the results often fall off the screen, forcing me to scroll up to the top. As a result, I created a template to reduce the verboseness and format of the log:
[alias]
slog = log --template '{rev}:{node|short} {desc|firstline} ({author})\n'
However, I’d like to improve this even further by either a) limiting the size of the “slog” to just the last 10 commits or b) using a command like “hg slog ##”, where “##” would be the number of logs shown in the results.
Any thoughts on how to achieve either A or B?
You could define your alias to do only a fixed limit in this way:
Or, you could put
--limiton the end so that you can pass a number to it, as arguments to an alias will be appended to the end:The above could be called like this for the last 10 changesets:
You should also be able to define the parameterized version in this way, but it doesn’t seem to be property expanding the
$1: