#NEWLINE# def switch_to_branch( vcs , branchname , do_cleanup = False ) : #NEWLINE# #INDENT# if ( vcs == 'git' ) : #NEWLINE# #INDENT# cmd = [ 'git' , 'checkout' , do_cleanup ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( vcs == 'hg' ) : #NEWLINE# #INDENT# cmd = [ 'hg' , 'update' , '-C' , branchname ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( ( "Sorry, %s isn't supported (yet?)" % vcs ) ) #NEWLINE# #UNINDENT# #UNINDENT# if do_cleanup : #NEWLINE# #INDENT# remove_pycs ( vcs = vcs ) #NEWLINE# #UNINDENT# subprocess . check_call ( cmd , stdout = subprocess . PIPE , stderr = subprocess . PIPE )