From 187dda2803d66559a09cf0ce53d237f41bc623c1 Mon Sep 17 00:00:00 2001 From: Lukas Winkler Date: Thu, 11 Feb 2021 14:41:23 +0100 Subject: [PATCH] add git_hash --- utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils.py b/utils.py index 73b5d71..829385b 100644 --- a/utils.py +++ b/utils.py @@ -1,5 +1,6 @@ import os import socket +import subprocess from ctypes import c_uint32 from pathlib import Path from random import randint @@ -147,6 +148,11 @@ def reorder_particles(sim: Simulation, ed: ExtraData) -> None: assert sim.N == original_N +def git_hash() -> str: + output = subprocess.run(["git", "rev-parse", "--verify", "HEAD"], capture_output=True) + return output.stdout.decode() + + def process_friendlyness(fn: Path) -> None: if socket.gethostname() == "standpc": # only handle other computers specially