how to get UTC timestamp for commit?

Christian Ebert blacktrash at gmx.net
Tue Aug 18 22:32:03 UTC 2015


* Matt Mackall on Tuesday, August 18, 2015 at 16:57:05 -0500
> On Tue, 2015-08-18 at 22:33 +0100, Christian Ebert wrote:
>> * Matt Mackall on Tuesday, August 18, 2015 at 12:40:30 -0500
>>> On Tue, 2015-08-18 at 03:32 +0100, Christian Ebert wrote:
>>>> The keyword extension provides an utcdate filter:
>>>> 
>>>> $ hg --config extensions.keyword= log -l1 --template '{date|utcdate}\n'
>>>> 2015/08/16 18:24:30
>>>> 
>>>> The code looks like this:
>>>> # date like in cvs' $Date
>>>> def utcdate(text):
>>>>   ''':utcdate: Date. Returns a UTC-date in this format: "2009/08/18 11:00:13".
>>>>   '''
>>>>   return util.datestr((util.parsedate(text)[0], 0), '%Y/%m/%d %H:%M:%S')
>>>> 
>>>> 
>>>> Maybe that helps.
>>> 
>>> That's a silly place for it?
>> 
>> I offered to make this available in core, but it wasn't deemed
>> necessary. Maybe because of the '%Y/%m/%d %H:%M:%S' format, I
>> don't know.
> 
> Ahh, right. What's really wanted is an analog to localdate: don't format
> the date, just change the timezone. IOW:
> 
> def utcdate(date):
>    return (date[0], 0)
> 
> But now we have a name collision.

I know. But core should have priority. Maybe there's a pragmatic
way to deal with a bit of BC breakage. One could argue that no
crucial data breaks ...

-- 
die Postleitzahl 29 is unteilbar ich bin 29 des kgV von 29 und 87
is 29 ich bin 29 ich bin eine Null eine Null is eine runde Sache ich
möcht heim ich möcht      black/trash/productions: DIE TEXTE
                          http://www.blacktrash.org/texte



More information about the Mercurial mailing list