SourceCodeManagerUtilitiesForContainerBasedManagers.st
changeset 3367 dc9d785a4ca7
parent 3362 0ede9d87d347
child 3373 ef0f9ee70942
child 3400 97f0b44adc03
equal deleted inserted replaced
3366:ec8284efff96 3367:dc9d785a4ca7
    34 "
    34 "
    35 ! !
    35 ! !
    36 
    36 
    37 !SourceCodeManagerUtilitiesForContainerBasedManagers methodsFor:'utilities-cvs'!
    37 !SourceCodeManagerUtilitiesForContainerBasedManagers methodsFor:'utilities-cvs'!
    38 
    38 
    39 checkinBuildSupportFilesForPackage:packageID 
    39 checkinBuildSupportFilesForPackage:packageID withInfo:checkinInfo
    40     |anyFailure module directory mgr defClass |
    40     |anyFailure module directory mgr defClass |
    41 
    41 
    42     mgr := self sourceCodeManagerFor: packageID. 
    42     mgr := self sourceCodeManagerFor: packageID. 
    43     defClass := ProjectDefinition definitionClassForPackage: packageID.
    43     defClass := ProjectDefinition definitionClassForPackage: packageID.
    44 
    44 
    72 
    72 
    73         UserInformation
    73         UserInformation
    74             handle:[:ex | Transcript showCR:ex description ]
    74             handle:[:ex | Transcript showCR:ex description ]
    75             do:[
    75             do:[
    76                 (mgr isContainerBased
    76                 (mgr isContainerBased
    77                 and:[
    77                  and:[(mgr checkForExistingContainer:realFileName inModule:module directory:realDirectory) not]
    78                     (mgr checkForExistingContainer:realFileName inModule:module directory:realDirectory) not
    78                 ) ifTrue:[
    79                 ]) ifTrue:[
       
    80                     realDirectory ~= directory ifTrue:[
    79                     realDirectory ~= directory ifTrue:[
    81                         (mgr checkForExistingModule:module directory:realDirectory) ifFalse:[
    80                         (mgr checkForExistingModule:module directory:realDirectory) ifFalse:[
    82                             mgr createModule:module directory:realDirectory
    81                             mgr createModule:module directory:realDirectory
    83                         ].
    82                         ].
    84                     ].
    83                     ].
   103                     (mgr
   102                     (mgr
   104                         checkin:realFileName
   103                         checkin:realFileName
   105                         text:fileContents
   104                         text:fileContents
   106                         directory:realDirectory
   105                         directory:realDirectory
   107                         module:module
   106                         module:module
   108                         logMessage:'automatically generated by browser'
   107                         logMessage:checkinInfo logMessage
   109                         force:false)
   108                         force:false
   110                             ifFalse:[
   109                     ) ifTrue:[
   111                                 Transcript showCR:'checkin of ' , realFileName , ' failed'.
   110                         checkinInfo isStable ifTrue:[
   112                                 anyFailure := true.
   111                             self tagPath:(module, '/', realDirectory, '/', realFileName) as:#stable usingManager:mgr.
   113                             ].
   112                         ].
       
   113                         checkinInfo tagIt ifTrue:[
       
   114                             self tagPath:(module, '/', realDirectory, '/', realFileName) as:checkinInfo tag usingManager:mgr.
       
   115                         ].
       
   116                     ] ifFalse:[
       
   117                         Transcript showCR:'checkin of ' , realFileName , ' failed'.
       
   118                         anyFailure := true.
       
   119                     ].
   114                 ].
   120                 ].
   115             ].
   121             ].
   116     ].
   122     ].
   117 
   123 
   118     defClass instAndClassMethodsDo:[:m | m package:defClass package].
   124     defClass instAndClassMethodsDo:[:m | m package:defClass package].
   119 
   125 
   120     self
   126     self
   121         checkinClasses:(Array with:defClass)
   127         checkinClasses:(Array with:defClass)
   122         withInfo:'automatic checkIn'
   128         withInfo:checkinInfo
   123         withCheck:false.
   129         withCheck:false.
   124 
   130 
   125 
   131 
   126     self activityNotification:nil.
   132     self activityNotification:nil.
   127 
   133 
   507      msg classesInChangeSet newClasses checkinInfo originalCheckinInfo classesToTag|
   513      msg classesInChangeSet newClasses checkinInfo originalCheckinInfo classesToTag|
   508 
   514 
   509     mgr := self sourceCodeManagerFor: packageToCheckIn.
   515     mgr := self sourceCodeManagerFor: packageToCheckIn.
   510 
   516 
   511     classesToCheckIn := IdentitySet new.
   517     classesToCheckIn := IdentitySet new.
       
   518     classesInChangeSet := IdentitySet new.
   512     methodsToCheckIn := IdentitySet new.
   519     methodsToCheckIn := IdentitySet new.
   513     methodsInOtherPackages := IdentitySet new.
   520     methodsInOtherPackages := IdentitySet new.
   514     looseMethods := IdentitySet new.
   521     looseMethods := IdentitySet new.
   515 
   522 
   516     "/ collect classes and individual methods...
   523     "/ collect classes and individual methods...
   517     Smalltalk allClassesDo:[:aClass | 
   524     (doClasses or:[doExtensions]) ifTrue:[
   518         |owner classPackage|
   525         Smalltalk allClassesDo:[:aClass | 
   519 
   526             |owner classPackage|
   520         (owner := aClass owningClass) notNil ifTrue:[
   527 
   521             classPackage := aClass topOwningClass package
   528             (owner := aClass owningClass) notNil ifTrue:[
   522         ] ifFalse:[
   529                 classPackage := aClass topOwningClass package
   523             classPackage := aClass package
   530             ] ifFalse:[
   524         ].
   531                 classPackage := aClass package
   525         (classPackage = packageToCheckIn) ifTrue:[
   532             ].
   526             classesToCheckIn add:aClass.
   533             (classPackage = packageToCheckIn) ifTrue:[
   527         ].
   534                 classesToCheckIn add:aClass.
   528 
   535             ].
   529         doExtensions ifTrue:[
   536 
   530             aClass isMeta ifFalse:[
   537             doExtensions ifTrue:[
   531                 "/ ... whose class is not in the checkIn-set
   538                 aClass isMeta ifFalse:[
   532                 (classesToCheckIn includes:aClass) ifFalse:[
   539                     "/ ... whose class is not in the checkIn-set
   533                     aClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
   540                     (classesToCheckIn includes:aClass) ifFalse:[
   534                         "/ methods in this project ...
   541                         aClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
   535                         (mthd package = packageToCheckIn) ifTrue:[
   542                             "/ methods in this project ...
   536                             methodsToCheckIn add:mthd
   543                             (mthd package = packageToCheckIn) ifTrue:[
       
   544                                 methodsToCheckIn add:mthd
       
   545                             ]
   537                         ]
   546                         ]
   538                     ]
   547                     ].
   539                 ].
   548                 ].
   540             ].
   549             ].
   541         ].
   550         ].
   542     ].
   551 
   543 
   552         "/ cg: O(n^2) algorithm
   544     "/ cg: O(n^2) algorithm
   553         "/  classesInChangeSet := classesToCheckIn select:[:cls | cls hasUnsavedChanges].
   545     "/  classesInChangeSet := classesToCheckIn select:[:cls | cls hasUnsavedChanges].
   554         "/ replaced by: O(n) algorithm
   546     "/ replaced by: O(n) algorithm
   555         classesInChangeSet := ChangeSet current selectClassesForWhichIncludesChangeForClassOrMetaclassOrPrivateClassFrom:classesToCheckIn. 
   547     classesInChangeSet := ChangeSet current selectClassesForWhichIncludesChangeForClassOrMetaclassOrPrivateClassFrom:classesToCheckIn. 
   556     ].
   548 
   557 
   549     doExtensions ifTrue:[
   558     doExtensions ifTrue:[
   550         methodsToCheckIn notEmpty ifTrue:[
   559         methodsToCheckIn notEmpty ifTrue:[
   551             doClasses ifTrue:[
   560             doClasses ifTrue:[
   552                 msg := '%1 classes (%4 changed) '.
   561                 msg := '%1 classes (%4 changed) '.
   629             ]
   638             ]
   630         ].
   639         ].
   631     ].
   640     ].
   632 
   641 
   633     checkinInfo isNil ifTrue:[
   642     checkinInfo isNil ifTrue:[
       
   643         |infoString|
       
   644 
       
   645         doExtensions ifTrue:[
       
   646             infoString := '%1 classes (%4 changed) and %2 extensions for project "%3"'.
       
   647         ] ifFalse:[doClasses ifTrue:[
       
   648             infoString := '%1 classes (%4 changed) for project "%3"'.
       
   649         ] ifFalse:[doBuild ifTrue:[
       
   650             infoString := 'Build support files for project "%3"'.
       
   651         ] ifFalse:[
       
   652             infoString := 'I don''t know what I am doing'.
       
   653         ]]].
       
   654 
       
   655         infoString := infoString
       
   656                         bindWith:classesToCheckIn size
       
   657                         with:methodsToCheckIn size
       
   658                         with:packageToCheckIn allBold
       
   659                         with:classesInChangeSet size.
       
   660     
   634         checkinInfo := self
   661         checkinInfo := self
   635                     getCheckinInfoFor:((doExtensions 
   662                     getCheckinInfoFor:infoString
   636                                           ifTrue:['%1 classes (%4 changed) and %2 extensions for project "%3"']
       
   637                                           ifFalse:['%1 classes (%4 changed) for project "%3"'])
       
   638                                             bindWith:classesToCheckIn size
       
   639                                             with:methodsToCheckIn size
       
   640                                             with:packageToCheckIn allBold
       
   641                                             with:classesInChangeSet size)
       
   642                     initialAnswer:nil
   663                     initialAnswer:nil
   643                     withQuickOption:(classesToCheckIn size > 0)
   664                     withQuickOption:(classesToCheckIn size > 0)
   644                     withValidateConsistencyOption:true.
   665                     withValidateConsistencyOption:true.
   645         checkinInfo isNil ifTrue:[
   666         checkinInfo isNil ifTrue:[
   646             ^ self.
   667             ^ self.
   652 
   673 
   653     checkinInfo quickCheckIn ifTrue:[
   674     checkinInfo quickCheckIn ifTrue:[
   654         (checkinInfo isStable or:[checkinInfo tagIt]) ifTrue:[
   675         (checkinInfo isStable or:[checkinInfo tagIt]) ifTrue:[
   655             classesToTag := classesToCheckIn.
   676             classesToTag := classesToCheckIn.
   656             originalCheckinInfo := checkinInfo.
   677             originalCheckinInfo := checkinInfo.
   657             checkinInfo := checkinInfo copy.
   678             checkinInfo := checkinInfo deepCopy.
   658             checkinInfo isStable:false.
   679             checkinInfo isStable:false.
   659             checkinInfo tag:nil.
   680             checkinInfo tag:nil.
   660         ].
   681         ].
   661         "/ not only the one's in the changeSet;
   682         "/ not only the one's in the changeSet;
   662         "/ also those which have not been checked in before.
   683         "/ also those which have not been checked in before.
   754             ].
   775             ].
   755         ].
   776         ].
   756     ].
   777     ].
   757 
   778 
   758     doBuild ifTrue:[
   779     doBuild ifTrue:[
   759         self checkinBuildSupportFilesForPackage:packageToCheckIn
   780         self checkinBuildSupportFilesForPackage:packageToCheckIn withInfo:(originalCheckinInfo ? checkinInfo).
   760     ].
   781     ].
   761 
   782 
   762     "Created: / 13-10-2011 / 11:15:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   783     "Created: / 13-10-2011 / 11:15:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   763     "Modified: / 04-09-2012 / 14:05:36 / cg"
   784     "Modified: / 04-09-2012 / 14:05:36 / cg"
   764 ! !
   785 ! !
   765 
   786 
   766 !SourceCodeManagerUtilitiesForContainerBasedManagers class methodsFor:'documentation'!
   787 !SourceCodeManagerUtilitiesForContainerBasedManagers class methodsFor:'documentation'!
   767 
   788 
   768 version
   789 version
   769     ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilitiesForContainerBasedManagers.st,v 1.16 2013-07-31 15:47:16 cg Exp $'
   790     ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilitiesForContainerBasedManagers.st,v 1.17 2013-08-06 11:29:32 stefan Exp $'
   770 !
   791 !
   771 
   792 
   772 version_CVS
   793 version_CVS
   773     ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilitiesForContainerBasedManagers.st,v 1.16 2013-07-31 15:47:16 cg Exp $'
   794     ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilitiesForContainerBasedManagers.st,v 1.17 2013-08-06 11:29:32 stefan Exp $'
   774 ! !
   795 ! !
   775 
   796