def _get_remote(repo, name):
"""
Gets the remote object raising a MissingRemoteException
when it does not exist
:param Repo repo:
:param unicode name: The remote name
:return: The remote object
:rtype: git.remote.Remote
:raises: MissingRemoteException
"""
try:
return repo.remotes[name]
except IndexError: # I have no idea why they raise an IndexError instead of KeyError
raise MissingRemoteException('The remote "{0}" does not exist. '
'Please select a different remote or'
' add it using "git remote add" command')
评论列表
文章目录