ChangeSet.st
branchjv
changeset 3033 8964521a2c1b
parent 3032 f8b04203694b
child 3034 c892671f3e2a
--- a/ChangeSet.st	Tue Mar 20 12:34:31 2012 +0000
+++ b/ChangeSet.st	Tue Mar 20 16:55:14 2012 +0000
@@ -35,7 +35,8 @@
 !
 
 SmalltalkChunkFileSourceWriter subclass:#ClassSourceWriter
-	instanceVariableNames:'changeSetBeingSaved infos topClassName classInfos metaInfos'
+	instanceVariableNames:'changeSetBeingSaved namespaceName topClassName classInfos
+		metaInfos'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:ChangeSet
@@ -1698,8 +1699,6 @@
 
         anyFound ifFalse:[
             onlyInReceiver add:aChangeInA.
-        ] ifTrue:[
-            same add: aChangeInA.
         ]
     ].
 
@@ -1775,6 +1774,8 @@
                         Array with:cA with:cB
                       ].
 
+    same := self reject:[:chg|(changedMethods contains:[:pair|pair first == chg]) or:[onlyInReceiver includes: chg]].
+
     ret := DiffSet new
                 changed:changedMethods
                 onlyInReceiver:onlyInReceiver
@@ -1785,7 +1786,7 @@
 
     "Modified: / 12-10-2006 / 22:22:39 / cg"
     "Modified (comment): / 01-12-2011 / 19:12:55 / cg"
-    "Modified: / 19-03-2012 / 21:36:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 20-03-2012 / 14:13:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 diffSetsAgainstImage
@@ -1972,14 +1973,20 @@
     ].
 
     formatSymbolOrNil == #classSource ifTrue:[
-        ClassSourceWriter new fileOut: self on: aStream.
+        ClassSourceWriter new 
+            fileOut:self 
+            on:aStream 
+            withTimeStamp:false 
+            withInitialize:true 
+            withDefinition:true
+            methodFilter:nil encoder:nil.
         ^self.
     ].
 
     self error:'Unknown format, possible formats are { nil, #classSource }'
 
     "Created: / 08-02-2011 / 11:25:16 / cg"
-    "Modified: / 19-03-2012 / 17:22:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 20-03-2012 / 14:06:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !ChangeSet::ChangeFileReader methodsFor:'accessing'!
@@ -2702,7 +2709,7 @@
     "Pass 1 - collect classes"
     changeSetBeingSaved do:[:change|
         change isClassDefinitionChange ifTrue:[
-            | nm |
+            | nm ns |
 
             nm := change className.
             (nm endsWith:' class') ifFalse:[
@@ -2715,10 +2722,20 @@
                 change isPrivateClassDefinitionChange ifFalse:[
                     topClassName notNil ifTrue:[
                         self error: ('Multiple top class definitions (%1 vs %2)' bindWith: topClassName with: nm).
+                        ^self.
                     ].
                     topClassName := nm.
                 ]
             ].
+            ns := change nameSpaceName.
+            ns notNil ifTrue:[
+                (namespaceName notNil and:[namespaceName ~= ns]) ifTrue:[
+                    self error:('Multiple namespaces (%1 vs %2)' bindWith: namespaceName with: ns).
+                    ^self.
+                ] ifFalse:[
+                    namespaceName := ns.
+                ]
+            ].
         ]
     ].
 
@@ -3000,12 +3017,15 @@
     nonMetaInfo definition isPrivateClassDefinitionChange ifFalse:[
         nonMetaInfo definition package notNil ifTrue:[
             aStream nextPutAll: ('"{ Package: ''%1'' }"' bindWith: nonMetaInfo definition package).
-            aStream cr.
+            aStream cr; cr.
+        ].
+        namespaceName notNil ifTrue:[
+            aStream nextPutAll: ('"{ NameSpace: %1 }"' bindWith: namespaceName).
+            aStream cr; cr.
         ].
     ].
 
-
-    aStream nextPutAll: nonMetaInfo definition source.
+    aStream nextPutAll: nonMetaInfo definition definitionStringWithoutNamespace.
     aStream nextPutChunkSeparator. 
     aStream cr; cr.
 
@@ -3014,7 +3034,7 @@
     "/
     metaInfo := metaInfos at: nonMetaInfo name.
     metaInfo definition notNil ifTrue:[
-        aStream nextPutAll: metaInfo definition source.
+        aStream nextPutAll: metaInfo definition definitionStringWithoutNamespace.
         aStream nextPutChunkSeparator. 
         aStream cr; cr
     ].
@@ -3221,8 +3241,20 @@
 
 !ChangeSet::ClassSourceWriter::ClassInfo methodsFor:'printing & storing'!
 
-printClassNameOn:aStream    
-    aStream nextPutAll: name
+printClassNameOn:aStream
+    | nameWithoutNs i |
+
+    nameWithoutNs := name.
+    i := nameWithoutNs indexOf: $:.
+    i ~~ 0 ifTrue:[
+        self assert: (nameWithoutNs at: i + 1) == $:.
+        nameWithoutNs := nameWithoutNs copyFrom: i + 2.
+    ].
+    definition notNil ifTrue:[
+        self assert: nameWithoutNs = definition classNameWithoutNamespace
+    ].
+
+    aStream nextPutAll: nameWithoutNs
 
     "Created: / 19-03-2012 / 18:17:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
@@ -3667,5 +3699,5 @@
 !
 
 version_SVN
-    ^ '$Id: ChangeSet.st 1898 2012-03-20 12:34:31Z vranyj1 $'
+    ^ '$Id: ChangeSet.st 1899 2012-03-20 16:55:14Z vranyj1 $'
 ! !