Skip to content

Commit

Permalink
Resolve git keywords to commit sha
Browse files Browse the repository at this point in the history
For proper data postprocessing it's needed to change commit
identifiers to sha - e.g. HEAD -> commit sha-1
  • Loading branch information
Pawel Karczewski committed Feb 19, 2021
1 parent 9003f57 commit 0da3c06
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions run_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def __init__(self, config: dict):
self.commit = config["commit"]
self.clone()
self.checkout()
config["commit"] = self._resolve_sha()

def __str__(self):
return f"{self.url} in {self.path}"
Expand All @@ -46,6 +47,17 @@ def clone(self):
self.logger.info(f"Cloning repository: {self.url}")
subprocess.run("git clone".split() + [self.url, self.path], check=True)

def _resolve_sha(self):
rev_parsed_commit = subprocess.run(
["git", "rev-parse", self.commit],
cwd=self.path,
capture_output=True,
check=True,
universal_newlines=True,
).stdout
self.logger.info(f"Commit sha: {rev_parsed_commit}")
return rev_parsed_commit


class CmakeProject:
def __init__(self, config: dict, dependencies: list = []):
Expand Down

0 comments on commit 0da3c06

Please sign in to comment.