csq031@umaxc.weeg.uiowa.edu (02/18/91)
We are working on group projects here, using Smalltalk 80 2.5. We were
trying to use CVS for source code control, and ran into a problem with
the way smalltalk manages fileouts.
Apparently, the order in which classes in a category, protocols in a class,
and methods in a protocol is changed when you use the browser. This
capricious reorganization defeats CVS's attempts to reconcile concurrent
changes by different people. Diff gets confused, mistaking reordering for
changes.
The following file-in forces the fileout code to sort things so that your
file outs have a canonical order, which makes diff (and CVS) much happier.
------------------------------CUT HERE--------------------------------------
!ClassDescription methodsFor: 'fileIn/Out'!
fileOutCategory: aString on: aFileStream moveSource: moveSource toFile: fileIndex
"File a description of the receiver's category, aString, onto aFileStream. If
the boolean argument, moveSource, is true, then set the trailing bytes to the position
of aFileStream and to fileIndex in order to indicate where to find the source code."
self printCategoryChunk: aString on: aFileStream.
(self organization listAtCategoryNamed: aString) asSortedCollection
do: [:sel | self
printMethodChunk: sel
on: aFileStream
moveSource: moveSource
toFile: fileIndex].
aFileStream nextChunkPut: ' '!
fileOutOn: aFileStream moveSource: moveSource toFile: fileIndex
"File the receiver out on aFileStream."
aFileStream emphasis: 5. "Meant to be 12 point bold font."
aFileStream nextChunkPut: self definition.
self organization
putCommentOnFile: aFileStream
numbered: fileIndex
moveSource: moveSource.
aFileStream cr.
self organization categories asSortedCollection do:
[:heading |
self
fileOutCategory: heading
on: aFileStream
moveSource: moveSource
toFile: fileIndex]! !
!SystemOrganizer methodsFor: 'fileIn/Out'!
fileOutCategory: category on: aFileStream
"File a description of the receiver's category onto the stream aFileStream."
| first x dict class|
first _ true.
x _ (self superclassOrder: category).
dict _ Dictionary new.
x do: [:each | dict at: (each name) put: each].
dict keys asSortedCollection do:
[:each | class _ dict at: each.
first
ifTrue: [first _ false]
ifFalse: [aFileStream cr; nextPut: Character newPage; cr].
class
fileOutOn: aFileStream
moveSource: false
toFile: 0.
class removeFromChanges]! !
--
Kent Williams --- williams@umaxc.weeg.uiowa.edu
"'Is this heaven?' --- 'No, this is Iowa'" - from the movie "Field of Dreams"
"This isn't heaven, ... this is Cleveland" - Harry Allard, in "The Stupids Die"