Skip to content

Commit 9b20189

Browse files
committed
Handle cases when the remote is not yet setup.
1 parent 9307526 commit 9b20189

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

git_repo/services/ext/gerrit.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@ def request_fetch(self, user, repo, request, pull=False, force=False):
147147
else:
148148
change_id = request.split('/')[3]
149149

150-
remote = self.repository.remote(self.name)
150+
try:
151+
remote = self.repository.remote(self.name)
152+
except ValueError as err:
153+
raise Exception('Remote "{remote}" is not setup. Please run `git {remote} add`'.format(remote=self.name))
151154
local_branch_name = 'requests/{}/{}'.format(self.name, change_id)
152155
self.fetch(remote, request, local_branch_name, force=force)
153156

0 commit comments

Comments
 (0)