[Emacs interface] Re: hg log like git log

Uwe Brauer oub at mat.ucm.es
Tue Oct 20 11:26:47 UTC 2015


On 10/19/2015 01:15 PM, Simon King wrote:
> On Mon, Oct 19, 2015 at 9:44 AM, Uwe Brauer <oub at mat.ucm.es> wrote:
>>>>> "Matt" == Matt Mackall <mpm at selenic.com> writes:

> Are you sure that git is displaying the contents of the ChangeLog
> file? I can't see any mention of that at
> http://git-scm.com/docs/pretty-formats. I would guess that people are
> simply putting the same text in the commit message that they put in
> the ChangeLog file, and git is displaying the commit message (the same
> as the mercurial "{desc}" template keyword).
> 
> Simon
> 
	


Ok I think now I understand the issue better and would like to ask for
help again.
I am using mercurial 3.0.1. I hope that is recent enough.

GNU Emacs supports git and mercurial, among others. Using Emacs for a
commit then not only will be the commit message be used but also the
relevant ChangLog entry.

Emacs has also a interface for «git log» and «hg log» called
vc-print-log.
It seems basically to use the output of either «git log» and «hg log».

Here is an example of the «git log» after such a commit
,----
|
| commit f1575763c0d30df9f9e5b730c2f2c68f501cda9c
| Author: Eli Zaretskii <eliz at gnu.org>
| Date:   Mon Oct 19 10:04:50 2015 +0300
|
|     Fix return value of 'set-file-extended-attributes'
|
|     * lisp/files.el (set-file-extended-attributes): Return non-nil
|     when setting either ACLs or SELinux context succeeds.  Document
|     the return value.  (Bug#21699)
|
|     * doc/lispref/files.texi (Changing Files): Document the return
|     value of set-file-extended-attributes.
`----

The «*» indicate that it comes from the ChangLog. Note please also that
the msg are nicely intended.

Here is an example of «hg log» after such a commit.

,----
| changeset:   0:ec73bf7305cf
| tag:         tip
| user:        Uwe Brauer <oub at mat.ucm.es>
| date:        Tue Oct 20 14:06:29 2015 +0300
| summary:     Add HG support to the main function.
`----

While «hg log -v» leads to

,----
| changeset:   0:ec73bf7305cf
| tag:         tip
| user:        Uwe Brauer <oub at mat.ucm.es>
| date:        Tue Oct 20 14:06:29 2015 +0300
| files:       latexdiff.el
| description:
| Add HG support to the main function.
|
| * latexdiff.el (latexdiff-perl): Change defvar to defcustom!
`----

The most serious problem is that also the list of files are shown which
might be annoying. In addition the Changelog entry is not indented.

So in a mail exchange with the Emacs team, they told me that they need a
hg log modification which would much more to the result of the «git log»
but would also be only a slight modification of the standard «hg log»
Something like this.
,----
| changeset:   0:ec73bf7305cf
| tag:         tip
| user:        Uwe Brauer <oub at mat.ucm.es>
| date:        Tue Oct 20 14:06:29 2015 +0300
| description: Add HG support to the main function.
|
|              * latexdiff.el (latexdiff-perl): Change defvar to defcustom!
`----


I came up with the following:
hg log --template "changeset: {rev}:{node|short}\ntag: {tags}\nuser:
{author}\nDate: {date|rfc822date}\nsummary: {desc}\n{nofiles}\n"
 which leads to
,----
|
| changeset: 0:ec73bf7305cf
| tag: tip
| user: Uwe Brauer <oub at mat.ucm.es>
| Date: Tue, 20 Oct 2015 14:06:29 +0300
| desription: Add HG support to the main function.
|
| * latexdiff.el (latexdiff-perl): Change defvar to defcustom!
`----

This was criticised as follows:

,----
| The obvious difference is that the values are not lined up vertically.
| But you can add spaces to fix that, manually. Then:
|
| - No need to replace "summary:" with "description:".
| - Even when the commit doesn't have a tag, your template still shows
that line.
| - The date format is slightly different.
| - When the commit has multiple parents, the default style shows them
both, yours doesn't.
`----

I don't know how to solve these issues with templates, can anybody
please help?

Thanks

Uwe Brauer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3980 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20151020/0275aa7a/attachment.p7s>


More information about the Mercurial mailing list