def deps(repo: Optional[RepoSpec], format: str, file: Optional[str], on_uncloned: str) -> Iterable[str]:
if file is not None:
file = Path(file)
if not file.exists():
raise ValueError(f"Dependency file does not exist: {file}")
t = Template(format)
for clone in iterDeps(repo, on_uncloned, file):
try:
hexsha = git.Repo(str(clone.path)).head.commit.hexsha
except:
hexsha = '0' * 40
try:
yield t.substitute(
H = hexsha,
h = hexsha[:7],
RS = clone.repospec.str(),
rs = clone.repospec.str(False, False),
p = str(clone.path),
)
except KeyError as e:
raise ValueError("Invalid format string specifier: %s" % e)
评论列表
文章目录