SourceCodeManagerUtilities.st
changeset 1084 2728a446d037
parent 1080 0935ae4381d3
child 1090 8608e5b91fa7
equal deleted inserted replaced
1083:e3ac808d06e8 1084:2728a446d037
    66 yesToAllQuery
    66 yesToAllQuery
    67     YesToAllQuery isNil ifTrue:[
    67     YesToAllQuery isNil ifTrue:[
    68         YesToAllQuery := QuerySignal new.
    68         YesToAllQuery := QuerySignal new.
    69     ].
    69     ].
    70     ^ YesToAllQuery
    70     ^ YesToAllQuery
       
    71 ! !
       
    72 
       
    73 !SourceCodeManagerUtilities class methodsFor:'accessing'!
       
    74 
       
    75 lastModule
       
    76     "return the value of the static variable 'LastModule' (automatically generated)"
       
    77 
       
    78     ^ LastModule
       
    79 !
       
    80 
       
    81 lastModule:something
       
    82     "set the value of the static variable 'LastModule' (automatically generated)"
       
    83 
       
    84     LastModule := something.
       
    85 !
       
    86 
       
    87 lastPackage
       
    88     "return the value of the static variable 'LastPackage' (automatically generated)"
       
    89 
       
    90     ^ LastPackage
       
    91 !
       
    92 
       
    93 lastPackage:something
       
    94     "set the value of the static variable 'LastPackage' (automatically generated)"
       
    95 
       
    96     LastPackage := something.
    71 ! !
    97 ! !
    72 
    98 
    73 !SourceCodeManagerUtilities class methodsFor:'utilities'!
    99 !SourceCodeManagerUtilities class methodsFor:'utilities'!
    74 
   100 
    75 askForContainer:boxText title:title note:notice initialModule:initialModule initialPackage:initialPackage initialFileName:initialFileName
   101 askForContainer:boxText title:title note:notice initialModule:initialModule initialPackage:initialPackage initialFileName:initialFileName
   175     component := box addTextLabel:(resources string:'Package:').
   201     component := box addTextLabel:(resources string:'Package:').
   176     component width:0.4; adjust:#right.
   202     component width:0.4; adjust:#right.
   177     box yPosition:y.
   203     box yPosition:y.
   178     packageBoxComponent := component := box addComboBoxOn:packageHolder tabable:true.
   204     packageBoxComponent := component := box addComboBoxOn:packageHolder tabable:true.
   179 "/    component := box addInputFieldOn:packageHolder tabable:true.
   205 "/    component := box addInputFieldOn:packageHolder tabable:true.
   180     component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine.
   206     component width:0.6; left:0.4; "immediateAccept:true; "acceptOnLeave:true; cursorMovementWhenUpdating:#beginOfLine.
   181     packageUpdater value.
   207     packageUpdater value.
   182     moduleHolder onChangeEvaluate:packageUpdater.
   208     moduleHolder onChangeEvaluate:packageUpdater.
   183 
   209 
   184     box addVerticalSpace.
   210     box addVerticalSpace.
   185     y := box yPosition.
   211     y := box yPosition.
   794 
   820 
   795 checkoutClass:aClass askForRevision:askForRevision askForMerge:askForMerge
   821 checkoutClass:aClass askForRevision:askForRevision askForMerge:askForMerge
   796     "check-out a class from the source repository.
   822     "check-out a class from the source repository.
   797      If askForRevision is false, check-out the newest version."
   823      If askForRevision is false, check-out the newest version."
   798 
   824 
   799     |mgr resources
   825     |mgr resources sourceInfo
   800      currentClass 
   826      currentClass 
   801      aStream sourceToLoad currentSource rev revString
   827      aStream sourceToLoad currentSource rev revString
   802      nm msg rev2 newestRev
   828      nm msg rev2 newestRev
   803      containerModule containerPackage containerFile rslt
   829      containerModule containerPackage containerFile rslt
   804      pkg listHere listRep diffSet 
   830      pkg listHere listRep diffSet 
   813     mgr := currentClass sourceCodeManager.
   839     mgr := currentClass sourceCodeManager.
   814     mgr isNil ifTrue:[
   840     mgr isNil ifTrue:[
   815         self warn:'No sourceCode manager - check settings'.
   841         self warn:'No sourceCode manager - check settings'.
   816         ^ self
   842         ^ self
   817     ].
   843     ].
       
   844 
       
   845     sourceInfo := mgr sourceInfoOfClass:currentClass.
       
   846     sourceInfo notNil ifTrue:[
       
   847         currentClass package ~= Project defaultProject package ifTrue:[
       
   848             containerPackage := mgr packageFromSourceInfo:sourceInfo.
       
   849             containerModule := mgr moduleFromSourceInfo:sourceInfo.
       
   850         ].
       
   851         containerFile := mgr containerFromSourceInfo:sourceInfo.
       
   852     ].
       
   853 
   818     currentClass isLoaded ifTrue:[
   854     currentClass isLoaded ifTrue:[
   819         rev := currentClass binaryRevision.
   855         rev := currentClass binaryRevision.
   820         rev2 := currentClass revision.
   856         rev2 := currentClass revision.
   821         rev isNil ifTrue:[
   857         rev isNil ifTrue:[
   822             rev := rev2
   858             rev := rev2
   823         ].
   859         ].
   824         rev isNil ifTrue:[
   860         rev isNil ifTrue:[
   825             pkg := aClass package.
   861             pkg := currentClass package.
   826             pkg notNil ifTrue:[
   862             (pkg notNil and:[pkg ~= Project defaultProject package]) ifTrue:[
   827                 containerModule := pkg upTo:$:.
   863                 containerModule := pkg upTo:$:.
   828                 containerPackage := pkg copyFrom:(containerModule size + 2).
   864                 containerPackage := pkg copyFrom:(containerModule size + 2).
   829             ].
   865             ].
   830             containerModule size == 0 ifTrue:[
   866             containerModule size == 0 ifTrue:[
   831                 containerModule := Project current repositoryModule.
   867                 containerModule := (SourceCodeManagerUtilities lastModule ) ? Project current repositoryModule.
   832             ].
   868             ].
   833             containerPackage size == 0 ifTrue:[
   869             containerPackage size == 0 ifTrue:[
   834                 containerPackage := Project current package.
   870                 containerPackage := (SourceCodeManagerUtilities lastPackage ) ? Project current package.
   835             ].
   871             ].
   836             answer := self confirmWithCancel:(resources 
   872             answer := self confirmWithCancel:(resources 
   837                                                 string:'The class %3 seems to have no (valid) repository information.\\I assume you want to check it out from: %1/%2.' 
   873                                                 string:'The class %3 seems to have no (valid) repository information.\\I assume you want to check it out from: %1/%2.' 
   838                                                 with:containerModule allBold 
   874                                                 with:containerModule allBold 
   839                                                 with:containerPackage allBold
   875                                                 with:containerPackage allBold
   840                                                 with:aClass name allBold) withCRs.
   876                                                 with:currentClass name allBold) withCRs.
   841             answer isNil ifTrue:[^ self "cancelled"].
   877             answer isNil ifTrue:[^ self "cancelled"].
   842             answer ifFalse:[
   878             answer ifFalse:[
   843                 rslt := SourceCodeManagerUtilities
   879                 rslt := SourceCodeManagerUtilities
   844                     askForContainer:(resources string:'The class seems to have no repository information.\\Do you want to checkOut from an existing containers contents ?')
   880                     askForContainer:(resources string:'The class seems to have no repository information.\\Do you want to checkOut from an existing containers contents ?')
   845                     title:'Container to load from' note:nil 
   881                     title:'Container to load from' note:nil 
   846                     initialModule:containerModule 
   882                     initialModule:containerModule 
   847                     initialPackage:containerPackage 
   883                     initialPackage:containerPackage 
   848                     initialFileName:(currentClass name , '.st')
   884                     initialFileName:(currentClass name , '.st')
   849                     forNewContainer:false.
   885                     forNewContainer:false.
       
   886 
   850                 rslt isNil ifTrue:[
   887                 rslt isNil ifTrue:[
   851                     "/ canel
   888                     "/ canel
   852                     ^ self
   889                     ^ self
   853                 ].
   890                 ].
   854                 containerModule := "lastModule :=" rslt at:#module.
   891                 containerModule := "lastModule :=" rslt at:#module.
   870     ].
   907     ].
   871 
   908 
   872     "/
   909     "/
   873     "/ class in repository - ask for revision
   910     "/ class in repository - ask for revision
   874     "/
   911     "/
   875     newestRev := mgr newestRevisionOf:currentClass.
   912 "/    newestRev := mgr newestRevisionOf:currentClass.
       
   913     newestRev := mgr newestRevisionInFile:containerFile directory:containerPackage module:containerModule.
   876     askForRevision ifFalse:[
   914     askForRevision ifFalse:[
   877         rev := newestRev ? ''
   915         rev := newestRev ? ''
   878     ] ifTrue:[
   916     ] ifTrue:[
   879         msg := resources string:'CheckOut which revision of ''%1'': (empty for newest)' with:nm allBold.
   917         msg := resources string:'CheckOut which revision of ''%1'': (empty for newest)' with:nm allBold.
   880         rev notNil ifTrue:[
   918         rev notNil ifTrue:[
   905         "/ aStream := mgr getMostRecentSourceStreamForClassNamed:nm.
   943         "/ aStream := mgr getMostRecentSourceStreamForClassNamed:nm.
   906         aStream := mgr getSourceStreamFor:currentClass revision:newestRev.
   944         aStream := mgr getSourceStreamFor:currentClass revision:newestRev.
   907         revString := '(newest: ' , (newestRev ? '???') , ')'.
   945         revString := '(newest: ' , (newestRev ? '???') , ')'.
   908     ] ifFalse:[
   946     ] ifFalse:[
   909         msg := 'extracting previous %1'.
   947         msg := 'extracting previous %1'.
   910         aStream := mgr getSourceStreamFor:currentClass revision:rev.
   948 "/        aStream := mgr getSourceStreamFor:currentClass revision:rev.
   911         revString := rev
   949 "/        revString := rev
       
   950         aStream := mgr  
       
   951             streamForClass:currentClass
       
   952             fileName:containerFile 
       
   953             revision:rev 
       
   954             directory:containerPackage 
       
   955             module:containerModule
       
   956             cache:true.
   912     ].
   957     ].
   913 
   958 
   914     aStream isNil ifTrue:[
   959     aStream isNil ifTrue:[
   915         self warn:(resources string:'could not extract source of %1 from repository' with:aClass name allBold).
   960         self warn:(resources string:'could not extract source of %1 from repository' with:aClass name allBold).
   916         ^ self
   961         ^ self
  1974 ! !
  2019 ! !
  1975 
  2020 
  1976 !SourceCodeManagerUtilities class methodsFor:'documentation'!
  2021 !SourceCodeManagerUtilities class methodsFor:'documentation'!
  1977 
  2022 
  1978 version
  2023 version
  1979     ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilities.st,v 1.68 2001-10-11 16:31:32 cg Exp $'
  2024     ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilities.st,v 1.69 2001-10-26 09:24:00 cg Exp $'
  1980 ! !
  2025 ! !