[Mercurial] Timestampe

Matt Mackall mpm at selenic.com
Sun Aug 9 18:41:13 CDT 2009


On Mon, 2009-08-10 at 00:22 +0200, Marijn Vriens wrote:
> On Mon, Aug 10, 2009 at 12:13 AM, PierreLafrance1 at sympatico.ca
> <PierreLafrance1 at sympatico.ca> wrote:
>         Hi
>         Is there anyway to timestampe a variable in source code when
>         comit/push ?
>         
>         ex :
>         int MyFct()
>         int foo = TimeStampe
>         return foo
>         
>         Timestampe being set to current date when commiting.
> 
> The KeywordExtension might be what you are looking for:
> http://mercurial.selenic.com/wiki/KeywordExtension 

I don't recommend using keywords as it has significant global
performance implications. Instead, I suggest adding a one-liner that
calls hg to your makefile or build script. For instance:

timestamp.h:
  echo 'const char *timestamp = "' `hg parents --template '{date|date}'`
'"' > timestamp.h

-- 
http://selenic.com : development and support for Mercurial and Linux




More information about the Mercurial mailing list