#NEWLINE# @ staticmethod #NEWLINE# def add_git_remote( git_remote_name , remote_url , working_copy_dir , subprocess_runner ) : #NEWLINE# #INDENT# "Add the git specified git remote if it doesn't already exist.\n\n    Args:\n      git_remote_name: Name of the remote.\n      remote_url: URL remote name points to.\n      working_copy_dir: Directory to add git remote to.\n      subprocess_runner: Subprocess instance used to run commands.\n\n    Returns:\n      Name of the remote.\n\n    Raises:\n      subprocess.CalledProcessError: If git encounters an error.\n      GitError: If the remote already exists with an unexpected URL.\n    " #NEWLINE# for ( remote_name , url ) in Package . get_git_remotes ( working_copy_dir , subprocess_runner ) : #NEWLINE# #INDENT# if ( git_remote_name == remote_name ) : #NEWLINE# #INDENT# if ( remote_url != url ) : #NEWLINE# #INDENT# raise GitError ( ( 'Remote %s already exists with unexpected URL %s (expected %s)' % ( git_remote_name , url , remote_url ) ) ) #NEWLINE# #UNINDENT# return git_remote_name #NEWLINE# #UNINDENT# #UNINDENT# subprocess_runner . check_call ( [ 'git' , 'remote' , 'add' , git_remote_name , remote_url ] , cwd = working_copy_dir ) #NEWLINE# return git_remote_name