Auto Header in file

Robert Bauck Hamar r.b.hamar at usit.uio.no
Wed Jul 8 07:11:20 CDT 2009


*Ed':
>
>Hello,
>I'm really interest to explore an option in Mercurial and I don't know how to ...
>
>So when a person add a file, commit, and push on the server. We 've got the author of the modif' in the log. 
>I'm searching how to automate the add of the author of the modif' and the date directly in the modified file. 
>Is it possible to do that?

There are essentially two options:

1. Insert this on input.
2. Insert on archive/checkout

1 is not possible with Mercurial[0]. However you can often make your editor 
do this. It is, even if it had been possible with Mercurial, only doable 
if all developers have the same settings to automate this. Changing the 
files on push to server is not an option(!), as this would change the SHA1 
id of the changeset.

2 is doable:
<URL:http://mercurial.selenic.com/wiki/KeywordExtension>. Note however: 
<URL:http://mercurial.selenic.com/wiki/KeywordPlan#head-2007fad6f31bf6f1f1b5c3d5b02e5c6225de3ec5>,
<URL:http://article.gmane.org/gmane.comp.version-control.git/44654>.

Note:
You only really need this when moving files out of the working directory 
(else, hg would be able to quickly produce the author name(s)), that is when 
creating a release archive or installing from checkout. This task should 
be easy to perform with a really simple script. (fetch data from repo, 
apply regex to file content).

[0]: With not possible, I mean that it is not (as I'm aware of) no 
existing functionality for this. You could, of course, write your own 
extension (you should expect problems, though, it's probably much more 
complex than you would think). But it would still require all your 
authors to use it.
-- 
Robert Bauck Hamar
USIT/SAPP/GT - Cerebrum
http://www.uio.no/sok?person=hamar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial/attachments/20090708/cf511130/attachment.pgp 


More information about the Mercurial mailing list