category & comments
authorClaus Gittinger <cg@exept.de>
Fri, 13 Jun 2003 19:10:34 +0200
changeset 1292 4f2a8ea516fa
parent 1291 60d89faa389f
child 1293 0f30366a25d2
category & comments
ChangeSet.st
--- a/ChangeSet.st	Thu Jun 12 13:05:50 2003 +0200
+++ b/ChangeSet.st	Fri Jun 13 19:10:34 2003 +0200
@@ -127,6 +127,35 @@
     "Modified: / 14.12.1999 / 15:23:16 / cg"
 !
 
+forExistingMethods:aCollectionOfMethods
+    "build a changeSet for a collection of methods.
+     That does of course not give deltas, but instead reflects the current
+     state of the given set of methods.
+     It is useful in conjunction with the other utility methods,
+     for example, when building patchLists, diffSets etc."
+
+    |changeSet stream previousPackage|
+
+    stream := ReadWriteStream on:''.
+    aCollectionOfMethods do:[:eachMethod | 
+        previousPackage ~= eachMethod package ifTrue:[
+            stream nextPutAll:'"{ Package: '''.
+            stream nextPutAll:eachMethod package asString.
+            stream nextPutAll:''' }"'; cr; cr.
+        ].
+        eachMethod mclass fileOutMethod:eachMethod on:stream
+    ].
+    stream reset.
+    changeSet := self fromStream:stream.
+    ^ changeSet
+
+    "
+     ChangeSet forExistingMethods:(Array with:(Array compiledMethodAt:#at:)
+                                         with:(Object compiledMethodAt:#at:)
+                                         with:(Behavior compiledMethodAt:#compiledMethodAt:) )
+    "
+!
+
 fromDolphinPACStream:aStream
     "build a changeSet from a stream, containing dolphin pac file chunks."
 
@@ -1639,6 +1668,14 @@
     onlyInReceiver := something.
 ! !
 
+!ChangeSet::DiffSet methodsFor:'queries'!
+
+isEmpty
+    ^ changed isEmpty
+    and:[ onlyInReceiver isEmpty
+    and:[ onlyInArg isEmpty ] ]
+! !
+
 !ChangeSet::DolphinPACFileReader methodsFor:'reading-private'!
 
 handleCategoriesForClass
@@ -1882,5 +1919,5 @@
 !ChangeSet class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.101 2003-06-03 16:25:17 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.102 2003-06-13 17:10:34 cg Exp $'
 ! !