filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
authorClaus Gittinger <cg@exept.de>
Wed, 13 Dec 1995 14:32:46 +0100
changeset 149 f7d66ab71259
parent 148 dd40327e00b7
child 150 54b6185e9aa7
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
HistLine.st
HistMgr.st
HistoryManager.st
--- a/HistLine.st	Wed Dec 13 13:42:34 1995 +0100
+++ b/HistLine.st	Wed Dec 13 14:32:46 1995 +0100
@@ -273,6 +273,18 @@
                     ]
                 ]
             ].
+        ] 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
+                    ]
+                ].
+            ].
         ].
         skip ifFalse:[
             newCollection add:histLine.
@@ -327,7 +339,7 @@
     "
 
     "Modified: 8.9.1995 / 17:20:40 / claus"
-    "Modified: 12.12.1995 / 11:00:37 / cg"
+    "Modified: 13.12.1995 / 14:10:03 / cg"
 ! !
 
 !HistoryLine class methodsFor:'private'!
@@ -676,6 +688,6 @@
 !HistoryLine class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/Attic/HistLine.st,v 1.11 1995-12-12 11:14:06 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/Attic/HistLine.st,v 1.12 1995-12-13 13:32:46 cg Exp $'
 ! !
 HistoryLine initialize!
--- a/HistMgr.st	Wed Dec 13 13:42:34 1995 +0100
+++ b/HistMgr.st	Wed Dec 13 14:32:46 1995 +0100
@@ -12,10 +12,10 @@
 "
 
 Object subclass:#HistoryManager
-	 instanceVariableNames:'historyMode'
-	 classVariableNames:'TheOneAndOnlyInstance'
-	 poolDictionaries:''
-	 category:'System-Changes-History'
+	instanceVariableNames:'historyMode'
+	classVariableNames:'TheOneAndOnlyInstance'
+	poolDictionaries:''
+	category:'System-Changes-History'
 !
 
 !HistoryManager class methodsFor:'documentation'!
@@ -260,7 +260,7 @@
 
 !HistoryManager methodsFor:'updateHistory'!
 
-addHistoryTo:someString forceModification:forceModification 
+addHistoryTo:someString forceModification:forceModification forceCreation:forceCreation
     "private - add a historyLine at end to the sourceCode;
      check for multiple lines of the same user and merge into one.
      If forceModification is true or a history already exists in someString,
@@ -271,22 +271,26 @@
 
     "Check whether we want a history to be added"    
     historyMode ifFalse:[
-	^ someString
+        ^ someString
     ].
     previousHistories := self class getAllHistoriesFrom:someString.
 
     "extract source body."
     previousHistories isEmpty ifTrue: [
-	sourceCode := someString withoutSeparators.
-	forceModification ifTrue:[
-	    newLine := (HistoryLine new)
-	] ifFalse:[
-	    newLine := (HistoryLine newCreated).
-	]
+        sourceCode := someString withoutSeparators.
+        forceModification ifTrue:[
+            newLine := (HistoryLine new)
+        ] ifFalse:[
+            newLine := (HistoryLine newCreated).
+        ]
     ] ifFalse: [
-	pos := (previousHistories first) firstPositionInSourceCode.
-	sourceCode := (someString copyFrom: 1 to: pos - 1) withoutSeparators.
-	newLine := (HistoryLine new).
+        pos := (previousHistories first) firstPositionInSourceCode.
+        sourceCode := (someString copyFrom: 1 to: pos - 1) withoutSeparators.
+        forceCreation ifTrue:[
+            newLine := (HistoryLine newCreated).
+        ] ifFalse:[
+            newLine := (HistoryLine new)
+        ]
     ].
 
     "add the actual user's historyLine."
@@ -309,25 +313,27 @@
 
     "Modified: 11.8.1995 / 16:51:50 / robert"
     "Modified: 8.9.1995 / 17:55:38 / claus"
-    "Modified: 11.12.1995 / 14:29:25 / cg"
+    "Modified: 13.12.1995 / 14:07:03 / cg"
 !
 
 addHistoryToHistoryMethodOf:aClass
     |cls historyMethod oldSource newSource|
 
     aClass isMeta ifFalse:[
-	cls := aClass class.
+        cls := aClass class.
     ] ifTrue:[
-	cls := aClass
+        cls := aClass
     ].
     historyMethod := cls compiledMethodAt: #history.
     historyMethod notNil ifTrue:[
-	oldSource := historyMethod source.
-	oldSource notNil ifTrue:[
-	    newSource := self addHistoryTo:oldSource forceModification:false.
-	    historyMethod source:newSource.
-	]
+        oldSource := historyMethod source.
+        oldSource notNil ifTrue:[
+            newSource := self addHistoryTo:oldSource forceModification:false forceCreation:false.
+            historyMethod source:newSource.
+        ]
     ]
+
+    "Modified: 13.12.1995 / 14:05:30 / cg"
 !
 
 update:something with:someArgument from:changedObject
@@ -349,105 +355,105 @@
 
     fileInOrRecompiling ifFalse:[ 
 "/        Transcript showCr: '* noChange in history'. 
-	^ self 
+        ^ self 
     ].
     historyMode ifFalse:[
-	^ self
+        ^ self
     ].
 
     "
     Class Variables
     "
     (something == #definition) ifTrue:[
-	"add handling for classes here ..."        
-	"/ self addHistoryToHistoryMethodOf:changedObject.
+        "add handling for classes here ..."        
+        "/ self addHistoryToHistoryMethodOf:changedObject.
     ].
 
     "this is a sub item of #definition"    
     (something == #classVariables) ifTrue:[
-	"
-	Transcript showCr: 'classVariables changed'.
-	"
-	"/ does not yet work;
-	"/ (someArgument does not contain the class we are interrested in)
+        "
+        Transcript showCr: 'classVariables changed'.
+        "
+        "/ does not yet work;
+        "/ (someArgument does not contain the class we are interrested in)
 
-	self addHistoryToHistoryMethodOf:changedObject.
-	^ self
+        self addHistoryToHistoryMethodOf:changedObject.
+        ^ self
     ].    
 
     "
      new Class creation
     "
     ((changedObject == Smalltalk) and:[something == #newClass]) ifTrue:[
-	"/ 
-	"/  add myself as dependents in order to get future change notifications
-	"/ 
-	someArgument addDependent: self.
-	someArgument class addDependent: self.   "for class methods"
-	someArgument history:(self addHistoryTo:String new forceModification:false).  "append historyString for new class"
+        "/ 
+        "/  add myself as dependents in order to get future change notifications
+        "/ 
+        someArgument addDependent: self.
+        someArgument class addDependent: self.   "for class methods"
+        someArgument history:(self addHistoryTo:String new forceModification:false forceCreation:false).  "append historyString for new class"
     ].
 
     "
      changed methods
     "
     changedObject isBehavior ifTrue:[
-	something = #methodDictionary ifTrue:[
-	    someArgument isArray ifTrue:[
-		selector := someArgument at:1.
-		oldMethod := someArgument at:2
-	    ] ifFalse:[
-		selector := someArgument
-	    ].
+        something = #methodDictionary ifTrue:[
+            someArgument isArray ifTrue:[
+                selector := someArgument at:1.
+                oldMethod := someArgument at:2
+            ] ifFalse:[
+                selector := someArgument
+            ].
 
-	    "/
-	    "/ fetch sourceString of the method
-	    "/
-	    sourceCode := changedObject sourceCodeAt:selector.
-	    sourceCode isNil ifTrue:[
-		"method has been deleted"
+            "/
+            "/ fetch sourceString of the method
+            "/
+            sourceCode := changedObject sourceCodeAt:selector.
+            sourceCode isNil ifTrue:[
+                "method has been deleted"
 "/                Transcript showCr: 'method has been deleted'.
-	    ] ifFalse:[
-		newMethod := changedObject compiledMethodAt:selector.
+            ] ifFalse:[
+                newMethod := changedObject compiledMethodAt:selector.
 
-		oldMethod notNil ifTrue:[
-		    (oldMethod source asString withTabsExpanded = sourceCode asString withTabsExpanded) ifTrue:[
-			 "/ no change (accepted same code again ?)
-			^ self
-		    ].
-		].
+                oldMethod notNil ifTrue:[
+                    (oldMethod source asString withTabsExpanded = sourceCode asString withTabsExpanded) ifTrue:[
+                         "/ no change (accepted same code again ?)
+                        ^ self
+                    ].
+                ].
 
-		"/
-		"/ dont add historylines to documentation methods ...
-		"/
-		(changedObject isMeta not
-		or:[newMethod category ~= 'documentation']) ifTrue:[
-		    sourceCode := self addHistoryTo:sourceCode forceModification:(oldMethod notNil).
-		    newMethod source: sourceCode.
+                "/
+                "/ dont add historylines to documentation methods ...
+                "/
+                (changedObject isMeta not
+                or:[newMethod category ~= 'documentation']) ifTrue:[
+                    sourceCode := self addHistoryTo:sourceCode forceModification:(oldMethod notNil) forceCreation:(oldMethod isNil).
+                    newMethod source: sourceCode.
 "/                Transcript showCr: 'history updated / added'.
-		]
-	    ].
-	    ^self
-	]. 
+                ]
+            ].
+            ^self
+        ]. 
 
-	something == #comment ifTrue:[
-	    "in someArgument steht jetzt der alte kommentar"
-	    ^ self.
-	] ifFalse:[
-	    "it is a class definition"
+        something == #comment ifTrue:[
+            "in someArgument steht jetzt der alte kommentar"
+            ^ self.
+        ] ifFalse:[
+            "it is a class definition"
 "/            Transcript show: 'Class definition: ', changedObject printString;cr.
-	    self addHistoryToHistoryMethodOf:changedObject.
-	].
+            self addHistoryToHistoryMethodOf:changedObject.
+        ].
     ].
 
     ^self
 
     "Modified: 27.8.1995 / 02:14:43 / claus"
-    "Modified: 11.12.1995 / 14:32:28 / cg"
+    "Modified: 13.12.1995 / 14:06:20 / cg"
 ! !
 
 !HistoryManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/Attic/HistMgr.st,v 1.16 1995-12-12 09:49:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/Attic/HistMgr.st,v 1.17 1995-12-13 13:32:35 cg Exp $'
 ! !
 HistoryManager initialize!
--- a/HistoryManager.st	Wed Dec 13 13:42:34 1995 +0100
+++ b/HistoryManager.st	Wed Dec 13 14:32:46 1995 +0100
@@ -12,10 +12,10 @@
 "
 
 Object subclass:#HistoryManager
-	 instanceVariableNames:'historyMode'
-	 classVariableNames:'TheOneAndOnlyInstance'
-	 poolDictionaries:''
-	 category:'System-Changes-History'
+	instanceVariableNames:'historyMode'
+	classVariableNames:'TheOneAndOnlyInstance'
+	poolDictionaries:''
+	category:'System-Changes-History'
 !
 
 !HistoryManager class methodsFor:'documentation'!
@@ -260,7 +260,7 @@
 
 !HistoryManager methodsFor:'updateHistory'!
 
-addHistoryTo:someString forceModification:forceModification 
+addHistoryTo:someString forceModification:forceModification forceCreation:forceCreation
     "private - add a historyLine at end to the sourceCode;
      check for multiple lines of the same user and merge into one.
      If forceModification is true or a history already exists in someString,
@@ -271,22 +271,26 @@
 
     "Check whether we want a history to be added"    
     historyMode ifFalse:[
-	^ someString
+        ^ someString
     ].
     previousHistories := self class getAllHistoriesFrom:someString.
 
     "extract source body."
     previousHistories isEmpty ifTrue: [
-	sourceCode := someString withoutSeparators.
-	forceModification ifTrue:[
-	    newLine := (HistoryLine new)
-	] ifFalse:[
-	    newLine := (HistoryLine newCreated).
-	]
+        sourceCode := someString withoutSeparators.
+        forceModification ifTrue:[
+            newLine := (HistoryLine new)
+        ] ifFalse:[
+            newLine := (HistoryLine newCreated).
+        ]
     ] ifFalse: [
-	pos := (previousHistories first) firstPositionInSourceCode.
-	sourceCode := (someString copyFrom: 1 to: pos - 1) withoutSeparators.
-	newLine := (HistoryLine new).
+        pos := (previousHistories first) firstPositionInSourceCode.
+        sourceCode := (someString copyFrom: 1 to: pos - 1) withoutSeparators.
+        forceCreation ifTrue:[
+            newLine := (HistoryLine newCreated).
+        ] ifFalse:[
+            newLine := (HistoryLine new)
+        ]
     ].
 
     "add the actual user's historyLine."
@@ -309,25 +313,27 @@
 
     "Modified: 11.8.1995 / 16:51:50 / robert"
     "Modified: 8.9.1995 / 17:55:38 / claus"
-    "Modified: 11.12.1995 / 14:29:25 / cg"
+    "Modified: 13.12.1995 / 14:07:03 / cg"
 !
 
 addHistoryToHistoryMethodOf:aClass
     |cls historyMethod oldSource newSource|
 
     aClass isMeta ifFalse:[
-	cls := aClass class.
+        cls := aClass class.
     ] ifTrue:[
-	cls := aClass
+        cls := aClass
     ].
     historyMethod := cls compiledMethodAt: #history.
     historyMethod notNil ifTrue:[
-	oldSource := historyMethod source.
-	oldSource notNil ifTrue:[
-	    newSource := self addHistoryTo:oldSource forceModification:false.
-	    historyMethod source:newSource.
-	]
+        oldSource := historyMethod source.
+        oldSource notNil ifTrue:[
+            newSource := self addHistoryTo:oldSource forceModification:false forceCreation:false.
+            historyMethod source:newSource.
+        ]
     ]
+
+    "Modified: 13.12.1995 / 14:05:30 / cg"
 !
 
 update:something with:someArgument from:changedObject
@@ -349,105 +355,105 @@
 
     fileInOrRecompiling ifFalse:[ 
 "/        Transcript showCr: '* noChange in history'. 
-	^ self 
+        ^ self 
     ].
     historyMode ifFalse:[
-	^ self
+        ^ self
     ].
 
     "
     Class Variables
     "
     (something == #definition) ifTrue:[
-	"add handling for classes here ..."        
-	"/ self addHistoryToHistoryMethodOf:changedObject.
+        "add handling for classes here ..."        
+        "/ self addHistoryToHistoryMethodOf:changedObject.
     ].
 
     "this is a sub item of #definition"    
     (something == #classVariables) ifTrue:[
-	"
-	Transcript showCr: 'classVariables changed'.
-	"
-	"/ does not yet work;
-	"/ (someArgument does not contain the class we are interrested in)
+        "
+        Transcript showCr: 'classVariables changed'.
+        "
+        "/ does not yet work;
+        "/ (someArgument does not contain the class we are interrested in)
 
-	self addHistoryToHistoryMethodOf:changedObject.
-	^ self
+        self addHistoryToHistoryMethodOf:changedObject.
+        ^ self
     ].    
 
     "
      new Class creation
     "
     ((changedObject == Smalltalk) and:[something == #newClass]) ifTrue:[
-	"/ 
-	"/  add myself as dependents in order to get future change notifications
-	"/ 
-	someArgument addDependent: self.
-	someArgument class addDependent: self.   "for class methods"
-	someArgument history:(self addHistoryTo:String new forceModification:false).  "append historyString for new class"
+        "/ 
+        "/  add myself as dependents in order to get future change notifications
+        "/ 
+        someArgument addDependent: self.
+        someArgument class addDependent: self.   "for class methods"
+        someArgument history:(self addHistoryTo:String new forceModification:false forceCreation:false).  "append historyString for new class"
     ].
 
     "
      changed methods
     "
     changedObject isBehavior ifTrue:[
-	something = #methodDictionary ifTrue:[
-	    someArgument isArray ifTrue:[
-		selector := someArgument at:1.
-		oldMethod := someArgument at:2
-	    ] ifFalse:[
-		selector := someArgument
-	    ].
+        something = #methodDictionary ifTrue:[
+            someArgument isArray ifTrue:[
+                selector := someArgument at:1.
+                oldMethod := someArgument at:2
+            ] ifFalse:[
+                selector := someArgument
+            ].
 
-	    "/
-	    "/ fetch sourceString of the method
-	    "/
-	    sourceCode := changedObject sourceCodeAt:selector.
-	    sourceCode isNil ifTrue:[
-		"method has been deleted"
+            "/
+            "/ fetch sourceString of the method
+            "/
+            sourceCode := changedObject sourceCodeAt:selector.
+            sourceCode isNil ifTrue:[
+                "method has been deleted"
 "/                Transcript showCr: 'method has been deleted'.
-	    ] ifFalse:[
-		newMethod := changedObject compiledMethodAt:selector.
+            ] ifFalse:[
+                newMethod := changedObject compiledMethodAt:selector.
 
-		oldMethod notNil ifTrue:[
-		    (oldMethod source asString withTabsExpanded = sourceCode asString withTabsExpanded) ifTrue:[
-			 "/ no change (accepted same code again ?)
-			^ self
-		    ].
-		].
+                oldMethod notNil ifTrue:[
+                    (oldMethod source asString withTabsExpanded = sourceCode asString withTabsExpanded) ifTrue:[
+                         "/ no change (accepted same code again ?)
+                        ^ self
+                    ].
+                ].
 
-		"/
-		"/ dont add historylines to documentation methods ...
-		"/
-		(changedObject isMeta not
-		or:[newMethod category ~= 'documentation']) ifTrue:[
-		    sourceCode := self addHistoryTo:sourceCode forceModification:(oldMethod notNil).
-		    newMethod source: sourceCode.
+                "/
+                "/ dont add historylines to documentation methods ...
+                "/
+                (changedObject isMeta not
+                or:[newMethod category ~= 'documentation']) ifTrue:[
+                    sourceCode := self addHistoryTo:sourceCode forceModification:(oldMethod notNil) forceCreation:(oldMethod isNil).
+                    newMethod source: sourceCode.
 "/                Transcript showCr: 'history updated / added'.
-		]
-	    ].
-	    ^self
-	]. 
+                ]
+            ].
+            ^self
+        ]. 
 
-	something == #comment ifTrue:[
-	    "in someArgument steht jetzt der alte kommentar"
-	    ^ self.
-	] ifFalse:[
-	    "it is a class definition"
+        something == #comment ifTrue:[
+            "in someArgument steht jetzt der alte kommentar"
+            ^ self.
+        ] ifFalse:[
+            "it is a class definition"
 "/            Transcript show: 'Class definition: ', changedObject printString;cr.
-	    self addHistoryToHistoryMethodOf:changedObject.
-	].
+            self addHistoryToHistoryMethodOf:changedObject.
+        ].
     ].
 
     ^self
 
     "Modified: 27.8.1995 / 02:14:43 / claus"
-    "Modified: 11.12.1995 / 14:32:28 / cg"
+    "Modified: 13.12.1995 / 14:06:20 / cg"
 ! !
 
 !HistoryManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/HistoryManager.st,v 1.16 1995-12-12 09:49:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/HistoryManager.st,v 1.17 1995-12-13 13:32:35 cg Exp $'
 ! !
 HistoryManager initialize!