Skip to content

Instantly share code, notes, and snippets.

Created August 28, 2017 16:44
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
import datetime
import re
import os
badTimeStamp = datetime.datetime.strptime("2010-03-08 15:02:59 -0500", "%Y-%m-%d %H:%M:%S %z")
desiredTimeStamp = datetime.datetime.strptime("2017-08-28 11:15:59 -0400", "%Y-%m-%d %H:%M:%S %z")
delta = desiredTimeStamp - badTimeStamp
for line in open("../backup.log", "r"):
m = re.match("r(\\d+) \\| jeff \\| (.*) \(", line)
if m:
rev, ts = m.groups()
if (int(rev) >= 54):
badSvnTime = datetime.datetime.strptime(ts, "%Y-%m-%d %H:%M:%S %z")
fixedSvnTime = (badSvnTime + delta).astimezone(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%S.000000Z")
os.system('svn propset -r%s --revprop svn:date "%s"' % (rev, fixedSvnTime))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment