VersionDiffBrowser.st
changeset 11961 094f448dc1f0
parent 11958 949cbf2cbeb2
child 11962 1d931eea22af
--- a/VersionDiffBrowser.st	Tue Oct 30 16:03:40 2012 +0100
+++ b/VersionDiffBrowser.st	Tue Oct 30 16:26:38 2012 +0100
@@ -741,17 +741,30 @@
 
 openOnDiffSet:diffSet labelA:aLabelA labelB:aLabelB title:ignoredTitle
     ^ self
-	openOnDiffSet:diffSet labelA:aLabelA labelB:aLabelB title:ignoredTitle
-	ignoreExtensions:false
+        openOnDiffSet:diffSet 
+        labelA:aLabelA labelB:aLabelB 
+        title:ignoredTitle
+        ignoreExtensions:false
+        ignoreVersionMethods:false
 
     "Modified: / 12-09-2011 / 11:52:44 / cg"
 !
 
-openOnDiffSet:diffSet labelA:aLabelA labelB:aLabelB title:ignoredTitle ignoreExtensions:aBoolean
+openOnDiffSet:diffSet labelA:aLabelA labelB:aLabelB title:ignoredTitle ignoreExtensions:ignoreExtensionsBoolean
+    ^ self
+        openOnDiffSet:diffSet 
+        labelA:aLabelA labelB:aLabelB 
+        title:ignoredTitle 
+        ignoreExtensions:ignoreExtensionsBoolean 
+        ignoreVersionMethods:false
+!
+
+openOnDiffSet:diffSet labelA:aLabelA labelB:aLabelB title:ignoredTitle ignoreExtensions:ignoreExtensionsBoolean ignoreVersionMethods:ignoreVersionMethodsBoolean
     |theBrowser|
 
     theBrowser := self new.
-    theBrowser ignoreExtensions:aBoolean.
+    theBrowser ignoreExtensions:ignoreExtensionsBoolean.
+    theBrowser ignoreVersionMethods:ignoreVersionMethodsBoolean.
     theBrowser allButOpen.
     theBrowser setupForDiffSet:diffSet labelA:aLabelA labelB:aLabelB.
     theBrowser window label:ignoredTitle.
@@ -864,6 +877,16 @@
     "Modified: / 06-03-2012 / 15:37:32 / cg"
 !
 
+ignoreVersionMethods:aBoolean
+    "if true, version methods (version and version_XXX) are suppressed.
+     Ignoring is useful when comparing for real code changes.
+     the default is false"
+
+    self includeVersionMethods:aBoolean not
+
+    "Modified: / 06-03-2012 / 15:37:32 / cg"
+!
+
 selectedChangeInA
     "
     gets the selected method change for the 'method only in version A'.
@@ -1874,41 +1897,56 @@
 updateLists
     |classChangeSet listOnlyInA listOnlyInB listChanged
      printStringGenerator sortBlockForChangeLists filteredList
-     isIgnoredChange numIgnoredExtensions|
+     isIgnoredChange numIgnoredExtensions numIgnoredVersionMethods 
+     info needFilter|
 
     classChangeSet := self classChangeSet.
 
     printStringGenerator := [:aChange | self printStringForChange:aChange].
     sortBlockForChangeLists := [:a :b | (printStringGenerator value:a) < (printStringGenerator value:b)].
 
-    numIgnoredExtensions := 0.
+    numIgnoredExtensions := numIgnoredVersionMethods := 0.
+    needFilter := self includeExtensions not 
+                  or:[self includeCategoryChanges not
+                  or:[self includeVersionMethods not]].
 
     isIgnoredChange :=
         [:change |
             |packageOfMethodInChange packageOfMethodInImage changeMethod ignored|
 
             ignored := false.
-            (change isMethodCodeChange and:[ self includeExtensions not ]) ifTrue:[
-                packageOfMethodInChange := change package.
-                (packageOfMethodInChange notNil
-                  and:[ packageOfMethodInChange ~= PackageId noProjectID
-                  and:[ packageOfMethodInChange ~= change changeClass package ]]) ifTrue:[
-                    ignored := true
-                ].
-
-                changeMethod := change changeMethod.
-                changeMethod notNil ifTrue:[
-                    packageOfMethodInImage := changeMethod package.
-                    (true "packageOfMethodInImage notNil"
-                      and:[ packageOfMethodInImage ~= PackageId noProjectID
-                      and:[ packageOfMethodInImage ~= changeMethod mclass package ]]) ifTrue:[
+            change isMethodCodeChange ifTrue:[
+                self includeExtensions ifFalse:[
+                    packageOfMethodInChange := change package.
+                    (packageOfMethodInChange notNil
+                      and:[ packageOfMethodInChange ~= PackageId noProjectID
+                      and:[ packageOfMethodInChange ~= change changeClass package ]]) ifTrue:[
                         ignored := true
                     ].
+
+                    changeMethod := change changeMethod.
+                    changeMethod notNil ifTrue:[
+                        packageOfMethodInImage := changeMethod package.
+                        (true "packageOfMethodInImage notNil"
+                          and:[ packageOfMethodInImage ~= PackageId noProjectID
+                          and:[ packageOfMethodInImage ~= changeMethod mclass package ]]) ifTrue:[
+                            ignored := true
+                        ].
+                    ].
+                    numIgnoredExtensions := numIgnoredExtensions + (ignored ifTrue:[1] ifFalse:[0]).
                 ].
-                numIgnoredExtensions := numIgnoredExtensions + (ignored ifTrue:[1] ifFalse:[0]).
+                self includeVersionMethods ifFalse:[
+                    (change isMethodChangeForVersionMethod
+                    or:[ change isMethodChangeForExtensionsVersionMethod ]) ifTrue:[
+                        ignored := true.
+                        numIgnoredVersionMethods := numIgnoredVersionMethods + 1
+                    ].
+                ].
             ] ifFalse:[
-                (change isMethodCategoryChange and:[self includeCategoryChanges not]) ifTrue:[
-                    ignored := true
+                change isMethodCategoryChange ifTrue:[
+                    self includeCategoryChanges ifFalse:[
+                        ignored := true
+                    ]
                 ].
             ].
             ignored.
@@ -1919,7 +1957,7 @@
     classChangeSet notNil ifTrue:[
         "/ classChangeSet methodsOnlyInA sort:sortBlockForChangeLists.
         filteredList := classChangeSet methodsOnlyInA.
-        (self includeExtensions not or:[self includeCategoryChanges not]) ifTrue:[
+        needFilter ifTrue:[
             filteredList := filteredList reject:isIgnoredChange.
         ].
         listOnlyInA addAll: (filteredList collect:printStringGenerator).
@@ -1931,7 +1969,7 @@
     classChangeSet notNil ifTrue:[
         "/ classChangeSet methodsOnlyInB sort:sortBlockForChangeLists.
         filteredList := classChangeSet methodsOnlyInB.
-        (self includeExtensions not or:[self includeCategoryChanges not]) ifTrue:[
+        needFilter ifTrue:[
             filteredList := filteredList reject:isIgnoredChange.
         ].
         listOnlyInB addAll: (filteredList collect:printStringGenerator).
@@ -1943,7 +1981,7 @@
     classChangeSet notNil ifTrue:[
         "/ classChangeSet methodsChanged sort:[:a :b | sortBlockForChangeLists value:a first value:b first].
         filteredList := classChangeSet methodsChanged.
-        (self includeExtensions not or:[self includeCategoryChanges not]) ifTrue:[
+        needFilter ifTrue:[
             filteredList := filteredList reject:[:entry | isIgnoredChange value:entry first].
         ].
         listChanged addAll: (filteredList collect:[:entry| printStringGenerator value:(entry first)]).
@@ -1957,11 +1995,14 @@
                             and: [(listOnlyInA notEmpty
                                   or:[listOnlyInB notEmpty])]) not.
 
+    info := ''.
     numIgnoredExtensions ~~ 0 ifTrue:[
-        self infoHolder value:('%1 extension methods ignored.' bindWith:numIgnoredExtensions)
-    ] ifFalse:[
-        self infoHolder value:nil
+        info := info , ('%1 extension methods ignored. ' bindWith:numIgnoredExtensions).
     ].
+    numIgnoredVersionMethods ~~ 0 ifTrue:[
+        info := info , ('%1 version methods ignored.' bindWith:numIgnoredVersionMethods).
+    ].
+    self infoHolder value:info
 
     "Modified: / 17-07-2012 / 18:34:36 / cg"
 ! !
@@ -2409,9 +2450,9 @@
 !VersionDiffBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/VersionDiffBrowser.st,v 1.109 2012-10-30 14:26:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/VersionDiffBrowser.st,v 1.110 2012-10-30 15:26:38 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/VersionDiffBrowser.st,v 1.109 2012-10-30 14:26:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/VersionDiffBrowser.st,v 1.110 2012-10-30 15:26:38 cg Exp $'
 ! !