#NEWLINE# @ _ensure_index_lock #NEWLINE# @ accepts ( Self ( ) , ZincManifest ) #NEWLINE# def update_bundle( self , new_manifest ) : #NEWLINE# #INDENT# assert new_manifest #NEWLINE# existing_versions = self . index . versions_for_bundle ( new_manifest . bundle_name ) #NEWLINE# if ( new_manifest . version in existing_versions ) : #NEWLINE# #INDENT# raise ValueError ( 'Bundle version already exists.' ) #NEWLINE# #UNINDENT# next_version = self . index . next_version_for_bundle ( new_manifest . bundle_name ) #NEWLINE# if ( new_manifest . version > next_version ) : #NEWLINE# #INDENT# raise ValueError ( 'Unexpected manifest version.' ) #NEWLINE# #UNINDENT# missing_shas = list ( ) #NEWLINE# info_by_path = dict ( ) #NEWLINE# for path in new_manifest . files . keys ( ) : #NEWLINE# #INDENT# sha = new_manifest . sha_for_file ( path ) #NEWLINE# file_info = self . _get_file_info ( sha ) #NEWLINE# if ( file_info is None ) : #NEWLINE# #INDENT# missing_shas . append ( sha ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# info_by_path [ path ] = file_info #NEWLINE# #UNINDENT# #UNINDENT# if ( len ( missing_shas ) > 0 ) : #NEWLINE# #INDENT# raise Exception ( ( 'Missing shas: %s' % missing_shas ) ) #NEWLINE# #UNINDENT# self . _write_manifest ( new_manifest ) #NEWLINE# self . index . add_version_for_bundle ( new_manifest . bundle_name , new_manifest . version )