Lines Matching full:commit
41 def is_commit_valid(commit: str) -> bool:
42 ret = subprocess.call(['git', 'cat-file', '-e', commit],
48 def branch_has_commit(upstream: str, branch: str, commit: str) -> bool:
50 Returns True if the commit is actually present in the branch
53 commit, upstream + '/' + branch],
59 def branch_has_backport_of_commit(upstream: str, branch: str, commit: str) -> str:
61 Returns the commit hash if the commit has been backported to the branch,
66 '--grep', 'cherry picked from commit ' + commit],
71 def canonicalize_commit(commit: str) -> str:
73 Takes a commit-ish and returns a commit sha1 if the commit exists
77 if not is_commit_valid(commit):
78 raise argparse.ArgumentTypeError('invalid commit identifier: ' + commit)
80 out = subprocess.check_output(['git', 'rev-parse', commit],
109 Returns 0 if the commit is present in the branch,
111 and 2 if it couldn't be determined (eg. invalid commit)
113 parser.add_argument('commit',
115 help='commit sha1')
130 if branch_has_commit(upstream, branch, args.commit):
131 print_(args, True, 'Commit ' + args.commit + ' is in branch ' + branch)
134 backport = branch_has_backport_of_commit(upstream, branch, args.commit)
137 … 'Commit ' + args.commit + ' was backported to branch ' + branch + ' as commit ' + backport)
140 print_(args, False, 'Commit ' + args.commit + ' is NOT in branch ' + branch)