def main(): commits = query_open_commits() for commit in commits: if not commit.is_reviewed() and len(commit.patchsets) > 1 and commit.patchsets[-2].review == 2: if test_if_last_patchet_is_cherry_pick(commit): commit.review(+2, "Propagating review value from previous commit.") if previous_patchset_was_submitted(commit): commit.submit("Propagating SUBMIT from previous commit.")
def get_open_commits(): commits = list(query_open_commits()) commits.sort(key=lambda commit: commit.number) return commits