SourceCodeManagerUtilities.st
changeset 1076 4adaffbd7ab0
parent 1070 3f87ae65a554
child 1077 6b1bcfd27521
equal deleted inserted replaced
1075:7b49d530a850 1076:4adaffbd7ab0
   417         (YesToAllNotification notNil and:[YesToAllNotification isHandled]) ifTrue:[
   417         (YesToAllNotification notNil and:[YesToAllNotification isHandled]) ifTrue:[
   418             answer := OptionBox 
   418             answer := OptionBox 
   419                           request:msg withCRs
   419                           request:msg withCRs
   420                           label:'Really checkIn ?'
   420                           label:'Really checkIn ?'
   421                           form:(InfoBox iconBitmap)
   421                           form:(InfoBox iconBitmap)
   422                           buttonLabels:#('yes' 'yes to all' 'no' 'no to all')
   422                           buttonLabels:#('Yes' 'Yes to all' 'No' 'No to all')
   423                           values:#(true #yesToAll false #noToAll)
   423                           values:#(true #yesToAll false #noToAll)
   424                           default:#yesToAll
   424                           default:#yesToAll
   425                           onCancel:false.
   425                           onCancel:false.
   426             answer == #yesToAll ifTrue:[
   426             answer == #yesToAll ifTrue:[
   427                 YesToAllNotification queryWith:true.
   427                 YesToAllNotification queryWith:true.
  1270      answer doCheckinWithoutAsking forceCheckIn resources rslt note
  1270      answer doCheckinWithoutAsking forceCheckIn resources rslt note
  1271      requiredPackage|
  1271      requiredPackage|
  1272 
  1272 
  1273     resources := ResourcePack for:self.
  1273     resources := ResourcePack for:self.
  1274     aClass isLoaded ifFalse:[
  1274     aClass isLoaded ifFalse:[
  1275         self warn:'please load the class first'.
  1275         self warn:(resources string:'Please load the %1-class first' with:aClass name).
  1276         ^ false.
  1276         ^ false.
  1277     ].
  1277     ].
  1278 
  1278 
  1279     className := aClass name.
  1279     className := aClass name.
  1280 
  1280 
  1371 Do you want to change it or check right into that container ?'
  1371 Do you want to change it or check right into that container ?'
  1372                             with:className
  1372                             with:className
  1373                             with:module
  1373                             with:module
  1374                             with:package
  1374                             with:package
  1375                             with:fileName)
  1375                             with:fileName)
  1376                 labels:(resources array:#('cancel' 'check in' 'change')).
  1376                 labels:(resources array:#('Cancel' 'Check in' 'Change')).
  1377         answer isNil ifTrue:[AbortSignal raise].
  1377         answer isNil ifTrue:[AbortSignal raise].
  1378         answer ifTrue:[
  1378         answer ifTrue:[
  1379             doCheckinWithoutAsking := false.
  1379             doCheckinWithoutAsking := false.
  1380             oldModule := module.
  1380             oldModule := module.
  1381             oldPackage := package.
  1381             oldPackage := package.
  1447         creatingNew ifFalse:[
  1447         creatingNew ifFalse:[
  1448             doCheckinWithoutAsking ifFalse:[
  1448             doCheckinWithoutAsking ifFalse:[
  1449                 (Dialog 
  1449                 (Dialog 
  1450                     confirm:(resources string:'The repository already contains a container named "%3" in "%1/%2" !!\\Checkin %4 anyway ? (DANGER - be careful)'
  1450                     confirm:(resources string:'The repository already contains a container named "%3" in "%1/%2" !!\\Checkin %4 anyway ? (DANGER - be careful)'
  1451                          withArgs:(Array with:module with:package with:fileName with:className)) withCRs
  1451                          withArgs:(Array with:module with:package with:fileName with:className)) withCRs
  1452                     noLabel:'cancel')
  1452                     noLabel:'Cancel')
  1453                 ifFalse:[
  1453                 ifFalse:[
  1454                     ^ false
  1454                     ^ false
  1455                 ].
  1455                 ].
  1456             ]
  1456             ]
  1457         ].
  1457         ].
  1458 
  1458 
  1459         true "doCheckinWithoutAsking" ifFalse:[
  1459         true "doCheckinWithoutAsking" ifFalse:[
  1460             answer := Dialog 
  1460             answer := Dialog 
  1461                  confirmWithCancel:(resources string:'%1 does not have any (usable) revision info (#version method)\\Shall I create one ?' with:className) withCRs
  1461                  confirmWithCancel:(resources string:'%1 does not have any (usable) revision info (#version method)\\Shall I create one ?' with:className) withCRs
  1462                  labels:(resources array:#( 'cancel' 'no' 'yes')).
  1462                  labels:(resources array:#( 'Cancel' 'No' 'Yes')).
  1463             answer isNil ifTrue:[^ false].
  1463             answer isNil ifTrue:[^ false].
  1464         ] ifTrue:[
  1464         ] ifTrue:[
  1465             answer := true.
  1465             answer := true.
  1466         ].
  1466         ].
  1467         answer ifTrue:[
  1467         answer ifTrue:[
  1475     "/
  1475     "/
  1476     "/ check for the module
  1476     "/ check for the module
  1477     "/
  1477     "/
  1478     (mgr checkForExistingModule:module) ifFalse:[
  1478     (mgr checkForExistingModule:module) ifFalse:[
  1479         (createDirs or:[creatingNew]) ifFalse:[
  1479         (createDirs or:[creatingNew]) ifFalse:[
  1480             self warn:(resources string:'a module named %1 does not exist in the source code management' with:module).
  1480             self warn:(resources string:'A module named %1 does not exist in the source code management' with:module).
  1481             ^ false
  1481             ^ false
  1482         ].
  1482         ].
  1483         (Dialog 
  1483         (Dialog 
  1484             confirm:(resources string:'%1 is a new module.\\create it ?' with:module) withCRs
  1484             confirm:(resources string:'%1 is a new module.\\create it ?' with:module) withCRs
  1485             noLabel:'cancel') 
  1485             noLabel:'Cancel') 
  1486         ifFalse:[
  1486         ifFalse:[
  1487             ^ false.
  1487             ^ false.
  1488         ].
  1488         ].
  1489         (mgr createModule:module) ifFalse:[
  1489         (mgr createModule:module) ifFalse:[
  1490             self warn:(resources string:'cannot create new module: %1' with:module).
  1490             self warn:(resources string:'Cannot create new module: %1' with:module).
  1491             ^ false.
  1491             ^ false.
  1492         ]
  1492         ]
  1493     ].
  1493     ].
  1494     LastModule := module.
  1494     LastModule := module.
  1495 
  1495 
  1502             self warn:(resources string:'a package named %1 does not exist module %2' with:module with:package).
  1502             self warn:(resources string:'a package named %1 does not exist module %2' with:module with:package).
  1503             ^ false
  1503             ^ false
  1504         ].
  1504         ].
  1505         (Dialog 
  1505         (Dialog 
  1506             confirm:(resources string:'%1 is a new package (in module %2).\\create it ?' with:package with:module) withCRs
  1506             confirm:(resources string:'%1 is a new package (in module %2).\\create it ?' with:package with:module) withCRs
  1507             noLabel:'cancel') 
  1507             noLabel:'Cancel') 
  1508         ifFalse:[
  1508         ifFalse:[
  1509             ^ false.
  1509             ^ false.
  1510         ].
  1510         ].
  1511         (mgr createModule:module package:package) ifFalse:[
  1511         (mgr createModule:module package:package) ifFalse:[
  1512             self warn:(resources string:'cannot create new package: %1 (in module %2)' with:package with:module).
  1512             self warn:(resources string:'Cannot create new package: %1 (in module %2)' with:package with:module).
  1513             ^ false.
  1513             ^ false.
  1514         ]
  1514         ]
  1515     ].
  1515     ].
  1516     LastPackage := package.
  1516     LastPackage := package.
  1517 
  1517 
  1518     "/
  1518     "/
  1519     "/ check for the container itself
  1519     "/ check for the container itself
  1520     "/
  1520     "/
  1521     (mgr checkForExistingContainerInModule:module package:package container:fileName) ifTrue:[
  1521     (mgr checkForExistingContainerInModule:module package:package container:fileName) ifTrue:[
  1522         creatingNew ifTrue:[
  1522         creatingNew ifTrue:[
  1523             self warn:(resources string:'container for %1 already exists in %2/%3.' with:fileName with:module with:package) withCRs.
  1523             self warn:(resources string:'Container for %1 already exists in %2/%3.' with:fileName with:module with:package) withCRs.
  1524         ].
  1524         ].
  1525 
  1525 
  1526 "/            (oldModule notNil
  1526 "/            (oldModule notNil
  1527 "/            and:[(oldModule ~= module)
  1527 "/            and:[(oldModule ~= module)
  1528 "/                 or:[oldPackage ~= package
  1528 "/                 or:[oldPackage ~= package
  1539     %2 / %3 / %4  ?'
  1539     %2 / %3 / %4  ?'
  1540                                 with:className
  1540                                 with:className
  1541                                 with:module 
  1541                                 with:module 
  1542                                 with:package 
  1542                                 with:package 
  1543                                 with:fileName) withCRs
  1543                                 with:fileName) withCRs
  1544                 noLabel:'cancel') 
  1544                 noLabel:'Cancel') 
  1545             ifFalse:[
  1545             ifFalse:[
  1546                 ^ false.
  1546                 ^ false.
  1547             ].  
  1547             ].  
  1548         ].  
  1548         ].  
  1549 
  1549 
  1563                 module:module 
  1563                 module:module 
  1564                 logMessage:msg)
  1564                 logMessage:msg)
  1565             ifFalse:[
  1565             ifFalse:[
  1566                 doCheckinWithoutAsking ifFalse:[
  1566                 doCheckinWithoutAsking ifFalse:[
  1567                     (Dialog 
  1567                     (Dialog 
  1568                         confirm:'no easy merge seems possible; force checkin (no merge) ?'
  1568                         confirm:'No easy merge seems possible; force checkin (no merge) ?'
  1569                         noLabel:'cancel') 
  1569                         noLabel:'Cancel') 
  1570                     ifFalse:[
  1570                     ifFalse:[
  1571                         ^ false.
  1571                         ^ false.
  1572                     ].
  1572                     ].
  1573                 ].
  1573                 ].
  1574                 forceCheckIn := true.
  1574                 forceCheckIn := true.
  1581                 directory:package 
  1581                 directory:package 
  1582                 module:module 
  1582                 module:module 
  1583                 logMessage:msg
  1583                 logMessage:msg
  1584                 force:true)
  1584                 force:true)
  1585             ifFalse:[
  1585             ifFalse:[
  1586                 self warn:(resources string:'failed to check into existing container.').
  1586                 self warn:(resources string:'Failed to check into existing container.').
  1587                 ^ false.
  1587                 ^ false.
  1588             ].
  1588             ].
  1589         ].
  1589         ].
  1590         ^ true
  1590         ^ true
  1591     ] ifFalse:[
  1591     ] ifFalse:[
  1592         (createContainer or:[creatingNew]) ifFalse:[
  1592         (createContainer or:[creatingNew]) ifFalse:[
  1593             (Dialog
  1593             (Dialog
  1594                  confirm:(resources string:'no container exists for %1 in %2/%3\\create ?' 
  1594                  confirm:(resources string:'No container exists for %1 in %2/%3\\create ?' 
  1595                                       with:fileName with:module with:package) withCRs
  1595                                       with:fileName with:module with:package) withCRs
  1596                  noLabel:'cancel') ifFalse:[
  1596                  noLabel:'Cancel') ifFalse:[
  1597                 ^ false
  1597                 ^ false
  1598             ]
  1598             ]
  1599         ]
  1599         ]
  1600     ].
  1600     ].
  1601 
  1601 
  1602     (mgr
  1602     (mgr
  1603             createContainerFor:aClass
  1603             createContainerFor:aClass
  1604             inModule:module
  1604             inModule:module
  1605             package:package
  1605             package:package
  1606             container:fileName) ifFalse:[
  1606             container:fileName) ifFalse:[
  1607         self warn:(resources string:'failed to create container.').
  1607         self warn:(resources string:'Failed to create container.').
  1608         ^ false.
  1608         ^ false.
  1609     ].
  1609     ].
  1610     ^ true
  1610     ^ true
  1611 !
  1611 !
  1612 
  1612 
  1952 ! !
  1952 ! !
  1953 
  1953 
  1954 !SourceCodeManagerUtilities class methodsFor:'documentation'!
  1954 !SourceCodeManagerUtilities class methodsFor:'documentation'!
  1955 
  1955 
  1956 version
  1956 version
  1957     ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilities.st,v 1.64 2001-09-10 14:12:24 cg Exp $'
  1957     ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilities.st,v 1.65 2001-10-04 17:26:38 cg Exp $'
  1958 ! !
  1958 ! !