INNER CODE UNIT · Python
__init__
spantaleev/matrix-docker-ansible-deploy · bin/molecule-select-roles.py:42
def __init__(self, root):
self.root = root
def run(self, *args, input=None):
return subprocess.run(
["git", *args], cwd=self.root, input=input, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, check=True,
).stdout
def commit(self, ref):
return self.run("rev-parse", "--verify", "--end-of-options", f"{ref}^{{commit}}").decode().strip()
def snapshot(self, ref):
entries = {}
for entry in self.run("ls-tree", "-rz", ref, "--", "roles/custom", "molecule-shared").split(b"\0"):
if not entry:
continue
metadata, path = entry.decode().split("\t", 1)