SourceCodeManagerUtilities.st
changeset 989 bb70a0f30e98
parent 987 fa4fc87b8540
child 990 edf1dd382621
equal deleted inserted replaced
988:4a56f1f1fa48 989:bb70a0f30e98
   615     mgr := currentClass sourceCodeManager.
   615     mgr := currentClass sourceCodeManager.
   616     mgr isNil ifTrue:[
   616     mgr isNil ifTrue:[
   617         self warn:'No sourceCode manager - check settings'.
   617         self warn:'No sourceCode manager - check settings'.
   618         ^ self
   618         ^ self
   619     ].
   619     ].
   620     rev := currentClass binaryRevision.
   620     currentClass isLoaded ifTrue:[
   621     rev2 := currentClass revision.
   621         rev := currentClass binaryRevision.
   622     rev isNil ifTrue:[
   622         rev2 := currentClass revision.
   623         rev := rev2
   623         rev isNil ifTrue:[
   624     ].
   624             rev := rev2
   625     rev isNil ifTrue:[
   625         ].
   626         self warn:'Class seems to be not yet in the repository'.
   626         rev isNil ifTrue:[
   627         ^ self
   627             self warn:'Class seems to be not yet in the repository'.
       
   628             ^ self
       
   629         ].
   628     ].
   630     ].
   629 
   631 
   630     "/
   632     "/
   631     "/ class in repository - ask for revision
   633     "/ class in repository - ask for revision
   632     "/
   634     "/
   648 
   650 
   649     rev := SourceCodeManagerUtilities
   651     rev := SourceCodeManagerUtilities
   650                 askForExistingRevision:msg 
   652                 askForExistingRevision:msg 
   651                 title:'CheckOut from repository' 
   653                 title:'CheckOut from repository' 
   652                 class:currentClass.
   654                 class:currentClass.
       
   655     rev isNil ifTrue:[
       
   656         "/ cancelled
       
   657         ^ self
       
   658     ].
   653 
   659 
   654     (rev notNil or:[containerFile notNil]) ifTrue:[
   660     (rev notNil or:[containerFile notNil]) ifTrue:[
   655         rev notNil ifTrue:[
   661         rev notNil ifTrue:[
   656             rev withoutSpaces isEmpty ifTrue:[
   662             rev withoutSpaces isEmpty ifTrue:[
   657                 msg := 'extracting newest %1 (' , (newestRev ? '???') , ')'.
   663                 msg := 'extracting newest %1 (' , (newestRev ? '???') , ')'.
   680         ] do:[
   686         ] do:[
   681             sourceToLoad := aStream contents asString.
   687             sourceToLoad := aStream contents asString.
   682         ].
   688         ].
   683         aStream close.
   689         aStream close.
   684 
   690 
       
   691         currentClass isLoaded ifFalse:[
       
   692             rev = newestRev ifTrue:[
       
   693                 currentClass autoload.
       
   694             ] ifFalse:[
       
   695                 sourceToLoad readStream fileIn.
       
   696             ].
       
   697             ^ self.
       
   698         ].
   685 
   699 
   686         self activityNotification:'generating current source...'.
   700         self activityNotification:'generating current source...'.
   687 
   701 
   688         aStream := '' writeStream.
   702         aStream := '' writeStream.
   689         Method flushSourceStreamCache.
   703         Method flushSourceStreamCache.
   714                 changed isEmpty ifTrue:[
   728                 changed isEmpty ifTrue:[
   715                     self information:'Versions are identical.'.
   729                     self information:'Versions are identical.'.
   716                     ^ self
   730                     ^ self
   717                 ].
   731                 ].
   718                 msg := 'Load repository version ?'.
   732                 msg := 'Load repository version ?'.
   719                 msg := msg , '\\This will undo all your changes made to the class.'.
   733                 msg := msg , '\\This will undo your changes made to the class (if any were made).'.
   720                 labels := #('cancel' 'load'). 
   734                 labels := #('cancel' 'load'). 
   721                 values := #(nil #load). 
   735                 values := #(nil #load). 
   722             ] ifFalse:[
   736             ] ifFalse:[
   723                 changed isEmpty ifTrue:[
   737                 changed isEmpty ifTrue:[
   724                     msg := 'Load repository version ?'.
   738                     msg := 'Load repository version ?'.
   725                     msg := msg , '\\This will load methods which are not present in the class.'.
   739                     msg := msg , '\\This will load methods which are not present in the class.'.
   726                     labels := #('cancel' 'load'). 
   740                     labels := #('cancel' 'load'). 
   727                     values := #(nil #load). 
   741                     values := #(nil #load). 
   728                 ] ifFalse:[
   742                 ] ifFalse:[
   729                     msg := 'Load repository version, or merge it into your current version ?'.
   743                     msg := 'Load repository version, or merge it into your current version ?'.
   730                     msg := msg , '\\Load will undo all your changes made to the class;'.
   744                     msg := msg , '\\Load will undo your changes made to the class (if any were made);'.
   731                     msg := msg , '\Merge will only load methods which are not present in the class.'.
   745                     msg := msg , '\Merge will only load methods which are not present in the class.'.
   732                 ].
   746                 ].
   733             ]
   747             ]
   734         ] ifFalse:[
   748         ] ifFalse:[
   735             onlyInRep isEmpty ifTrue:[
   749             onlyInRep isEmpty ifTrue:[
   736                 msg := 'Load repository version ?'.
   750                 msg := 'Load repository version ?'.
   737                 msg := msg , '\\This will undo all your changes made to the class,'.
   751                 msg := msg , '\\This will undo your changes made to the class (if any were made),'.
   738                 msg := msg , '\and remove methods which are not present in the repository version.'.
   752                 msg := msg , '\and remove methods which are not present in the repository version.'.
   739                 labels := #('cancel' 'load'). 
   753                 labels := #('cancel' 'load'). 
   740                 values := #(nil #load). 
   754                 values := #(nil #load). 
   741             ] ifFalse:[
   755             ] ifFalse:[
   742                 msg := 'Load repository version, or merge it into your current version ?'.
   756                 msg := 'Load repository version, or merge it into your current version ?'.
   743                 msg := msg , '\\Load will undo all your changes made to the class;'.
   757                 msg := msg , '\\Load will undo your changes made to the class (if any were made);'.
   744                 msg := msg , '\Merge will only load methods which are not present in the class.'.
   758                 msg := msg , '\Merge will only load methods which are not present in the class.'.
   745             ]
   759             ]
   746         ].
   760         ].
   747         answer := (Dialog confirmWithCancel:msg withCRs
   761         answer := (Dialog confirmWithCancel:msg withCRs
   748                labels:(resources array:labels)
   762                labels:(resources array:labels)
  1448 ! !
  1462 ! !
  1449 
  1463 
  1450 !SourceCodeManagerUtilities class methodsFor:'documentation'!
  1464 !SourceCodeManagerUtilities class methodsFor:'documentation'!
  1451 
  1465 
  1452 version
  1466 version
  1453     ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilities.st,v 1.29 2000-11-14 16:14:30 cg Exp $'
  1467     ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilities.st,v 1.30 2000-11-14 17:15:57 cg Exp $'
  1454 ! !
  1468 ! !