Merge "new_release: use sha from corresponding stable branches"
This commit is contained in:
commit
a435e4aae3
@ -104,7 +104,14 @@ def main():
|
||||
projects = []
|
||||
for project in last_release['projects']:
|
||||
gitutils.clone_repo(workdir, project['repo'])
|
||||
sha = gitutils.sha_for_tag(workdir, project['repo'], 'HEAD')
|
||||
|
||||
branches = gitutils.get_branches(workdir, project['repo'])
|
||||
version = 'origin/stable/%s' % series
|
||||
if not any(branch for branch in branches
|
||||
if branch.endswith(version)):
|
||||
version = 'master'
|
||||
|
||||
sha = gitutils.sha_for_tag(workdir, project['repo'], version)
|
||||
projects.append({
|
||||
'repo': project['repo'],
|
||||
'hash': sha,
|
||||
|
@ -116,3 +116,20 @@ def get_latest_tag(workdir, repo):
|
||||
print('WARNING failed to retrieve latest tag: %s [%s]' %
|
||||
(e, e.output.strip()))
|
||||
return None
|
||||
|
||||
|
||||
def get_branches(workdir, repo):
|
||||
try:
|
||||
output = subprocess.check_output(
|
||||
['git', 'branch', '-a'],
|
||||
cwd=os.path.join(workdir, repo),
|
||||
stderr=subprocess.STDOUT,
|
||||
).strip()
|
||||
return [
|
||||
branch
|
||||
for branch in output.split()
|
||||
]
|
||||
except subprocess.CalledProcessError as e:
|
||||
print('ERROR failed to retrieve list of branches: %s [%s]' %
|
||||
(e, e.output.strip()))
|
||||
return []
|
||||
|
Loading…
Reference in New Issue
Block a user