diff --git a/src/dvsim/flow/base.py b/src/dvsim/flow/base.py index 847650f1..4ae7d2c3 100644 --- a/src/dvsim/flow/base.py +++ b/src/dvsim/flow/base.py @@ -26,6 +26,7 @@ rm_path, subst_wildcards, ) +from dvsim.utils.git import git_commit_hash if TYPE_CHECKING: from dvsim.job.deploy import Deploy @@ -152,6 +153,11 @@ def __init__(self, flow_cfg_file, hjson_data, args, mk_config) -> None: # _expand and add the code at the start. self._expand() + # After initialisation & expansion, save some useful revision metadata + proj_root = Path(self.proj_root) + self.commit = git_commit_hash(path=proj_root, short=False) + self.commit_short = git_commit_hash(path=proj_root, short=True) + # Construct the path variables after variable expansion. reports_dir = Path(self.scratch_base_path) / "reports" self.results_dir = reports_dir / self.rel_path diff --git a/src/dvsim/sim/flow.py b/src/dvsim/sim/flow.py index 35de0c63..2ba51873 100644 --- a/src/dvsim/sim/flow.py +++ b/src/dvsim/sim/flow.py @@ -44,7 +44,7 @@ from dvsim.tool.utils import get_sim_tool_plugin from dvsim.utils import TS_FORMAT, rm_path from dvsim.utils.fs import relative_to -from dvsim.utils.git import git_commit_hash, git_https_url_with_commit +from dvsim.utils.git import git_https_url_with_commit __all__ = ("SimCfg",) @@ -176,11 +176,6 @@ def __init__(self, flow_cfg_file, hjson_data, args, mk_config) -> None: super().__init__(flow_cfg_file, hjson_data, args, mk_config) - # After initialisation & expansion, save some useful revision metadata - proj_root = Path(self.proj_root) - self.commit = git_commit_hash(path=proj_root, short=False) - self.commit_short = git_commit_hash(path=proj_root, short=True) - def _expand(self) -> None: # Choose a wave format now. Note that this has to happen after parsing # the configuration format because our choice might depend on the