<s> import sublime <EOL> from sublime_plugin import TextCommand <EOL> from ... core . git_command import GitCommand <EOL> from . . import github <EOL> from . . import git_mixins <EOL> class GsAddForkAsRemoteCommand ( TextCommand , GitCommand , git_mixins . GithubRemotesMixin ) : <EOL> """<STR_LIT>""" <EOL> def run ( self , edit ) : <EOL> sublime . set_timeout_async ( self . run_async , <NUM_LIT:0> ) <EOL> def run_async ( self ) : <EOL> base_remote = github . parse_remote ( self . get_integrated_remote_url ( ) ) <EOL> forks = github . get_forks ( base_remote ) <EOL> base_repo_data = github . get_repo_data ( base_remote ) <EOL> parent = None <EOL> self . gh_remotes = [ ] <EOL> if "<STR_LIT>" in base_repo_data : <EOL> parent = ( base_repo_data [ "<STR_LIT>" ] [ "<STR_LIT>" ] , <EOL> base_repo_data [ "<STR_LIT>" ] [ "<STR_LIT>" ] , <EOL> base_repo_data [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT>" ] ) <EOL> self . gh_remotes . append ( parent ) <EOL> if "<STR_LIT:source>" in base_repo_data : <EOL> source = ( base_repo_data [ "<STR_LIT:source>" ] [ "<STR_LIT>" ] , <EOL> base_repo_data [ "<STR_LIT:source>" ] [ "<STR_LIT>" ] , <EOL> base_repo_data [ "<STR_LIT:source>" ] [ "<STR_LIT>" ] [ "<STR_LIT>" ] ) <EOL> if not parent == source : <EOL> self . gh_remotes . append ( [ source , "<STR_LIT>" ] ) <EOL> self . gh_remotes += [ <EOL> ( fork [ "<STR_LIT>" ] , <EOL> fork [ "<STR_LIT>" ] , <EOL> fork [ "<STR_LIT>" ] [ "<STR_LIT>" ] ) <EOL> for fork in forks <EOL> ] <EOL> self . view . window ( ) . show_quick_panel ( [ remote [ <NUM_LIT:0> ] for remote in self . gh_remotes ] , self . on_select ) <EOL> def on_select ( self , idx ) : <EOL> if idx == - <NUM_LIT:1> : <EOL> return <EOL> full_name , url , owner = self . gh_remotes [ idx ] <EOL> self . git ( "<STR_LIT>" , "<STR_LIT>" , owner , url ) <EOL> sublime . status_message ( "<STR_LIT>" . format ( owner ) ) </s>
