SourceCodeManagerUtilitiesForContainerBasedManagers.st
branchjv
changeset 4199 89ebbba27db6
parent 4006 ce836cd26a41
parent 4191 e8053aff27b2
equal deleted inserted replaced
4198:533d77906f5b 4199:89ebbba27db6
    13 
    13 
    14 "{ NameSpace: Smalltalk }"
    14 "{ NameSpace: Smalltalk }"
    15 
    15 
    16 SourceCodeManagerUtilities subclass:#SourceCodeManagerUtilitiesForContainerBasedManagers
    16 SourceCodeManagerUtilities subclass:#SourceCodeManagerUtilitiesForContainerBasedManagers
    17 	instanceVariableNames:''
    17 	instanceVariableNames:''
    18 	classVariableNames:''
    18 	classVariableNames:'LastComparedTag'
    19 	poolDictionaries:''
    19 	poolDictionaries:''
    20 	category:'System-SourceCodeManagement'
    20 	category:'System-SourceCodeManagement'
    21 !
    21 !
    22 
    22 
    23 !SourceCodeManagerUtilitiesForContainerBasedManagers class methodsFor:'documentation'!
    23 !SourceCodeManagerUtilitiesForContainerBasedManagers class methodsFor:'documentation'!
   588      NOTE: Definition of `newest` revision may vary. For SCMs which allows for multiple
   588      NOTE: Definition of `newest` revision may vary. For SCMs which allows for multiple
   589      heads, it is not clear which one it is. In that case, even if `askForRevision` is
   589      heads, it is not clear which one it is. In that case, even if `askForRevision` is
   590      false, this method may result in user interaction, asking user to select which of the
   590      false, this method may result in user interaction, asking user to select which of the
   591      newest she wants."
   591      newest she wants."
   592 
   592 
   593     |dateFormat string dateOrNil symbolicName|
   593     |dateFormat string dateOrNil symbolicNameOrNil 
   594 
   594      someDfnClass knownTags includeSubProjectsHolder
       
   595      packagesIn packagesCompared|
       
   596 
       
   597     packagesIn := packages value.
       
   598     
       
   599     "/ being lazy, assume tags are persistent across packages (which they are not required to be...)
       
   600     someDfnClass := ProjectDefinition definitionClassForPackage:packagesIn first.
       
   601     someDfnClass isNil ifTrue:[ someDfnClass := Object projectDefinitionClass ].
       
   602     
       
   603     knownTags := (manager knownTagsFor:someDfnClass) asOrderedCollection sort.
       
   604     
   595     dateFormat := UserPreferences current dateInputFormat.
   605     dateFormat := UserPreferences current dateInputFormat.
   596     string := Dialog
   606 
   597                 request:(resources
   607     includeSubProjectsHolder := true asValue.
   598                         string:'Compare with version from date (%2) or tag (any other format) (empty for newest):'
   608     
   599                         with:dateFormat)
   609     Dialog 
   600                 initialAnswer:(Date today printStringFormat:dateFormat).
   610         modifyingBoxWith:[:box |
   601 
   611             box verticalPanel 
       
   612                 add:(CheckBox label:(resources string:'Include Subprojects')
       
   613                               model:includeSubProjectsHolder).
       
   614         ]
       
   615         do:[
       
   616             |suggestion|
       
   617 
       
   618             suggestion := LastComparedTag.
       
   619             suggestion isNil ifTrue:[ suggestion := Date today printStringFormat:dateFormat ].
       
   620             
       
   621             string := Dialog
       
   622                         request:(resources
       
   623                                 string:'Compare with version from date (%2) or tag (any other format) (empty for newest):'
       
   624                                 with:dateFormat)
       
   625                         initialAnswer:suggestion
       
   626                         list:knownTags.
       
   627         ].
       
   628         
   602     string isNil ifTrue:[^ self].
   629     string isNil ifTrue:[^ self].
   603     string notEmpty ifTrue:[
   630     string notEmpty ifTrue:[
   604         dateOrNil := Date readFrom:string printFormat:dateFormat onError:nil.
   631         dateOrNil := Date readFrom:string printFormat:dateFormat onError:nil.
   605         dateOrNil isNil ifTrue:[
   632         dateOrNil isNil ifTrue:[
   606             symbolicName := string
   633             symbolicNameOrNil := string
   607         ].
   634         ].
   608     ].
   635     ].
   609     
   636 
   610     packages value do:[:eachProject |
   637     LastComparedTag := symbolicNameOrNil.
       
   638     
       
   639     packagesCompared := packagesIn.
       
   640     includeSubProjectsHolder value ifTrue:[
       
   641         packagesCompared := Smalltalk allPackageIDs
       
   642                         select:[:eachPackage |
       
   643                             packagesIn contains:[:p | 
       
   644                                 eachPackage = p 
       
   645                                 or:[ (eachPackage startsWith:(p,'-'))
       
   646                                 or:[ (eachPackage startsWith:(p,':')) ]]
       
   647                             ]
       
   648                         ]    
       
   649     ].
       
   650     
       
   651     packagesCompared value do:[:eachProject |
   611         dateOrNil notNil ifTrue:[
   652         dateOrNil notNil ifTrue:[
   612             self compareProject:eachProject withRepositoryVersionFrom:dateOrNil extensionsOnly:extensionsOnly
   653             self compareProject:eachProject withRepositoryVersionFrom:dateOrNil extensionsOnly:extensionsOnly
   613         ] ifFalse:[
   654         ] ifFalse:[
   614             self compareProject:eachProject withRepositoryVersionTaggedAs:symbolicName extensionsOnly:extensionsOnly
   655             self compareProject:eachProject withRepositoryVersionTaggedAs:symbolicNameOrNil extensionsOnly:extensionsOnly
   615         ]
   656         ]
   616     ].
   657     ].
   617 
   658 
   618 
   659 
   619     "Created: / 04-04-2014 / 15:29:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   660     "Created: / 04-04-2014 / 15:29:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"