CVS $Log$ alternative

Christian Ebert blacktrash at gmx.net
Wed Oct 27 10:40:52 UTC 2010


* Martin Geisler on Wednesday, October 27, 2010 at 10:54:53 +0200
> Markus Korber <korbse at gmx.at> writes:
>> is there a possibility to get the commit log messages into the
>> revisioned file?  Something like CVS' $Log$ keyword?  hg help keyword
>> says that the $Log$ keyword is not supported.

You could configure a $Log$ keyword yourself:

[keywordmaps]
Log = {desc}

However it would not behave as CVS' $Log$:
1) not incremental like CVS
2) only the first line of the message will be displayed

>> However, could this be done with a hook? And what happens upon merging
>> changes?
> 
> You could try to use the encode/decode filter system we have:
> 
>  http://www.selenic.com/mercurial/hgrc.5.html#decode-encode
> 
> The decode filter must replace '$Log$' with something from 'hg log' and
> the encode filter must replace the 'hg log' part with '$Log$' again.
> 
> That way Mercurial will only ever see '$Log$' in the file, but you will
> see some 'hg log' output in the working copy.
> 
> Please write back if you get it working.

As the author of the keyword extension, I would be very
interested ;-) FWIW, I've tried the decode/encode filter approach
before resorting to an extension.

Another problem with $Log$ is that it doesn't have a reliable
finishing delimiter (except by looking it up in the log again) in
its expanded form:

$Log: hello.c,v $    Revision 1.12  1999/07/19 06:12:43  jrandom
    say hello in Aramaic 
    [...]

c
-- 
theatre - books - texts - movies
Black Trash Productions at home: http://www.blacktrash.org
Black Trash Productions on Facebook:
http://www.facebook.com/blacktrashproductions



More information about the Mercurial mailing list