user277465
user277465

Reputation:

git log format for mercurial

I like the way git displays its log(like in the man pages format). Is there any way I could customize mercurial to display its log(or glog) in a similar format?

Upvotes: 2

Views: 1375

Answers (3)

Den
Den

Reputation: 866

I'm guessing that by 'man pages format' you mean allowing you to scroll backwards and forwards in the output. You can accomplish the same thing in mercurial using the pager extension. It can be accomplished by adding the following to your .hgrc:

[pager]
pager = LESS='FSRX' less
[extensions]
pager =

the FSRX arguments to less let it show any colored output you might have hg log showing.

Upvotes: 10

Daniel Näslund
Daniel Näslund

Reputation: 2410

If you want a formatting that resembles git logs, put this in your .hgrc:

[alias]
vlog = log --template '\033[0;33mcommit: {rev}:{node}\n\033[0mAuthor: {author}\nDate:   {date|rfc822date}\n\n\t{desc|strip|fill68|tabindent}\n\n'

Here's a sample output. (In a terminal, the commit-line is colored).

$ cd code/mercurial
$ hg vlog
commit: 16004:7d12b2d3a83d44271b3aa515fe8d211e47bac2c0
Author: Matt Mackall <[email protected]>
Date:   Fri, 27 Jan 2012 18:43:31 -0600

        merge with i18n

commit: 16003:0d898ebb424ee85da76bc41584b14ac391549077
Author: Alexander Sauta <[email protected]>
Date:   Fri, 27 Jan 2012 12:25:02 +0400

        i18n-ru: synchronized with bf502ccc46d7; fuzzies removed

commit: 16002:384f7521c79152d6d197c0659f81e099067cadc3
Author: Nikolaj Sjujskij <[email protected]>
Date:   Thu, 26 Jan 2012 16:56:11 +0400

        i18n-ru: fix typos in `resolve` help

         * help entry is called 'merge-tools', not 'merge-tool';
         * envvar is called HGMERGE, not HGEMERGT.

commit: 16001:fcf66193b18699141e1da1ef4de4795d62a658cb
Author: Matt Mackall <[email protected]>
Date:   Thu, 26 Jan 2012 20:34:57 -0600

        merge: defer symlink flag merging to filemerge (issue3200)

        Previously, we could change a normal file into a corrupt symlink
        when trying to merge a symlink flag. Now, we leave the flag alone
        and let filemerge deal with it (usually by a prompt).

        We also drop a redundant flag setting after filemerge (now dealt
        with by ms.resolve) that would cause similar corruption.

Upvotes: 4

Ry4an Brase
Ry4an Brase

Reputation: 78330

I think Den figured out what you mean, but if you're actually looking to alter the output stylistically you can do that with the --style command. Examples:

$ hg log --style xml
<?xml version="1.0"?>
<log>
<logentry revision="13480" node="69418d4525d166793bc63789b2bd64fcc3d84401">
<branch>stable</branch>
<tag>tip</tag>
<author email="[email protected]">Azhagu Selvan SP</author>
<date>2011-02-24T01:14:15+05:30</date>
<msg xml:space="preserve">convert/svn: abort operation when python bindings are not available
 ...

and

$ hg log --style changelog -l
2011-02-24  Azhagu Selvan SP  <[email protected]>

    * hgext/convert/subversion.py:
    convert/svn: abort operation when python bindings are not available

    Subversion python bindings check was not present in svn_sink source
    class which made it fail while using svn as destination repository.
    Added a more maintainble svn bindings check for svn_source and
    svn_sink classes.
    [69418d4525d1] [tip] <stable>
...

Upvotes: 2

Related Questions