SourceCodeManagerUtilities.st
changeset 1158 453b58c2a059
parent 1157 885130aeebd8
child 1160 d56159f5a86f
equal deleted inserted replaced
1157:885130aeebd8 1158:453b58c2a059
   467     "
   467     "
   468      self checkAndWarnAboutBadMessagesInClass:(SourceCodeManagerUtilities)  
   468      self checkAndWarnAboutBadMessagesInClass:(SourceCodeManagerUtilities)  
   469     "
   469     "
   470 !
   470 !
   471 
   471 
       
   472 checkForExistingModule:module package:package container:containerFileName using:mgr allowCreate:allowCreate
       
   473     |resources moduleName packageName containerName|
       
   474 
       
   475     resources := ResourcePack for:self.
       
   476     moduleName := module allBold.
       
   477     packageName := package allBold.
       
   478     containerName := containerFileName allBold.
       
   479 
       
   480     "/
       
   481     "/ check for the container
       
   482     "/
       
   483     (mgr checkForExistingContainerInModule:module package:package container:containerFileName) ifFalse:[
       
   484         allowCreate ifFalse:[
       
   485             self warn:(resources string:'A container for ''%1'' does not exist in ''%2:%3''' 
       
   486                                    with:containerName with:moduleName with:packageName) withCRs.
       
   487             ^ false
       
   488         ].
       
   489         (Dialog 
       
   490             confirm:(resources string:'''%1'' is a new container (in ''%2:%3'').\\Create it ?' 
       
   491                                  with:containerName with:moduleName with:packageName) withCRs
       
   492             noLabel:'Cancel') 
       
   493         ifFalse:[
       
   494             ^ false.
       
   495         ].
       
   496         (mgr createContainerForText:'' inModule:module package:package container:containerFileName) ifFalse:[
       
   497             self warn:(resources string:'Cannot create new container: ''%1'' (in ''%2:%3'')' 
       
   498                                  with:containerName with:moduleName with:packageName).
       
   499             ^ false.
       
   500         ]
       
   501     ].
       
   502     ^ true.
       
   503 !
       
   504 
       
   505 checkForExistingModule:module package:package using:mgr allowCreate:allowCreate
       
   506     |resources moduleName packageName|
       
   507 
       
   508     resources := ResourcePack for:self.
       
   509     moduleName := module allBold.
       
   510     packageName := package allBold.
       
   511 
       
   512     "/
       
   513     "/ check for the package
       
   514     "/
       
   515     (mgr checkForExistingModule:module package:package) ifFalse:[
       
   516         allowCreate ifFalse:[
       
   517             self warn:(resources string:'A package named ''%1'' does not exist in module ''%2''' 
       
   518                                    with:packageName with:moduleName) withCRs.
       
   519             ^ false
       
   520         ].
       
   521         (Dialog 
       
   522             confirm:(resources string:'''%1'' is a new package in module ''%2''.\\create it ?' 
       
   523                                  with:packageName with:moduleName) withCRs
       
   524             noLabel:'Cancel') 
       
   525         ifFalse:[
       
   526             ^ false.
       
   527         ].
       
   528         (mgr createModule:module package:package) ifFalse:[
       
   529             self warn:(resources string:'Cannot create new package: ''%1'' in module ''%2''' 
       
   530                                    with:packageName with:moduleName) withCRs.
       
   531             ^ false.
       
   532         ]
       
   533     ].
       
   534     ^ true.
       
   535 !
       
   536 
       
   537 checkForExistingModule:module using:mgr allowCreate:allowCreate
       
   538     |resources moduleName|
       
   539 
       
   540     (mgr checkForExistingModule:module) ifFalse:[
       
   541         resources := ResourcePack for:self.
       
   542         moduleName := module allBold.
       
   543 
       
   544         allowCreate ifFalse:[
       
   545             self warn:(resources string:'A module named ''%1'' does not exist in the repository' 
       
   546                                   with:moduleName) withCRs.
       
   547             ^ false
       
   548         ].
       
   549 
       
   550         (Dialog 
       
   551             confirm:(resources string:'''%1'' is a new module.\\create it ?' with:moduleName) withCRs
       
   552             noLabel:'Cancel') 
       
   553         ifFalse:[
       
   554             ^ false.
       
   555         ].
       
   556         (mgr createModule:module) ifFalse:[
       
   557             self warn:(resources string:'Cannot create new module: ''%1''' with:moduleName) withCRs.
       
   558             ^ false.
       
   559         ]
       
   560     ].
       
   561     ^ true.
       
   562 !
       
   563 
   472 checkinClass:aClass
   564 checkinClass:aClass
   473     "check a class into the source repository.
   565     "check a class into the source repository.
   474      Asks interactively for log-message."
   566      Asks interactively for log-message."
   475 
   567 
   476     ^ self checkinClass:aClass withLog:nil
   568     ^ self checkinClass:aClass withLog:nil
   566         freshCreated ifFalse:[
   658         freshCreated ifFalse:[
   567             aborted := false.
   659             aborted := false.
   568             AbortOperationRequest handle:[:ex |
   660             AbortOperationRequest handle:[:ex |
   569                 aborted := true.
   661                 aborted := true.
   570                 ex return.
   662                 ex return.
   571                 ^ false.
       
   572             ] do:[
   663             ] do:[
   573                 (mgr checkinClass:aClass logMessage:logMessage) ifFalse:[
   664                 (mgr checkinClass:aClass logMessage:logMessage) ifFalse:[
   574                     Transcript showCR:'checkin of ''' , aClass name , ''' failed'.
   665                     Transcript showCR:'checkin of ''' , aClass name , ''' failed'.
   575                     self warn:'checkin of ''' , aClass name allBold , ''' failed'.
   666                     self warn:'checkin of ''' , aClass name allBold , ''' failed'.
   576                     ^ false.
   667                     ^ false.
   577                 ].
   668                 ].
   578             ].
   669             ].
   579             aborted ifTrue:[
   670             aborted ifTrue:[
   580                 Transcript showCR:'checkin of ''' , aClass name , ''' aborted'.
   671                 Transcript showCR:'Checkin of ''' , aClass name , ''' aborted'.
   581                 AbortAllSignal isHandled ifTrue:[
   672                 AbortAllSignal isHandled ifTrue:[
   582                     (Dialog 
   673                     (Dialog 
   583                         confirm:('checkin of ''' , aClass name , ''' aborted.\\Cancel all ?')withCRs
   674                         confirm:('Checkin of ''' , aClass name , ''' aborted.\\Cancel all ?')withCRs
   584                         default:false)
   675                         default:false)
   585                     ifTrue:[
   676                     ifTrue:[
   586                         AbortAllSignal raise.
   677                         AbortAllSignal raise.
   587                     ]
   678                     ]
   588                 ].
   679                 ].
   589                 AbortSignal raise.
       
   590                 ^ false.
   680                 ^ false.
   591             ].
   681             ].
   592         ].
   682         ].
   593     ].
   683     ].
   594     ^ true
   684     ^ true
   702         logMessage isNil ifTrue:[^ false].
   792         logMessage isNil ifTrue:[^ false].
   703     ] ifFalse:[
   793     ] ifFalse:[
   704         logMessage := aLogMessageOrNil
   794         logMessage := aLogMessageOrNil
   705     ].
   795     ].
   706 
   796 
   707     "/
   797     (self checkForExistingModule:module using:mgr allowCreate:true) ifFalse:[^ false].
   708     "/ check for the module
       
   709     "/
       
   710     (mgr checkForExistingModule:module) ifFalse:[
       
   711         (Dialog 
       
   712             confirm:(resources string:'''%1'' is a new module.\\Create it ?' with:module allBold) withCRs
       
   713             noLabel:'Cancel') 
       
   714         ifFalse:[
       
   715             ^ false.
       
   716         ].
       
   717         (mgr createModule:module) ifFalse:[
       
   718             self warn:(resources string:'Cannot create new module: ''%1''' with:module allBold).
       
   719             ^ false.
       
   720         ]
       
   721     ].
       
   722     LastModule := module.
   798     LastModule := module.
   723 
   799 
   724     "/
   800     (self checkForExistingModule:module package:package using:mgr allowCreate:true) ifFalse:[^ false].
   725     "/ check for the package
       
   726     "/
       
   727     (mgr checkForExistingModule:module package:package) ifFalse:[
       
   728         (Dialog 
       
   729             confirm:(resources string:'''%1'' is a new package (in module ''%2'').\\Create it ?' with:package allBold with:module allBold) withCRs
       
   730             noLabel:'Cancel') 
       
   731         ifFalse:[
       
   732             ^ false.
       
   733         ].
       
   734         (mgr createModule:module package:package) ifFalse:[
       
   735             self warn:(resources string:'Cannot create new package: ''%1'' (in module ''%2'')' with:package allBold with:module allBold).
       
   736             ^ false.
       
   737         ]
       
   738     ].
       
   739 
       
   740     "/
       
   741     "/ check for the container
       
   742     "/
       
   743     (mgr checkForExistingContainerInModule:module package:package container:containerFileName) ifFalse:[
       
   744         (Dialog 
       
   745             confirm:(resources string:'''%1'' is a new container (in ''%2:%3'').\\Create it ?' 
       
   746                                  with:containerFileName allBold with:module allBold with:package allBold) withCRs
       
   747             noLabel:'Cancel') 
       
   748         ifFalse:[
       
   749             ^ false.
       
   750         ].
       
   751         (mgr createContainerForText:'' inModule:module package:package container:containerFileName) ifFalse:[
       
   752             self warn:(resources string:'Cannot create new container: ''%1'' (in ''%2:%3'')' 
       
   753                                  with:containerFileName allBold with:module allBold with:package allBold).
       
   754             ^ false.
       
   755         ]
       
   756     ].
       
   757 
       
   758     LastPackage := package.
   801     LastPackage := package.
       
   802 
       
   803     (self checkForExistingModule:module package:package container:containerFileName using:mgr allowCreate:true) ifFalse:[^ false].
   759 
   804 
   760     self activityNotification:(resources string:'Checking in %1' with:containerFileName).
   805     self activityNotification:(resources string:'Checking in %1' with:containerFileName).
   761     pri := Processor activePriority.
   806     pri := Processor activePriority.
   762     Processor activeProcess withPriority:pri-1 to:pri
   807     Processor activeProcess withPriority:pri-1 to:pri
   763     do:[
   808     do:[
   837      containerModule containerPackage containerFile rslt
   882      containerModule containerPackage containerFile rslt
   838      pkg listHere listRep diffSet 
   883      pkg listHere listRep diffSet 
   839      changed onlyHere onlyInRep answer labels values singleChangeSelector
   884      changed onlyHere onlyInRep answer labels values singleChangeSelector
   840      changedClasses default versionMethodsHere versionMethodsRep changedClassDefinitions|
   885      changedClasses default versionMethodsHere versionMethodsRep changedClassDefinitions|
   841 
   886 
       
   887 aClass isNil ifTrue:[self halt].
       
   888 
   842     resources := ResourcePack for:self.
   889     resources := ResourcePack for:self.
   843 
   890 
   844     currentClass := aClass theNonMetaclass.
   891     currentClass := aClass theNonMetaclass.
   845 
   892 
   846     nm := currentClass name.
   893     nm := currentClass name.
   887                 rslt := SourceCodeManagerUtilities
   934                 rslt := SourceCodeManagerUtilities
   888                     askForContainer:(resources string:'The class seems to have no repository information.\\Do you want to checkOut from an existing containers contents ?')
   935                     askForContainer:(resources string:'The class seems to have no repository information.\\Do you want to checkOut from an existing containers contents ?')
   889                     title:'Container to load from' note:nil 
   936                     title:'Container to load from' note:nil 
   890                     initialModule:containerModule 
   937                     initialModule:containerModule 
   891                     initialPackage:containerPackage 
   938                     initialPackage:containerPackage 
   892                     initialFileName:(currentClass name , '.st')
   939                     initialFileName:(currentClass nameWithoutPrefix , '.st')
   893                     forNewContainer:false.
   940                     forNewContainer:false.
   894 
   941 
   895                 rslt isNil ifTrue:[
   942                 rslt isNil ifTrue:[
   896                     "/ canel
   943                     "/ canel
   897                     ^ self
   944                     ^ self
  1333 !
  1380 !
  1334 
  1381 
  1335 defineSourceContainerForClass:aClass title:title text:boxText createDirectories:createDirs createContainer:createContainer
  1382 defineSourceContainerForClass:aClass title:title text:boxText createDirectories:createDirs createContainer:createContainer
  1336     "let user specify the source-repository values for aClass"
  1383     "let user specify the source-repository values for aClass"
  1337 
  1384 
  1338     |box className
  1385     | className
  1339      oldModule oldPackage oldFileName
  1386      oldModule oldPackage oldFileName
  1340      module package fileName nameSpace nameSpacePrefix
  1387      module package fileName nameSpace nameSpacePrefix
  1341      y component info project nm mgr creatingNew msg 
  1388      info project nm mgr creatingNew msg 
  1342      answer doCheckinWithoutAsking forceCheckIn resources rslt note
  1389      answer doCheckinWithoutAsking forceCheckIn resources rslt note
  1343      requiredPackage|
  1390      requiredPackage|
  1344 
  1391 
  1345     resources := ResourcePack for:self.
  1392     resources := ResourcePack for:self.
  1346     aClass isLoaded ifFalse:[
  1393     aClass isLoaded ifFalse:[
  1542                                                package:package 
  1589                                                package:package 
  1543                                                container:fileName).
  1590                                                container:fileName).
  1544         ].
  1591         ].
  1545     ].
  1592     ].
  1546 
  1593 
  1547     "/
  1594     (self checkForExistingModule:module using:mgr allowCreate:(createDirs or:[creatingNew]))
  1548     "/ check for the module
  1595     ifFalse:[^ false].
  1549     "/
       
  1550     (mgr checkForExistingModule:module) ifFalse:[
       
  1551         (createDirs or:[creatingNew]) ifFalse:[
       
  1552             self warn:(resources string:'A module named %1 does not exist in the source code management' with:module).
       
  1553             ^ false
       
  1554         ].
       
  1555         (Dialog 
       
  1556             confirm:(resources string:'%1 is a new module.\\create it ?' with:module) withCRs
       
  1557             noLabel:'Cancel') 
       
  1558         ifFalse:[
       
  1559             ^ false.
       
  1560         ].
       
  1561         (mgr createModule:module) ifFalse:[
       
  1562             self warn:(resources string:'Cannot create new module: %1' with:module).
       
  1563             ^ false.
       
  1564         ]
       
  1565     ].
       
  1566     LastModule := module.
  1596     LastModule := module.
  1567 
  1597 
  1568 
  1598     (self checkForExistingModule:module package:package using:mgr allowCreate:(createDirs or:[creatingNew]))
  1569     "/
  1599     ifFalse:[^ false].
  1570     "/ check for the package
       
  1571     "/
       
  1572     (mgr checkForExistingModule:module package:package) ifFalse:[
       
  1573         (createDirs or:[creatingNew]) ifFalse:[
       
  1574             self warn:(resources string:'a package named %1 does not exist module %2' with:module with:package).
       
  1575             ^ false
       
  1576         ].
       
  1577         (Dialog 
       
  1578             confirm:(resources string:'%1 is a new package (in module %2).\\create it ?' with:package with:module) withCRs
       
  1579             noLabel:'Cancel') 
       
  1580         ifFalse:[
       
  1581             ^ false.
       
  1582         ].
       
  1583         (mgr createModule:module package:package) ifFalse:[
       
  1584             self warn:(resources string:'Cannot create new package: %1 (in module %2)' with:package with:module).
       
  1585             ^ false.
       
  1586         ]
       
  1587     ].
       
  1588     LastPackage := package.
  1600     LastPackage := package.
  1589 
  1601 
  1590     "/
  1602     "/
  1591     "/ check for the container itself
  1603     "/ check for the container itself
  1592     "/
  1604     "/
  2034 ! !
  2046 ! !
  2035 
  2047 
  2036 !SourceCodeManagerUtilities class methodsFor:'documentation'!
  2048 !SourceCodeManagerUtilities class methodsFor:'documentation'!
  2037 
  2049 
  2038 version
  2050 version
  2039     ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilities.st,v 1.80 2002-07-25 12:49:10 cg Exp $'
  2051     ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilities.st,v 1.81 2002-08-02 18:44:29 cg Exp $'
  2040 ! !
  2052 ! !