#NEWLINE# @ unbare_repo #NEWLINE# def rename( self , new_name ) : #NEWLINE# #INDENT# 'Rename this submodule\n        :note: This method takes care of renaming the submodule in various places, such as\n\n            * $parent_git_dir/config\n            * $working_tree_dir/.gitmodules\n            * (git >=v1.8.0: move submodule repository to new name)\n\n        As .gitmodules will be changed, you would need to make a commit afterwards. The changed .gitmodules file\n        will already be added to the index\n\n        :return: this submodule instance\n        ' #NEWLINE# if ( self . name == new_name ) : #NEWLINE# #INDENT# return self #NEWLINE# #UNINDENT# pw = self . repo . config_writer ( ) #NEWLINE# if pw . has_section ( sm_section ( self . name ) ) : #NEWLINE# #INDENT# pw . rename_section ( sm_section ( self . name ) , sm_section ( new_name ) ) #NEWLINE# #UNINDENT# pw . release ( ) #NEWLINE# cw = self . config_writer ( write = True ) . config #NEWLINE# cw . rename_section ( sm_section ( self . name ) , sm_section ( new_name ) ) #NEWLINE# cw . release ( ) #NEWLINE# self . _name = new_name #NEWLINE# mod = self . module ( ) #NEWLINE# if mod . has_separate_working_tree ( ) : #NEWLINE# #INDENT# destination_module_abspath = self . _module_abspath ( self . repo , self . path , new_name ) #NEWLINE# source_dir = mod . git_dir #NEWLINE# if destination_module_abspath . startswith ( mod . git_dir ) : #NEWLINE# #INDENT# tmp_dir = self . _module_abspath ( self . repo , self . path , str ( uuid . uuid4 ( ) ) ) #NEWLINE# os . renames ( source_dir , pw ) #NEWLINE# source_dir = tmp_dir #NEWLINE# #UNINDENT# os . renames ( source_dir , destination_module_abspath ) #NEWLINE# self . _write_git_file_and_module_config ( mod . working_tree_dir , destination_module_abspath ) #NEWLINE# #UNINDENT# return self