'From Squeak3.4beta of ''1 December 2002'' [latest update: #5147] on 13 December 2002 at 12:08:56 pm'! "Change Set: FileInGZDirectly-nk Date: 13 December 2002 Author: Ned Konz This CS lets you file in and browse compressed changes files directly from the FileList, without having to decompress them first. "! !ChangeList class methodsFor: 'fileIn/Out' stamp: 'nk 12/13/2002 11:58'! browseCompressedChangesFile: fullName "Browse the selected file in fileIn format." | zipped unzipped | fullName ifNil: [ ^self beep ]. zipped _ GZipReadStream on: (FileStream readOnlyFileNamed: fullName). unzipped _ ReadStream on: zipped contents asString. ChangeList browseStream: unzipped! ! !ChangeList class methodsFor: 'fileIn/Out' stamp: 'nk 12/13/2002 12:05'! fileReaderServicesForFile: fullName suffix: suffix (FileStream isSourceFileSuffix: suffix) ifTrue: [^ Array with: self serviceBrowseChangeFile]. suffix = 'changes' ifTrue: [^ Array with: self serviceBrowseDotChangesFile]. (fullName asLowercase endsWith: '.cs.gz') ifTrue: [^ Array with: self serviceBrowseCompressedChangeFile]. ^ #()! ! !ChangeList class methodsFor: 'fileIn/Out' stamp: 'nk 12/13/2002 12:03'! serviceBrowseCompressedChangeFile "Answer a service for opening a changelist browser on a file" ^ SimpleServiceEntry provider: self label: 'changelist browser' selector: #browseCompressedChangesFile: description: 'open a changelist tool on this file' buttonLabel: 'changes'! ! !ChangeList class methodsFor: 'fileIn/Out' stamp: 'nk 12/13/2002 12:04'! services "Answer potential file services associated with this class" ^ { self serviceBrowseChangeFile. self serviceBrowseDotChangesFile. self serviceBrowseCompressedChangeFile }! ! !ReadStream methodsFor: 'file stream compatibility' stamp: 'nk 12/13/2002 12:00'! localName ^'ReadStream'! ! !ReadStream methodsFor: 'file stream compatibility' stamp: 'nk 12/13/2002 12:01'! openReadOnly! ! !ReadStream methodsFor: 'file stream compatibility' stamp: 'nk 12/13/2002 12:00'! readOnly! ! !GZipReadStream class methodsFor: 'fileIn/Out' stamp: 'nk 12/13/2002 11:50'! fileIn: fullFileName "FileIn the contents of a gzipped file" | zipped unzipped | zipped _ self on: (FileStream readOnlyFileNamed: fullFileName). unzipped _ ReadStream on: (zipped contents asString). unzipped fileIn.! ! !GZipReadStream class methodsFor: 'fileIn/Out' stamp: 'nk 12/13/2002 11:50'! fileIntoNewChangeSet: fullFileName "FileIn the contents of a gzipped file" | zipped unzipped cs | cs _ Smalltalk at: #ChangeSorter ifAbsent: [ ^self ]. zipped _ self on: (FileStream readOnlyFileNamed: fullFileName). unzipped _ ReadStream on: zipped contents asString. cs newChangesFromStream: unzipped named: (FileDirectory localNameFor: fullFileName) ! ! !GZipReadStream class methodsFor: 'fileIn/Out' stamp: 'nk 12/13/2002 11:52'! fileReaderServicesForFile: fullName suffix: suffix | services | suffix = 'gz' | (suffix = '*') ifFalse: [^ #()]. services _ OrderedCollection new. (fullName asLowercase endsWith: '.cs.gz') ifTrue: [services add: self serviceFileIn. (Smalltalk includesKey: #ChangeSorter) ifTrue: [services add: self serviceFileIntoNewChangeSet]]. services addAll: self services. ^ services! ! !GZipReadStream class methodsFor: 'fileIn/Out' stamp: 'nk 12/13/2002 11:14'! serviceFileIn "Answer a service for filing in an entire file" ^ SimpleServiceEntry provider: self label: 'fileIn entire file' selector: #fileIn: description: 'file in the entire decompressed contents of the file, which is expected to contain Smalltalk code in fileout ("chunk") format' buttonLabel: 'filein' ! ! !GZipReadStream class methodsFor: 'fileIn/Out' stamp: 'nk 12/13/2002 11:26'! serviceFileIntoNewChangeSet "Answer a service for filing in an entire file" ^ SimpleServiceEntry provider: self label: 'install into new change set' selector: #fileIntoNewChangeSet: description: 'install the decompressed contents of the file as a body of code in the image: create a new change set and file-in the selected file into it' buttonLabel: 'install'! !