enhancements by Jan
authorClaus Gittinger <cg@exept.de>
Fri, 10 Sep 2004 15:50:16 +0200
changeset 1398 21787ad15a01
parent 1397 3c62fc69c1ca
child 1399 0402934fc7b2
enhancements by Jan
HistoryManager.st
--- a/HistoryManager.st	Fri Sep 10 15:48:11 2004 +0200
+++ b/HistoryManager.st	Fri Sep 10 15:50:16 2004 +0200
@@ -875,7 +875,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/HistoryManager.st,v 1.56 2004-09-10 13:48:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/HistoryManager.st,v 1.57 2004-09-10 13:50:16 cg Exp $'
 ! !
 
 !HistoryManager::HistoryLine class methodsFor:'filtering'!
@@ -894,22 +894,32 @@
         histLine isModified ifTrue:[
             "/ if there is another one, skip this
             aCollectionOfHistoryLines from:index+1 do:[:anotherHistLine |
-                anotherHistLine isModified ifTrue:[
-                    anotherHistLine user = histLine user ifTrue:[
-                        skip := true
-                    ]
+                ((anotherHistLine isModified 
+                    and: [anotherHistLine user = histLine user])
+                        and:[anotherHistLine what = histLine what])
+                            ifTrue:[skip := true]
+                ].
+            skip ifFalse: [
+                aCollectionOfHistoryLines do: [:anotherHistLine |
+                    (anotherHistLine isCreated and: [anotherHistLine user = histLine user])
+                        ifTrue: [
+                            ((AbsoluteTime
+                                fromDate: histLine date
+                                andTime: histLine time) -
+                                    (AbsoluteTime
+                                        fromDate: anotherHistLine date
+                                        andTime: anotherHistLine time)) < self modificationLimit
+                            ifTrue: [skip := true]
+                        ]
                 ]
-            ].
+            ]
         ] ifFalse:[
-            "/
             "/ filter out multiple created messages
             "/ (this only occurs if a method was copied from ClassA to ClassB)
-            "/
             histLine isCreated ifTrue:[
                 aCollectionOfHistoryLines from:index+1 do:[:anotherHistLine |
-                    anotherHistLine isCreated ifTrue:[
-                        skip := true
-                    ]
+                    (anotherHistLine isCreated and:[anotherHistLine what = histLine what]) 
+                        ifTrue:[skip := true]
                 ].
             ].
         ].
@@ -919,54 +929,21 @@
     ].
     ^ newCollection.
 
-"/    | allUsers newCollection aHistLine |
-"/
-"/    allUsers := Set new.
-"/
-"/    anOrderdCollectionOfHistoryLines do:[ :hl| allUsers add: hl user ].
-"/
-"/    allUsers size ~~ anOrderdCollectionOfHistoryLines ifTrue:[
-"/        "there is at least one user twice"
-"/        newCollection := OrderedCollection new.
-"/        1 to: (anOrderdCollectionOfHistoryLines size - 1) do:[ :index|
-"/            aHistLine :=(anOrderdCollectionOfHistoryLines at: index).
-"/            allUsers last = aHistLine user ifFalse:[
-"/                newCollection add: aHistLine.
-"/            ].
-"/        ].
-"/        "add the last element with the actucal HistoryLine"
-"/        newCollection add: anOrderdCollectionOfHistoryLines last.
-"/
-"/
-"/        "the new collection shold now be sorted at timeStamp. --- for further study"
-"/
-"/        ^newCollection.
-"/    ].
-"/
-"/    ^ anOrderdCollectionOfHistoryLines
+    "Modified: / 8.9.1995 / 17:20:40 / claus"
+    "Modified: / 20.4.1996 / 20:23:07 / cg"
+    "Modified: / 20.6.2004 / 16:36:00 / masca"
+    "Modified: / 1.9.2004 / 20:20:42 / janfrog"
+!
 
-
-    "
-     |u1 u2 u3 u4 u5 oc |
-     u1 := HistoryLine new.
-     u2 := HistoryLine for: 'claus'.
-     u3 := HistoryLine for: 'chris'.
-     u4 := HistoryLine new.
-     u5 := HistoryLine new.
+modificationLimit
+    "Answer the number of seconds between creation and
+     modifcation of a method within which the modification
+     line won't be added."
 
-     oc := OrderedCollection new.
-     oc add: u1.
-     oc add: u2.
-     oc add: u3.
-     oc add: u4.
-     oc add: u5.
+    ^ 3600 "/one hour
 
-     oc inspect.
-     (HistoryLine filterHistoryLines: oc) inspect 
-    "
-
-    "Modified: 8.9.1995 / 17:20:40 / claus"
-    "Modified: 20.4.1996 / 20:23:07 / cg"
+    "Created: / 20.6.2004 / 16:32:35 / masca"
+    "Modified: / 2.9.2004 / 15:33:09 / janfrog"
 ! !
 
 !HistoryManager::HistoryLine class methodsFor:'initialization'!
@@ -1509,7 +1486,7 @@
 !HistoryManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/HistoryManager.st,v 1.56 2004-09-10 13:48:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/HistoryManager.st,v 1.57 2004-09-10 13:50:16 cg Exp $'
 ! !
 
 HistoryManager initialize!