#NEWLINE# def _SyncManifest( self , opt ) : #NEWLINE# #INDENT# m = self . manifest . manifestProject #NEWLINE# is_new = ( not m . Exists ) #NEWLINE# if is_new : #NEWLINE# #INDENT# if ( not opt . manifest_url ) : #NEWLINE# #INDENT# print ( 'fatal: manifest url (-u) is required.' , file = sys . stderr ) #NEWLINE# sys . exit ( 1 ) #NEWLINE# #UNINDENT# if ( not opt . quiet ) : #NEWLINE# #INDENT# print ( ( 'Get %s' % GitConfig . ForUser ( ) . UrlInsteadOf ( opt . manifest_url ) ) , file = sys . stderr ) #NEWLINE# #UNINDENT# mirrored_manifest_git = None #NEWLINE# if opt . reference : #NEWLINE# #INDENT# manifest_git_path = urllib . parse . urlparse ( opt . manifest_url ) . path [ 1 : ] #NEWLINE# mirrored_manifest_git = os . path . join ( opt . reference , manifest_git_path ) #NEWLINE# if ( not mirrored_manifest_git . endswith ( '.git' ) ) : #NEWLINE# #INDENT# mirrored_manifest_git += '.git' #NEWLINE# #UNINDENT# if ( not os . path . exists ( mirrored_manifest_git ) ) : #NEWLINE# #INDENT# mirrored_manifest_git = os . path . join ( ( opt . reference + '/.repo/manifests.git' ) ) #NEWLINE# #UNINDENT# #UNINDENT# m . _InitGitDir ( mirror_git = mirrored_manifest_git ) #NEWLINE# if opt . manifest_branch : #NEWLINE# #INDENT# m . revisionExpr = opt . manifest_branch #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# m . revisionExpr = 'refs/heads/master' #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if opt . manifest_branch : #NEWLINE# #INDENT# m . revisionExpr = manifest_git_path . manifest_branch #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# m . PreSync ( ) #NEWLINE# #UNINDENT# #UNINDENT# if opt . manifest_url : #NEWLINE# #INDENT# r = m . GetRemote ( m . remote . name ) #NEWLINE# r . url = opt . manifest_url #NEWLINE# r . ResetFetch ( ) #NEWLINE# r . Save ( ) #NEWLINE# #UNINDENT# groups = re . split ( '[,\\s]+' , opt . groups ) #NEWLINE# all_platforms = [ 'linux' , 'darwin' ] #NEWLINE# platformize = ( lambda x : ( 'platform-' + x ) ) #NEWLINE# if ( opt . platform == 'auto' ) : #NEWLINE# #INDENT# if ( ( not opt . mirror ) and ( not ( m . config . GetString ( 'repo.mirror' ) == 'true' ) ) ) : #NEWLINE# #INDENT# groups . append ( platformize ( platform . system ( ) . lower ( ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( opt . platform == 'all' ) : #NEWLINE# #INDENT# groups . extend ( map ( platformize , all_platforms ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( opt . platform in all_platforms ) : #NEWLINE# #INDENT# groups . extend ( platformize ( opt . platform ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( opt . platform != 'none' ) : #NEWLINE# #INDENT# print ( 'fatal: invalid platform flag' , file = sys . stderr ) #NEWLINE# sys . exit ( 1 ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# groups = [ x for x in groups if x ] #NEWLINE# groupstr = ',' . join ( groups ) #NEWLINE# if ( ( opt . platform == 'auto' ) and ( groupstr == ( 'default,platform-' + platform . system ( ) . lower ( ) ) ) ) : #NEWLINE# #INDENT# groupstr = None #NEWLINE# #UNINDENT# m . config . SetString ( 'manifest.groups' , groupstr ) #NEWLINE# if opt . reference : #NEWLINE# #INDENT# m . config . SetString ( 'repo.reference' , opt . reference ) #NEWLINE# #UNINDENT# if opt . archive : #NEWLINE# #INDENT# if is_new : #NEWLINE# #INDENT# m . config . SetString ( 'repo.archive' , 'true' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# print ( 'fatal: --archive is only supported when initializing a new workspace.' , file = sys . stderr ) #NEWLINE# print ( 'Either delete the .repo folder in this workspace, or initialize in another location.' , file = sys . stderr ) #NEWLINE# sys . exit ( 1 ) #NEWLINE# #UNINDENT# #UNINDENT# if opt . mirror : #NEWLINE# #INDENT# if is_new : #NEWLINE# #INDENT# m . config . SetString ( 'repo.mirror' , 'true' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# print ( 'fatal: --mirror is only supported when initializing a new workspace.' , file = sys . stderr ) #NEWLINE# print ( 'Either delete the .repo folder in this workspace, or initialize in another location.' , file = sys . stderr ) #NEWLINE# sys . exit ( 1 ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not m . Sync_NetworkHalf ( is_new = is_new ) ) : #NEWLINE# #INDENT# r = m . GetRemote ( m . remote . name ) #NEWLINE# print ( ( 'fatal: cannot obtain manifest %s' % r . url ) , file = sys . stderr ) #NEWLINE# if is_new : #NEWLINE# #INDENT# shutil . rmtree ( m . gitdir ) #NEWLINE# #UNINDENT# sys . exit ( 1 ) #NEWLINE# #UNINDENT# if opt . manifest_branch : #NEWLINE# #INDENT# m . MetaBranchSwitch ( ) #NEWLINE# #UNINDENT# syncbuf = SyncBuffer ( m . config ) #NEWLINE# m . Sync_LocalHalf ( syncbuf ) #NEWLINE# syncbuf . Finish ( ) #NEWLINE# if ( is_new or ( m . CurrentBranch is None ) ) : #NEWLINE# #INDENT# if ( not m . StartBranch ( 'default' ) ) : #NEWLINE# #INDENT# print ( 'fatal: cannot create default in manifest' , file = sys . stderr ) #NEWLINE# sys . exit ( 1 )