mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-12-23 02:51:57 +00:00
Use UUIDs instead of commit hashes for new branch names (git ambigous)
This commit is contained in:
parent
98e1bbe9d6
commit
889ec92928
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user