'From Squeak3.5 of ''11 April 2003'' [latest update: #5180] on 7 May 2003 at 11:53:35 pm'! "Change Set: CommonCodeRepository-sbw Date: 10 November 2002 Author: Stephan B. Wessels Provides an easy to use mechanism for change set fileouts to go to a specified location. By default the location is still the image directory. However, you can specify a new location in any change sorter. The change set repository location remains constant regardless of which change set is current. Date Update ------------- ----------------------------------------------------------------------- 15-apr-2003 Update for Squeak 3.5 10-Nov-2002 initial file release "! FileDirectory subclass: #ChangeSetDirectory instanceVariableNames: '' classVariableNames: 'RepositoryDirectory ' poolDictionaries: '' category: 'CommonCodeRepository'! CrLfFileStream subclass: #ChangeSetFileStream instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'CommonCodeRepository'! !ChangeSet methodsFor: '*commonCodeRepository-fileIn/Out' stamp: 'sbw 4/27/2003 18:11'! fileOut "File out the receiver, to a file whose name is a function of the change-set name and either of the date & time or chosen to have a unique numeric tag, depending on the preference 'changeSetVersionNumbers'" | file slips nameToUse limit | self checkForConversionMethods. nameToUse _ Preferences changeSetVersionNumbers ifTrue: [ChangeSetDirectory default nextNameFor: self name extension: 'cs'] ifFalse: [(self name , FileDirectory dot , Utilities dateTimeSuffix , FileDirectory dot , 'cs') asFileName]. limit _ (ChangeSorter class canUnderstand: #publishChangeSets) ifTrue: [100] ifFalse: [30]. nameToUse size > (limit + 1) ifTrue: [nameToUse _ FillInTheBlank request: (nameToUse , '\has ' , nameToUse size asString , ' letters - too long for Mac OS.\Suggested replacement is:') withCRs initialAnswer: (nameToUse contractTo: limit). nameToUse = '' ifTrue: [^ self]]. Cursor write showWhile: [[file _ ChangeSetFileStream newFileNamed: nameToUse. file header; timeStamp. self fileOutPreambleOn: file. self fileOutOn: file. self fileOutPostscriptOn: file. file trailer] ensure: [file close]]. Preferences checkForSlips ifFalse: [^ self]. slips _ self checkForSlips. (slips size > 0 and: [(PopUpMenu withCaption: 'Methods in this fileOut have halts or references to the Transcript or other ''slips'' in them. Would you like to browse them?' chooseFrom: 'Ignore\Browse slips') = 2]) ifTrue: [Smalltalk browseMessageList: slips name: 'Possible slips in ' , name]! ! !ChangeSetDirectory class methodsFor: 'as yet unclassified' stamp: 'sbw 11/10/2002 19:43'! default "ChangeSetDirectory default" RepositoryDirectory == nil ifTrue: [self initializeRepositoryDirectory]. ^ RepositoryDirectory! ! !ChangeSetDirectory class methodsFor: 'as yet unclassified' stamp: 'sbw 11/10/2002 19:43'! initializeRepositoryDirectory self setDefaultDirectory: super default pathName! ! !ChangeSetDirectory class methodsFor: 'as yet unclassified'! isActiveDirectoryClass ^ false! ! !ChangeSetDirectory class methodsFor: 'as yet unclassified' stamp: 'sbw 11/10/2002 19:40'! setDefaultDirectory: directoryName | dirName | dirName _ directoryName. [dirName endsWith: self slash] whileTrue: [dirName _ dirName copyFrom: 1 to: dirName size - self slash size]. RepositoryDirectory _ self on: dirName! ! !ChangeSetFileStream class methodsFor: 'as yet unclassified' stamp: 'sbw 11/10/2002 19:51'! fullName: fileName ^ ChangeSetDirectory default fullNameFor: fileName! ! !ChangeSorter methodsFor: '*commonCodeRepository-changeSet menu' stamp: 'sbw 11/10/2002 20:05'! changeRepositoryLocation | dir path | dir _ FileList2 modalFolderSelector. dir isNil ifTrue: [^ nil]. path _ dir pathName. ChangeSetDirectory setDefaultDirectory: path! ! !ChangeSorter methodsFor: '*commonCodeRepository-changeSet menu' stamp: 'sbw 5/7/2003 23:51'! changeSetMenu: aMenu shifted: isShifted "Set up aMenu to hold commands for the change-set-list pane. This could be for a single or double changeSorter" isShifted ifTrue: [^ self shiftedChangeSetMenu: aMenu]. Smalltalk isMorphic ifTrue: [aMenu title: 'Change Set'. aMenu addStayUpItemSpecial] ifFalse: [aMenu title: 'Change Set: ' , myChangeSet name]. aMenu add: 'make changes go to me (m)' action: #newCurrent. aMenu addLine. aMenu add: 'new change set... (n)' action: #newSet. aMenu add: 'find...(f)' action: #findCngSet. aMenu add: 'show category... (s)' action: #chooseChangeSetCategory. aMenu balloonTextForLastItem: 'Lets you choose which change sets should be listed in this change sorter'. aMenu add: 'select change set...' action: #chooseCngSet. aMenu addLine. aMenu add: 'rename change set (r)' action: #rename. aMenu add: 'file out (o)' action: #fileOut. aMenu add: 'mail to list' action: #mailOut. (Smalltalk includesKey: #ChangeSetDirectory) ifTrue: [ aMenu add: 'change repository from "' , (Smalltalk at: #ChangeSetDirectory) default localName , '"' action: #changeRepositoryLocation]. aMenu add: 'browse methods (b)' action: #browseChangeSet. aMenu add: 'browse change set (B)' action: #openChangeSetBrowser. aMenu addLine. parent ifNotNil: [aMenu add: 'copy all to other side (c)' action: #copyAllToOther. aMenu add: 'submerge into other side' action: #submergeIntoOtherSide. aMenu add: 'subtract other side (-)' action: #subtractOtherSide. aMenu addLine]. myChangeSet hasPreamble ifTrue: [aMenu add: 'edit preamble (p)' action: #addPreamble. aMenu add: 'remove preamble' action: #removePreamble. (ChangeSorter canUnderstand: #hasSqueakMapNameTagEntry) ifTrue: [((self perform: #hasSqueakMapNameTagEntry) not and: [self okToChange]) ifTrue: [aMenu add: 'add SqueakMap name entry to preamble...' action: #addSqueakMapName]]] ifFalse: [aMenu add: 'add preamble (p)' action: #addPreamble]. myChangeSet hasPostscript ifTrue: [aMenu add: 'edit postscript...' action: #editPostscript. aMenu add: 'remove postscript' action: #removePostscript] ifFalse: [aMenu add: 'add postscript...' action: #editPostscript]. aMenu addLine. aMenu add: 'category functions...' action: #offerCategorySubmenu. aMenu balloonTextForLastItem: 'Various commands relating to change-set-categories'. aMenu addLine. aMenu add: 'destroy change set (x)' action: #remove. aMenu addLine. aMenu add: 'more...' action: #offerShiftedChangeSetMenu. ^ aMenu! !