<s> import os <EOL> from . . decorators import task , notify_result <EOL> @ task <EOL> @ notify_result <EOL> def clone_repository ( project , session , user_id = None ) : <EOL> """<STR_LIT>""" <EOL> result = { <EOL> '<STR_LIT>' : session , <EOL> '<STR_LIT:action>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : user_id , <EOL> '<STR_LIT>' : '<STR_LIT:error>' <EOL> } <EOL> if project . repository_path == '<STR_LIT>' : <EOL> result [ '<STR_LIT:message>' ] = """<STR_LIT>""" . format ( project . name ) <EOL> return result <EOL> project_path = project . get_path ( ) <EOL> if os . path . exists ( project_path ) : <EOL> result [ '<STR_LIT:message>' ] = """<STR_LIT>""" . format ( project . name ) + """<STR_LIT>""" . format ( project_path ) <EOL> return result <EOL> os . system ( '<STR_LIT>' . format ( project . repository_path , project_path ) ) <EOL> if not os . path . exists ( project_path ) : <EOL> result [ '<STR_LIT:message>' ] = """<STR_LIT>""" . format ( project . name ) + "<STR_LIT>" <EOL> return result <EOL> result [ '<STR_LIT>' ] = '<STR_LIT:success>' <EOL> result [ '<STR_LIT:message>' ] = '<STR_LIT>' . format ( project . name ) + "<STR_LIT>" <EOL> return result <EOL> @ task <EOL> @ notify_result <EOL> def remove_repository ( project , session , user_id = None ) : <EOL> """<STR_LIT>""" <EOL> result = { <EOL> '<STR_LIT>' : session , <EOL> '<STR_LIT:action>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:error>' , <EOL> '<STR_LIT>' : user_id <EOL> } <EOL> project_path = project . get_path ( ) <EOL> if not os . path . exists ( project_path ) : <EOL> result [ '<STR_LIT:message>' ] = """<STR_LIT>""" . format ( project . name ) + "<STR_LIT>" <EOL> return result <EOL> os . system ( '<STR_LIT>' . format ( project_path ) ) <EOL> if os . path . exists ( project_path ) : <EOL> result [ '<STR_LIT:message>' ] = """<STR_LIT>""" . format ( project . name ) + "<STR_LIT>" <EOL> return result <EOL> result [ '<STR_LIT>' ] = '<STR_LIT:success>' <EOL> result [ '<STR_LIT:message>' ] = """<STR_LIT>""" . format ( project . name , project_path ) <EOL> return result </s>
