diff -r 2781ddd0ab73 -r c048825b966f SourceCodeManagerUtilities.st --- a/SourceCodeManagerUtilities.st Thu Aug 24 21:31:23 2006 +0200 +++ b/SourceCodeManagerUtilities.st Thu Aug 24 21:31:26 2006 +0200 @@ -98,6 +98,10 @@ !SourceCodeManagerUtilities class methodsFor:'utilities'! +nameOfExtensionsContainer + ^ 'extensions.st' +! + setPackageOfAllMethodsIn:aClass to:aPackage "make all methods belong to the classes project" @@ -154,7 +158,7 @@ !SourceCodeManagerUtilities class methodsFor:'utilities-cvs'! -checkForExistingModule:module package:directory container:containerFileName using:mgr allowCreate:allowCreate +checkForExistingModule:module directory:directory container:containerFileName using:mgr allowCreate:allowCreate |resources moduleName directoryName containerName| resources := self classResources. @@ -189,32 +193,32 @@ "Modified: / 23-08-2006 / 13:56:19 / cg" ! -checkForExistingModule:module package:package using:mgr allowCreate:allowCreate - |resources moduleName packageName| +checkForExistingModule:module directory:directory using:mgr allowCreate:allowCreate + |resources moduleNameBold directoryNameBold| resources := self classResources. - moduleName := module allBold. - packageName := package allBold. + moduleNameBold := module allBold. + directoryNameBold := directory allBold. "/ - "/ check for the package + "/ check for the directory "/ - (mgr checkForExistingModule:module package:package) ifFalse:[ + (mgr checkForExistingModule:module package:directory) ifFalse:[ allowCreate ifFalse:[ - self warn:(resources string:'A package named ''%1'' does not exist in module ''%2''' - with:packageName with:moduleName) withCRs. + self warn:(resources string:'A directory for ''%1'' does not exist in module ''%2''' + with:directoryNameBold with:moduleNameBold) withCRs. ^ false ]. (Dialog - confirm:(resources string:'''%1'' is a new package in module ''%2''.\\create it ?' - with:packageName with:moduleName) withCRs + confirm:(resources string:'''%1'' is a new directory in module ''%2''.\\create it ?' + with:directoryNameBold with:moduleNameBold) withCRs noLabel:'Cancel') ifFalse:[ ^ false. ]. - (mgr createModule:module package:package) ifFalse:[ - self warn:(resources string:'Cannot create new package: ''%1'' in module ''%2''' - with:packageName with:moduleName) withCRs. + (mgr createModule:module package:directory) ifFalse:[ + self warn:(resources string:'Cannot create new directory: ''%1'' in module ''%2''' + with:directoryNameBold with:moduleNameBold) withCRs. ^ false. ] ]. @@ -255,21 +259,21 @@ checkinClass:aClass "check a class into the source repository. - Asks interactively for log-message." + Asks interactively for a log-message." - ^ self checkinClass:aClass withLog:nil + ^ self checkinClass:aClass withInfo:nil ! -checkinClass:aClass withLog:aLogMessageOrNil +checkinClass:aClass withInfo:aLogInfoOrNil "check a class into the source repository. - If the argument, aLogMessageOrNil isNil, ask interactively for log-message." + If the argument, aLogInfoOrNil isNil, ask interactively for a log-message." - ^ self checkinClass:aClass withLog:aLogMessageOrNil withCheck:true + ^ self checkinClass:aClass withInfo:aLogInfoOrNil withCheck:true ! -checkinClass:aClass withLog:aLogMessageOrNil withCheck:doCheckClass +checkinClass:aClass withInfo:aLogInfoNil withCheck:doCheckClass "check a class into the source repository. - If the argument, aLogMessageOrNil isNil, ask interactively for log-message. + If the argument, aLogInfoNil isNil, ask interactively for log-message. If doCheckClass is true, the class is checked for send of halts etc." |logMessage checkinInfo info mgr pri resources newSelectors initialLog| @@ -284,7 +288,7 @@ ^ false ]. - aLogMessageOrNil isNil ifTrue:[ + aLogInfoNil isNil ifTrue:[ newSelectors := aClass selectors asSet. newSelectors addAll:(aClass class selectors). newSelectors size == 1 ifTrue:[ @@ -301,10 +305,11 @@ checkinInfo isNil ifTrue:[^ false]. logMessage := checkinInfo logMessage. ] ifFalse:[ - aLogMessageOrNil isString ifTrue:[ - logMessage := aLogMessageOrNil + aLogInfoNil isString ifTrue:[ + "soon obsolete..." + logMessage := aLogInfoNil ] ifFalse:[ - checkinInfo := aLogMessageOrNil. + checkinInfo := aLogInfoNil. logMessage := checkinInfo logMessage. ]. ]. @@ -393,24 +398,24 @@ "check a collection of classes into the source repository. Asks interactively for log-message." - ^ self checkinClasses:aCollectionOfClass withLog:nil + ^ self checkinClasses:aCollectionOfClass withInfo:nil ! -checkinClasses:aCollectionOfClasses withLog:aLogMessageOrNil +checkinClasses:aCollectionOfClasses withInfo:aLogInfoOrNil "check a bunch of classes into the source repository. - If the argument, aLogMessageOrNil isNil, ask interactively for log-message." + If the argument, aLogInfoOrNil isNil, ask interactively for log-message." ^ self checkinClasses:aCollectionOfClasses - withLog:aLogMessageOrNil + withInfo:aLogInfoOrNil withCheck:(UserPreferences current at:#checkClassesWhenCheckingIn ifAbsent:true) ! -checkinClasses:aCollectionOfClasses withLog:aLogMessageOrNil withCheck:doCheckClasses +checkinClasses:aCollectionOfClasses withInfo:aLogInfoOrStringNil withCheck:doCheckClasses "check a bunch of classes into the source repository. - If the argument, aLogMessageOrNil isNil, ask interactively for log-message." + If the argument, aLogInfoOrStringNil isNil, ask interactively for log-message." - |classes checkinInfo resources yesOrNoToAll| + |classes checkinInfoOrString resources yesOrNoToAll| "/ ignore private classes classes := aCollectionOfClasses select:[:aClass | aClass owningClass isNil]. @@ -423,21 +428,28 @@ self information:'Only unloaded classes given - nothing checked in.'. ^ self ]. + classes size == 1 ifTrue:[ - ^ self checkinClass:classes first withLog:aLogMessageOrNil withCheck:doCheckClasses. + ^ self checkinClass:classes first withInfo:aLogInfoOrStringNil withCheck:doCheckClasses. ]. resources := self classResources. - aLogMessageOrNil isNil ifTrue:[ - checkinInfo := SourceCodeManagerUtilities + aLogInfoOrStringNil isNil ifTrue:[ + checkinInfoOrString := self getCheckinInfoFor:(resources string:'%1 classes to checkin' with:aCollectionOfClasses size) - initialAnswer:nil. - checkinInfo isNil ifTrue:[ - ^ self + initialAnswer:nil + withQuickOption:true. + checkinInfoOrString isNil ifTrue:[^ self]. + checkinInfoOrString quickCheckIn ifTrue:[ + classes := classes select:[:aClass | ChangeSet current includesChangeForClassOrMetaclassOrPrivateClassOf:aClass]. + classes isEmpty ifTrue:[ + self information:'None of the classes has been changed.'. + ^ self + ]. ]. ] ifFalse:[ - checkinInfo := aLogMessageOrNil. + checkinInfoOrString := aLogInfoOrStringNil. ]. AbortAllOperationRequest handle:[:ex | @@ -458,7 +470,7 @@ ex proceed. ] do:[ AbortOperationRequest catch:[ - self checkinClass:aClass withLog:checkinInfo withCheck:doCheckClasses + self checkinClass:aClass withInfo:checkinInfoOrString withCheck:doCheckClasses ] ]. ] @@ -467,11 +479,11 @@ ]. ! -checkinExtensionMethods:aCollectionOfMethods forPackage:aPackageID withLog:aLogMessageOrNil +checkinExtensionMethods:aCollectionOfMethods forPackage:aPackageID withInfo:aLogInfoOrStringOrNil "checkin a projects extensions into the source repository. - If the argument, aLogMessageOrNil isNil, ask interactively for log-message." + If the argument, aLogInfoOrStringOrNil isNil, ask interactively for log-message." - |logMessage checkinInfo mgr pri resources module package i containerFileName s + |logMessage checkinInfo mgr pri resources module directory containerFileName s methodSource methodsSortedByName| resources := self classResources. @@ -479,24 +491,22 @@ mgr := aCollectionOfMethods first mclass theNonMetaclass sourceCodeManager. mgr isNil ifTrue:[ self warn:'No sourceCode manager defined - cannot checkin.'. -"/ self error:'No sourceCode manager defined' mayProceed:true. ^ false. ]. - module := AbstractSourceCodeManager moduleFromPackageID:aPackageID. - package := AbstractSourceCodeManager directoryFromPackageID:aPackageID. + module := aPackageID asPackageId module. + directory := aPackageID asPackageId directory. + containerFileName := self nameOfExtensionsContainer. - containerFileName := 'extensions.st'. - - aLogMessageOrNil isNil ifTrue:[ - checkinInfo := SourceCodeManagerUtilities getCheckinInfoFor:containerFileName allBold initialAnswer:nil. + aLogInfoOrStringOrNil isNil ifTrue:[ + checkinInfo := self getCheckinInfoFor:containerFileName allBold initialAnswer:nil. checkinInfo isNil ifTrue:[^ false]. logMessage := checkinInfo logMessage. ] ifFalse:[ - aLogMessageOrNil isString ifTrue:[ - logMessage := aLogMessageOrNil + aLogInfoOrStringOrNil isString ifTrue:[ + logMessage := aLogInfoOrStringOrNil ] ifFalse:[ - checkinInfo := aLogMessageOrNil. + checkinInfo := aLogInfoOrStringOrNil. logMessage := checkinInfo logMessage. ]. ]. @@ -504,10 +514,10 @@ (self checkForExistingModule:module using:mgr allowCreate:true) ifFalse:[^ false]. LastModule := module. - (self checkForExistingModule:module package:package using:mgr allowCreate:true) ifFalse:[^ false]. - LastPackage := package. + (self checkForExistingModule:module directory:directory using:mgr allowCreate:true) ifFalse:[^ false]. + LastPackage := directory. - (self checkForExistingModule:module package:package container:containerFileName using:mgr allowCreate:true) ifFalse:[^ false]. + (self checkForExistingModule:module directory:directory container:containerFileName using:mgr allowCreate:true) ifFalse:[^ false]. self activityNotification:(resources string:'Checking in %1' with:containerFileName). pri := Processor activePriority. @@ -553,7 +563,7 @@ (mgr checkin:containerFileName text:methodSource - directory:package + directory:directory module:module logMessage:logMessage force:false) @@ -567,7 +577,7 @@ mgr setSymbolicName:#stable revision:nil overWrite:true - path:(module, '/', package, '/', containerFileName). + path:(module, '/', directory, '/', containerFileName). ]. mgr postCheckInExtensionsForPackage:aPackageID ]. @@ -828,7 +838,7 @@ ] ]. - inChangeSet := ChangeSet current includesChangeForClass:aClass. + inChangeSet := ChangeSet current includesChangeForClassOrMetaclassOrPrivateClassOf:aClass. onlyHere isEmpty ifTrue:[ onlyInRep isEmpty ifTrue:[ @@ -963,18 +973,17 @@ If askForRevision is false, check-out the newest version." |resources directory module file - currentClass inChangeSet extensionMethods - aStream sourceToLoad currentSource rev revString - nm msg rev2 newestRev - pkg listHere listRep diffSet + inChangeSet extensionMethods + aStream sourceToLoad rev msg newestRev + listHere listRep diffSet changed onlyHere onlyInRep answer labels values singleChangeSelector changedClasses default | resources := self classResources. - directory := AbstractSourceCodeManager directoryFromPackageID:packageToCheckOut. - module := AbstractSourceCodeManager moduleFromPackageID:packageToCheckOut. - file := 'extensions.st'. + directory := packageToCheckOut asPackageId directory. + module := packageToCheckOut asPackageId module. + file := self nameOfExtensionsContainer. "/ "/ ask for revision @@ -1552,8 +1561,6 @@ "/ ]. aClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | mthd setPackage:requiredPackage]. aClass package:requiredPackage. - aClass changed:#projectOrganization. - Smalltalk changed:#projectOrganization with:(Array with:aClass). ]. info := aClass revisionInfo. @@ -1583,7 +1590,7 @@ ifFalse:[^ false]. LastModule := module. - (self checkForExistingModule:module package:directory using:mgr allowCreate:(createDirs or:[creatingNew])) + (self checkForExistingModule:module directory:directory using:mgr allowCreate:(createDirs or:[creatingNew])) ifFalse:[^ false]. LastPackage := directory. @@ -2402,15 +2409,28 @@ "get a log message for checking in a class. Return the message or nil if aborted." - |logMsg info initialAnswer| + ^ self + getCheckinInfoFor:aString + initialAnswer:initialAnswerOrNil + withQuickOption:false + + " + SourceCodeManagerUtilities getCheckinInfoFor:'hello' initialAnswer:'bla' + " - initialAnswerOrNil isNil ifTrue:[ - initialAnswer := LastSourceLogMessage. - ] ifFalse:[ - initialAnswer := initialAnswerOrNil. - ]. + "Modified: / 22-06-2006 / 12:49:30 / cg" +! + +getCheckinInfoFor:aString initialAnswer:initialAnswerOrNil withQuickOption:withQuickOption + "get a log message for checking in a class. + Return the message or nil if aborted." - info := Tools::CheckinInfoDialog getCheckinInfoFor:aString initialAnswer:initialAnswer. + |logMsg info| + + info := Tools::CheckinInfoDialog + getCheckinInfoFor:aString + initialAnswer:(initialAnswerOrNil ? LastSourceLogMessage) + withQuickOption:withQuickOption. info notNil ifTrue:[ logMsg := info logMessage. logMsg notNil ifTrue:[ @@ -2424,34 +2444,6 @@ " "Modified: / 22-06-2006 / 12:49:30 / cg" -! - -getLogMessageFor:aString - "get a log message for checking in a class. - Return the message or nil if aborted." - - ^ self getLogMessageFor:aString initialAnswer:LastSourceLogMessage - - " - SourceCodeManagerUtilities getLogMessageFor:'hello' - " -! - -getLogMessageFor:aString initialAnswer:initialAnswer - "get a log message for checking in a class. - Return the message or nil if aborted." - - |logMsg info| - - info := self getCheckinInfoFor:aString initialAnswer:initialAnswer. - info notNil ifTrue:[ - logMsg := info logMessage. - ]. - ^ logMsg - - " - SourceCodeManagerUtilities getLogMessageFor:'hello' - " ! ! !SourceCodeManagerUtilities class methodsFor:'utilities-encoding'! @@ -2506,5 +2498,5 @@ !SourceCodeManagerUtilities class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilities.st,v 1.129 2006-08-24 08:34:01 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilities.st,v 1.130 2006-08-24 19:31:26 cg Exp $' ! !