always look for the .gitreview file in root of repo
The build may not be happening in the root of the repository, so look for that directory explicitly before trying to read the .gitreview file. Change-Id: I75e952c567d8387d3c620a2b005474ad2441f086 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
ae47423826
commit
9a5c51991d
|
@ -124,9 +124,18 @@ def _get_series_name():
|
|||
"Return string name of release series, or 'latest'"
|
||||
global _series
|
||||
if _series is None:
|
||||
try:
|
||||
git_root_dir = subprocess.check_output(
|
||||
['git', 'rev-parse', '--show-toplevel'],
|
||||
).decode('utf-8').strip()
|
||||
except Exception:
|
||||
logger.warning('Cannot find git top directory, assuming "."')
|
||||
git_root_dir = '.'
|
||||
parser = configparser.ConfigParser()
|
||||
# TODO(stephenfin): Should this be relative to some directory?
|
||||
parser.read('.gitreview')
|
||||
in_file = os.path.join(git_root_dir, '.gitreview')
|
||||
parsed = parser.read(in_file)
|
||||
if not parsed:
|
||||
logger.info('No {} found'.format(in_file))
|
||||
try:
|
||||
branch = parser.get('gerrit', 'defaultbranch')
|
||||
except configparser.Error:
|
||||
|
|
Loading…
Reference in New Issue