Fix python3.7 incompatibilities in SnapshotProvider

This commit is contained in:
Kristóf Tóth 2018-08-03 11:39:55 +02:00
parent 3fee8fee20
commit 3d2e3e7db3

View File

@ -8,6 +8,8 @@ from os.path import isdir
from datetime import datetime from datetime import datetime
from uuid import uuid4 from uuid import uuid4
from dateutil import parser as dateparser
class SnapshotProvider: class SnapshotProvider:
def __init__(self, directory, git_dir): def __init__(self, directory, git_dir):
@ -109,7 +111,7 @@ class SnapshotProvider:
self._snapshot() self._snapshot()
def _checkout_new_branch_from_head(self): def _checkout_new_branch_from_head(self):
branch_name = uuid4() branch_name = str(uuid4())
self._run(( self._run((
'git', 'branch', 'git', 'branch',
branch_name branch_name
@ -174,7 +176,7 @@ class SnapshotProvider:
commit_hash, timestamp = line.split('@') commit_hash, timestamp = line.split('@')
commits.append({ commits.append({
'hash': commit_hash, 'hash': commit_hash,
'timestamp': datetime.fromisoformat(timestamp) 'timestamp': dateparser.parse(timestamp)
}) })
return commits return commits