#NEWLINE# def clone( self , destination_dir , revision = None ) : #NEWLINE# #INDENT# repo = self . _initialize_repo ( ) #NEWLINE# if revision : #NEWLINE# #INDENT# if ( ( revision != self . branch ) and ( revision not in repo . tags ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# repo . git . fetch ( 'origin' , 'tag' , revision , depth = 1 ) #NEWLINE# #UNINDENT# except GitCommandError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# repo . git . checkout ( revision ) #NEWLINE# #UNINDENT# if isdir ( destination_dir ) : #NEWLINE# #INDENT# rmtree ( destination_dir ) #NEWLINE# #UNINDENT# copytree ( repo . working_tree_dir , destination_dir ) #NEWLINE# rmtree ( join ( destination_dir , '.git' ) )