8000 Add workaround for travis commit being wrong. · 87sanchavan/python-docs-samples@2ec46c9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2ec46c9

Browse files
author
Jon Wayne Parrott
committed
Add workaround for travis commit being wrong.
Change-Id: I885fd9a43b5069424b87fc90e3369023ae1477f5
1 parent 5d1f8c8 commit 2ec46c9

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

nox.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,25 @@ def get_changed_files():
9696
changed = subprocess.check_output(
9797
['git', 'show', '--pretty=format:', '--name-only',
9898
os.environ.get('TRAVIS_COMMIT')])
99+
99100
elif pr is not None:
100-
changed = subprocess.check_output(
101-
['git', 'diff', '--name-only',
102-
os.environ.get('TRAVIS_COMMIT'),
103-
os.environ.get('TRAVIS_BRANCH')])
101+
try:
102+
changed = subprocess.check_output(
103+
['git', 'diff', '--name-only',
104+
os.environ.get('TRAVIS_COMMIT'),
105+
os.environ.get('TRAVIS_BRANCH')])
106+
107+
except subprocess.CalledProcessError:
108+
# Fallback to git head.
109+
git_head = subprocess.check_output(
110+
['git', 'rev-parse', 'HEAD']).strip()
111+
112+
print('Falling back to HEAD: {}'.format(git_head))
113+
114+
changed = subprocess.check_output(
115+
['git', 'diff', '--name-only',
116+
os.environ.get('TRAVIS_COMMIT'),
117+
os.environ.get('TRAVIS_BRANCH')])
104118
else:
105119
changed = ''
106120
print('Uh... where are we?')

0 commit comments

Comments
 (0)
0