VersionDiffBrowser.st
changeset 18000 1dad90c9fcd4
parent 17954 cf28096d3fa4
child 18034 d277ee012ff1
--- a/VersionDiffBrowser.st	Thu Mar 01 10:46:29 2018 +0100
+++ b/VersionDiffBrowser.st	Wed Mar 07 17:24:11 2018 +0100
@@ -2119,66 +2119,8 @@
         changeB := (methodsChangedFiltered at:sel) second.
         self withReadCursorDo:[
             |info|
-            
-            "/ see if the semantics have changed (or only prettyPrinted)
-            RBParser notNil ifTrue:[
-                (classChangeSet notNil
-                and:[ classChangeSet classBeingCompared notNil ]) ifTrue:[
-                    parseError := false.
-                    changeA isMethodChange ifTrue:[
-                        treeA := RBParser parseMethod:(changeA source) onError: [:str :pos | parseError := true].
-                        treeB := RBParser parseMethod:(changeB source) onError: [:str :pos | parseError := true].
-                        parseError ifFalse:[
-                            (treeA equalTo:treeB withMapping:(Dictionary new)) ifTrue:[
-                                info := 'Methods only differ in formatting / comments.'.
-                            ] ifFalse:[
-                                (treeA semanticallyEqualTo:treeB withMapping:(Dictionary  new)) ifTrue:[
-                                    info := 'Methods seem to do the same.'.
-                                ] ifFalse:[
-                                    info := 'Methods are different.'.
-                                ]
-                            ]
-                        ] ifTrue:[
-                            self infoHolder value:'ParseError while comparing - please check the code'.
-                        ].    
-                    ] ifFalse:[
-                        changeA isClassDefinitionChange ifTrue:[
-                            treeA := RBParser parseExpression:(changeA source) onError: [:str :pos | parseError := true].
-                            treeB := RBParser parseExpression:(changeB source) onError: [:str :pos | parseError := true].
-                            (treeA semanticallyEqualTo:treeB withMapping:(Dictionary  new)) ifTrue:[
-                                info := 'Class definitions seem to do the same.'.
-                            ] ifFalse:[
-                                info := 'Class definitions are different.'.
-                            ].    
-                            treeA receiver = treeB receiver ifFalse:[
-                                info := 'Superclass changed.'.
-                            ] ifTrue:[
-                                treeA arg1 = treeB arg1 ifFalse:[
-                                    info := 'Name changed.'.
-                                ] ifTrue:[
-                                    treeA arg2 = treeB arg2 ifFalse:[
-                                        info := 'Instvars changed.'.
-                                    ] ifTrue:[
-                                        treeA arg3 = treeB arg3 ifFalse:[
-                                            info := 'Classvars changed.'.
-                                        ] ifTrue:[
-                                            (treeA arg:4) = (treeB arg:4) ifFalse:[
-                                                info := 'Pooldict changed.'.
-                                            ] ifTrue:[
-                                                (treeA arg:5) = (treeB arg:5) ifFalse:[
-                                                    info := 'Category changed.'.
-                                                ].
-                                            ].
-                                        ].
-                                    ].
-                                ].
-                            ].
-                        ] ifFalse:[
-                            self halt.
-                        ].    
-                    ].    
-                ].
-            ].
+
+            info := self shortChangeInfoFor:changeA and:changeB.
             info notNil ifTrue:[
                 self infoHolder value:info
             ].    
@@ -2320,6 +2262,83 @@
     "Created: / 29-11-2017 / 13:04:12 / cg"
 !
 
+shortChangeInfoFor:changeA and:changeB
+    |parseError treeA treeB sameSuperClass sameClassName sameInstVars sameClassVars samePools sameCategory append info|
+
+    "/ see if the semantics have changed (or only prettyPrinted)
+    RBParser notNil ifTrue:[
+        (classChangeSet notNil
+        and:[ classChangeSet classBeingCompared notNil ]) ifTrue:[
+            parseError := false.
+            changeA isMethodChange ifTrue:[
+                changeB isMethodChange ifFalse:[^ 'Different change types'].
+
+                treeA := RBParser parseMethod:(changeA source) onError: [:str :pos | parseError := true].
+                treeB := RBParser parseMethod:(changeB source) onError: [:str :pos | parseError := true].
+                parseError ifFalse:[
+                    (treeA equalTo:treeB withMapping:(Dictionary new)) ifTrue:[
+                        ^ 'Methods only differ in formatting / comments'.
+                    ].
+                    (treeA semanticallyEqualTo:treeB withMapping:(Dictionary  new)) ifTrue:[
+                        ^ 'Methods seem to do the same'.
+                    ].
+                    ^ 'Methods are different'.
+                ].
+                self infoHolder value:'ParseError while comparing - please check the code'.
+                ^ nil
+            ].
+
+            changeA isClassDefinitionChange ifTrue:[
+                changeB isClassDefinitionChange ifFalse:[^ 'Different change types'].
+                treeA := RBParser parseExpression:(changeA source) onError: [:str :pos | parseError := true].
+                treeB := RBParser parseExpression:(changeB source) onError: [:str :pos | parseError := true].
+                (treeA semanticallyEqualTo:treeB withMapping:(Dictionary  new)) ifTrue:[
+                    ^ 'Class definitions seem to do the same'.
+                ].
+                sameSuperClass := treeA receiver = treeB receiver.
+                sameClassName := treeA arg1 = treeB arg1.
+                sameInstVars := treeA arg2 = treeB arg2.
+                sameClassVars := treeA arg3 = treeB arg3.
+                samePools := (treeA arg:4) = (treeB arg:4).
+                sameCategory := (treeA arg:5) = (treeB arg:5).
+
+                info := ''.
+                append := [:s | info := info isEmpty ifTrue:[s] ifFalse:[info,', ',s]].
+
+                sameSuperClass ifFalse:[
+                    append value:'Superclass'.
+                ].
+                sameClassName ifFalse:[
+                    append value:'Name'.
+                ].
+                sameInstVars ifFalse:[
+                    append value:'Instvars'.
+                ].
+                sameClassVars ifFalse:[
+                    append value:'Classvars'.
+                ].
+                samePools ifFalse:[
+                    append value:'SharedPools'.
+                ].
+                sameCategory ifFalse:[
+                    append value:'Category'.
+                ].
+                info notEmpty ifTrue:[ ^ 'different ',info ].
+                ^ 'Class definitions are different.'.
+            ].
+
+            changeA isClassCommentChange ifTrue:[
+                changeB isClassCommentChange ifFalse:[^ 'Different change types'].
+                changeA comment = changeB comment ifFalse:[^ 'Different class comment'].
+                ^ 'Same comment'.
+            ].
+
+            self halt.
+        ].    
+    ].
+    ^ nil
+!
+
 update:something with:parameter from:changedObject
     ((changedObject == includeExtensionsHolder)
     or:[ changedObject == includeCategoryChangesHolder