MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / _commit_ifc

Function _commit_ifc

src/bonsai/test/tool/test_ifcgit.py:49–56  ·  view source on GitHub ↗

Write content to model.ifc, stage and commit it. Returns commit hexsha.

(repo: "git.Repo", tmpdir: str, content: str, message: str)

Source from the content-addressed store, hash-verified

47
48
49def _commit_ifc(repo: "git.Repo", tmpdir: str, content: str, message: str) -> str:
50 """Write content to model.ifc, stage and commit it. Returns commit hexsha."""
51 ifc_path = os.path.join(tmpdir, "model.ifc")
52 with open(ifc_path, "w") as f:
53 f.write(content)
54 repo.index.add([os.path.normpath(ifc_path)])
55 commit = repo.index.commit(message)
56 return commit.hexsha
57
58
59# ---------------------------------------------------------------------------

Calls 5

openFunction · 0.50
joinMethod · 0.45
writeMethod · 0.45
addMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected