#NEWLINE# def update( self ) : #NEWLINE# #INDENT# if ( not lib . which ( 'git' ) ) : #NEWLINE# #INDENT# self . logger . warn ( 'git is not installed! Please install git to install this feature.' ) #NEWLINE# return #NEWLINE# #UNINDENT# install_dir = self . directory . install_directory ( self . feature_name ) #NEWLINE# git_root = self . target . get ( 'git_root' , None ) #NEWLINE# target_path = ( git_root or install_dir ) #NEWLINE# source_branch = self . source . get ( 'branch' , 'master' ) #NEWLINE# target_branch = self . target . get ( 'branch' , 'master' ) #NEWLINE# git_opts = { #NEWLINE# #INDENT# 'repo' : self . target . get ( 'url' ) , #NEWLINE# 'branch' : target_branch , #NEWLINE# 'dir' : target_path , #NEWLINE# #UNINDENT# } #NEWLINE# if ( ( not target_path ) or ( not os . path . exists ( target_path ) ) or ( not self . __git ( CURRENT_BRANCH , git_opts ) [ 1 ] ) ) : #NEWLINE# #INDENT# self . logger . debug ( 'No repository cloned. Re-cloning...' ) #NEWLINE# self . __clone_repo ( git_opts ) #NEWLINE# #UNINDENT# current_remote = self . __git ( CURRENT_REMOTE , git_opts ) [ 1 ] #NEWLINE# current_branch = self . __git ( CURRENT_BRANCH , git_opts ) [ 1 ] #NEWLINE# if ( current_remote != self . target . get ( 'url' ) ) : #NEWLINE# #INDENT# self . logger . debug ( 'Updating origin url...' ) #NEWLINE# self . __git ( UPDATE_ORIGIN , git_opts ) #NEWLINE# #UNINDENT# if ( current_branch != target_branch ) : #NEWLINE# #INDENT# self . __git ( UPDATE_OFFLINE_BRANCH , git_opts ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . __fetch_merge_repo ( git_opts ) #NEWLINE# #UNINDENT# if ( ( current_branch == install_dir ) and ( current_branch != target_branch ) ) : #NEWLINE# #INDENT# self . __checkout_branch ( git_opts ) #NEWLINE# #UNINDENT# FormulaBase . update ( self ) #NEWLINE# return True