comparison hgext/convert/common.py @ 17974:337d728e644f

convert: add config option to use the local time zone The default for the time zone offset in a converted changeset has always been 0 (UTC). With this patch, the converted changeset is modified so that the local offset from UTC is specified as the time zone offset. The option is specified as the boolean convert.localtimezone (default False). Example usage: hg convert -s cvs --config convert.localtimezone=True example-cvs example-hg IMPORTANT: the patch only applies to conversions from cvs or svn. The documentation for the option only appears in those two sections in the convert help text.
author Julian Cowley <julian@lava.net>
date Sun, 18 Nov 2012 12:26:50 -1000
parents 97f1f22c2dba
children 05acdf8e1f23
comparison
equal deleted inserted replaced
17973:fa6be7b81f77 17974:337d728e644f
3 # Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others 3 # Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others
4 # 4 #
5 # This software may be used and distributed according to the terms of the 5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 import base64, errno, subprocess, os 8 import base64, errno, subprocess, os, datetime
9 import cPickle as pickle 9 import cPickle as pickle
10 from mercurial import util 10 from mercurial import util
11 from mercurial.i18n import _ 11 from mercurial.i18n import _
12 12
13 propertycache = util.propertycache 13 propertycache = util.propertycache
444 m[child] = pp 444 m[child] = pp
445 except IOError, e: 445 except IOError, e:
446 if e.errno != errno.ENOENT: 446 if e.errno != errno.ENOENT:
447 raise 447 raise
448 return m 448 return m
449
450 def makedatetimestamp(t):
451 """Like util.makedate() but for time t instead of current time"""
452 delta = (datetime.datetime.utcfromtimestamp(t) -
453 datetime.datetime.fromtimestamp(t))
454 tz = delta.days * 86400 + delta.seconds
455 return t, tz