Make subprocess chdir instead of changing global state
Have each subprocess call change its working directory instead of shifting the working dir for the entire process. Change-Id: Ia1ada14bac7bc6b3b006c1ef8930192761111877
This commit is contained in:
parent
f9316142a9
commit
c2f515659b
@ -31,15 +31,14 @@ from openstack_releases import defaults
|
||||
from openstack_releases import gitutils
|
||||
|
||||
|
||||
def git_log(title, git_range):
|
||||
def git_log(workdir, repo, title, git_range):
|
||||
header = '%s %s' % (title, git_range)
|
||||
print('\n%s' % header)
|
||||
print('-' * len(header))
|
||||
subprocess.check_call([
|
||||
'git', 'log', '--no-color',
|
||||
'--format=%h %ci %s', '--no-merges',
|
||||
git_range,
|
||||
])
|
||||
subprocess.check_call(['git', 'log', '--no-color',
|
||||
'--format=%h %ci %s', '--no-merges',
|
||||
git_range],
|
||||
cwd=os.path.join(workdir, repo))
|
||||
print()
|
||||
|
||||
|
||||
@ -126,11 +125,9 @@ def main():
|
||||
]
|
||||
)
|
||||
|
||||
# Move into the repository we just checked out.
|
||||
os.chdir(os.path.join(workdir, project['repo']))
|
||||
|
||||
# Show the changes since the last release.
|
||||
git_log('Release will include', git_range)
|
||||
git_log(workdir, project['repo'],
|
||||
'Release will include', git_range)
|
||||
|
||||
# If the sha for HEAD and the requested release don't
|
||||
# match, show any unreleased changes on the branch. We ask
|
||||
@ -154,6 +151,9 @@ def main():
|
||||
# Show more details about the commit being tagged.
|
||||
print()
|
||||
print('git describe %s' % project['hash'])
|
||||
subprocess.check_call(['git', 'describe', project['hash']])
|
||||
subprocess.check_call(
|
||||
['git', 'describe', project['hash']],
|
||||
cwd=os.path.join(workdir, project['repo']),
|
||||
)
|
||||
|
||||
return 0
|
||||
|
Loading…
Reference in New Issue
Block a user