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
|
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)
|
header = '%s %s' % (title, git_range)
|
||||||
print('\n%s' % header)
|
print('\n%s' % header)
|
||||||
print('-' * len(header))
|
print('-' * len(header))
|
||||||
subprocess.check_call([
|
subprocess.check_call(['git', 'log', '--no-color',
|
||||||
'git', 'log', '--no-color',
|
|
||||||
'--format=%h %ci %s', '--no-merges',
|
'--format=%h %ci %s', '--no-merges',
|
||||||
git_range,
|
git_range],
|
||||||
])
|
cwd=os.path.join(workdir, repo))
|
||||||
print()
|
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.
|
# 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
|
# If the sha for HEAD and the requested release don't
|
||||||
# match, show any unreleased changes on the branch. We ask
|
# match, show any unreleased changes on the branch. We ask
|
||||||
@ -154,6 +151,9 @@ def main():
|
|||||||
# Show more details about the commit being tagged.
|
# Show more details about the commit being tagged.
|
||||||
print()
|
print()
|
||||||
print('git describe %s' % project['hash'])
|
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
|
return 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user