def diff_of_commits_between(run, upstream: str, head: str) -> Iterable[str]: cmd = cherry(upstream, head) proc = run(cmd) stdout = proc_to_stdout(proc) for sign, commit in columns(stdout): if sign == '+': yield commit
def test_proc_to_pocess(): proc = Popen(['echo', 'hello world'], stdout=PIPE, universal_newlines=True, shell=True) assert list(line.strip('"\n') for line in proc_to_stdout(proc)) == ['hello world']
def fetch_tags_and_sha(run, match_tag): proc = run(TAGS_WITH_COMMIT_SHA_CMD) stdout = proc_to_stdout(proc) return ( (tag_and_maybe_sha[0], tag_and_maybe_sha[1]) for tag_and_maybe_sha in columns(stdout) if len(tag_and_maybe_sha) > 1 and match_tag(tag_and_maybe_sha[0]) )
def date_from_git_objects(run, objects: Iterable[str]) -> List[int]: cmd = show(objects=objects, diff=False, format='%at') proc = run(cmd) stdout = proc_to_stdout(proc) return list(int(line) for line in stdout)
def tags_with_author_date(run) -> Iterable[Tuple[str, int]]: proc = run(TAGS_WITH_AUTHOR_DATE_CMD) stdout = proc_to_stdout(proc) return parse_tags_with_author_date(stdout)