diff options
author | Luis Hector Chavez <lhchavez@google.com> | 2016-09-15 13:25:03 -0700 |
---|---|---|
committer | Luis Hector Chavez <lhchavez@google.com> | 2016-09-15 13:28:29 -0700 |
commit | d8f3675ac0710d430e5d8c6f9a452b896f2bee7c (patch) | |
tree | 7e813d17a0175d8c6077dfe23941b6ede0869e9b | |
parent | a49a37499e11729137772949e4330a070125b538 (diff) | |
download | repohooks-d8f3675ac0710d430e5d8c6f9a452b896f2bee7c.tar.gz |
hooks: Make the error when upstream not found more actionable
Currently a stack trace is spit when a change is tried to be uploaded
before running `repo start` on a project. This change replaces that
stack trace with a terser error and instructions to run repo start.
Bug: None
Test: Tried to upload this before calling repo start. Complained.
Change-Id: I01578041fe8fab954c53e8d66750ca6160c62f33
-rwxr-xr-x | pre-upload.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pre-upload.py b/pre-upload.py index 81720a5..ec723e1 100755 --- a/pre-upload.py +++ b/pre-upload.py @@ -158,7 +158,12 @@ def _run_project_hooks(project_name, proj_dir=None, return True # Set up the environment like repo would with the forall command. - remote = rh.git.get_upstream_remote() + try: + remote = rh.git.get_upstream_remote() + except rh.utils.RunCommandError as e: + print('upstream remote cannot be found: %s' % (e,), file=sys.stderr) + print('Did you run repo start?', file=sys.stderr) + sys.exit(1) os.environ.update({ 'REPO_PROJECT': project_name, 'REPO_PATH': proj_dir, |