how to get UTC timestamp for commit?

Christian Ebert blacktrash at gmx.net
Tue Aug 18 21:33:45 UTC 2015


* 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.

keyword also offers svnutcdate:
2009-08-18 11:00:13Z

I can propose a patch again.

-- 
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