Why isn't pagination enabled by default for hg log? [was - Re: | less or more don't display colors]

Jaikiran Pai jai.forums2013 at gmail.com
Thu Feb 4 12:45:49 UTC 2016


One thing I have always wondered is why isn't pagination enabled by 
default (i.e. out of the box hg installation) in mercurial. For any real 
reasonable sized project, the logs are going to span more than a page. 
Git for example has pagination enabled by default for logs (I don't mean 
to make it a git vs hg thing).

I understand there are ways to setup aliases/configs etc but it isn't 
always feasible to do that. For example, given the nature of my work, 
most of the times, I have to ssh into various systems and browse the 
mercurial repos on those systems. I can't expect those aliases/configs 
to be setup there to be able to get a nice paginated output from hg log. 
I also realize that I can always do "hg log | less" to get pagination, 
but I'm curious why this isn't a default out of the box feature. Is 
there something that prevents it from being implemented as an 
enhancement in future releases?

-Jaikiran


On Tuesday 02 February 2016 12:59 AM, Martin Geisler wrote:
>
>
> On Mon, Feb 1, 2016 at 7:28 PM, Uwe Brauer <oub at mat.ucm.es 
> <mailto:oub at mat.ucm.es>> wrote:
>
>     Hello
>
>     I have the following alias (found somewhere on the web)
>     lg = log --template "{label('custom.rev',
>     rev)}\t{label('custom.phase',phase)}\t{label('custom.tag',tags)}\t{desc|firstline}
>     {label('custom.age', date|age)} {label('custom.user', author|user)}\n"
>
>     That produces a very nice colored output.
>
>     However, since the output is very large,  I run
>
>      hg lg | more
>
>     But then  the colors are not displayed (using less the same occurs)
>
>     Is there any possibility to display colors in this stetting?
>
>
> The color extension turns off the colors by default when it detects 
> that stdout doesn't go to the terminal.
>
> You can force colors by adding --color=always to the command line in 
> your alias.
>
> Alternatively, I would suggest using the pager extension 
> (https://www.mercurial-scm.org/wiki/PagerExtension). That allows you 
> to make certain commands always use a pager and color will then be 
> shown as well. I use this configuration for pager:
>
> [pager]
> pager = less -RFSX
>
> Read the man page for less and adjust the flags as necessary -- the 
> '-R' flag is what makes less pass ANSI color codes through.
>
>
> -- 
> Martin Geisler
>
>
> _______________________________________________
> Mercurial mailing list
> Mercurial at selenic.com
> https://selenic.com/mailman/listinfo/mercurial

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20160204/e745ed86/attachment-0002.html>


More information about the Mercurial mailing list