Use UUIDs instead of commit hashes for new branch names (git ambigous)

This commit is contained in:
Kristóf Tóth 2018-07-19 14:26:41 +02:00
parent 98e1bbe9d6
commit 889ec92928

View File

@ -6,6 +6,7 @@ from subprocess import run
from getpass import getuser
from os.path import isdir
from datetime import datetime
from uuid import uuid4
class SnapshotProvider:
@ -73,18 +74,12 @@ class SnapshotProvider:
))
def _checkout_new_branch_from_head(self):
head_hash = self._get_head_hash()
branch_name = uuid4()
self._run((
'git', 'branch',
head_hash
))
self._checkout(head_hash)
def _get_head_hash(self):
return self._get_stdout((
'git', 'rev-parse',
'HEAD'
branch_name
))
self._checkout(branch_name)
def restore_snapshot(self, date):
commit = self._get_commit_from_timestamp(date)