show the branches containing the commit being tagged

We've had a few cases of folks tagging master instead of a stable
branch, so show the list of branches explicitly until we improve the
validation to automatically detect the mistake.

Change-Id: I27c0b2705ef3ba737937aaf80e8879768703c007
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann
2016-03-30 18:26:29 -04:00
parent a4823650c4
commit 4ec856daf9

View File

@@ -58,6 +58,14 @@ def git_log(workdir, repo, title, git_range, extra_args=[]):
print()
def git_branch_contains(workdir, repo, title, commit):
header('%s %s' % (title, commit))
cmd = ['git', 'branch', '-r', '--contains', commit]
print('\n' + ' '.join(cmd) + '\n')
subprocess.check_call(cmd, cwd=os.path.join(workdir, repo))
print()
def git_diff(workdir, repo, git_range, file_pattern):
repo_dir = os.path.join(workdir, repo)
files = list(glob.glob(os.path.join(repo_dir,
@@ -190,6 +198,13 @@ def main():
ref=project['hash'],
)
git_branch_contains(
workdir=workdir,
repo=project['repo'],
title='Branches containing commit',
commit=project['hash'],
)
head_sha = gitutils.sha_for_tag(workdir, project['repo'], 'HEAD')
requested_sha = gitutils.sha_for_tag(
workdir,