ChangeSet.st
changeset 3621 3979244930e1
parent 3619 e2a5752d7e1d
child 3646 cecd3c25e5af
--- a/ChangeSet.st	Fri Aug 01 08:47:42 2014 +0200
+++ b/ChangeSet.st	Thu Aug 21 20:05:33 2014 +0200
@@ -28,6 +28,13 @@
 	privateIn:ChangeSet
 !
 
+ChangeSet::ChangeFileReader subclass:#BeeChangeFileReader
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:ChangeSet
+!
+
 Object subclass:#ChangeFileWriter
 	instanceVariableNames:''
 	classVariableNames:''
@@ -425,6 +432,36 @@
     "Modified: / 31-07-2014 / 09:51:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+fromBeeStream:aStream
+    "build a changeSet from a Bee Smalltalk .bsc format stream, containing chunks.
+     Return the changeSet."
+
+    ^ self fromBeeStream:aStream while:[:thisChange | true]
+
+    "Created: / 21-08-2014 / 18:34:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+fromBeeStream:aStream while:aConditionBlock
+    "build a changeSet from a Bee Smalltalk .bsc stream, containing chunks
+     Return the changeSet."
+
+    |changeSet|
+
+    changeSet := self new.
+    self 
+        changesFromStream:aStream 
+        for:changeSet 
+        reader:(BeeChangeFileReader new) 
+        do:[:aChange :lineNumberOrNil :posOrNil |
+            changeSet add:aChange.
+            (aConditionBlock value:aChange) ifFalse:[^ changeSet].
+        ].
+
+    ^ changeSet
+
+    "Created: / 21-08-2014 / 18:34:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 fromDiffSet:aDiffSet
     "build a changeSet from a given diffSet. This can be used as a patchSet,
      to update the first-version in the diffSet to the second-version"
@@ -550,6 +587,14 @@
 
     filename := filenameOrString asFilename.
 
+    filename suffix = 'bsc' ifTrue:[ 
+        filename readingFileDo:[:stream |  
+            changeSet := self fromBeeStream:stream.       
+        ].
+        changeSet name: filename baseName.
+        ^ changeSet      
+    ].
+
     mime := MIMETypes mimeTypeForFilename:filename.
     mime isNil ifTrue:[
         mime := filename mimeTypeOfContents.
@@ -590,6 +635,7 @@
 
     "Created: / 16-02-1998 / 12:19:34 / cg"
     "Modified (comment): / 28-07-2012 / 09:41:40 / cg"
+    "Modified: / 21-08-2014 / 18:38:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 fromFileOrDirectory: fileOrDirectory
@@ -3319,6 +3365,113 @@
     "Created: / 02-04-2012 / 19:08:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!ChangeSet::BeeChangeFileReader methodsFor:'helpers'!
+
+receiversClassNameRememberingNamespace
+    ^ (parseTree arguments at: 3) value.
+
+    "Created: / 21-08-2014 / 18:53:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ChangeSet::BeeChangeFileReader methodsFor:'reading-private'!
+
+processChangeUnsafe
+    "given a parse-tree (from parsing some changes source/chunk),
+     create changes and evaluate changeAction on each.
+     The block is invoked with the change and a lineNumberOrNil as
+     arg; the lineNumber is only valid, if the underlying stream 
+     provides line-numbers; otherwise, nil is passed."
+
+    |dispatchSelector|
+
+    dispatchSelector := ('process_',(selector copyReplaceAll:$: with:$_)) asSymbol.
+"/ Transcript showCR:dispatchSelector.
+    (self respondsTo:dispatchSelector) ifTrue:[
+        ^ self perform:dispatchSelector.
+    ].
+
+    "/ any subclass definiton selector ?
+    (Behavior definitionSelectors includes:selector)
+    ifTrue:[
+        ^ self handleClassDefinitionChange.
+    ].
+
+    self error:'unhandled change selector: ',selector.
+    ^ false
+
+    "Created: / 21-08-2014 / 18:37:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+process_timeStamp_author_className_selector_
+    ^ self handleMethodChange
+
+    "/    className := parseTree arguments at: 3.
+
+    "Created: / 21-08-2014 / 18:40:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+process_timeStamp_author_className_selector_applicationVersion_
+
+
+    ^ self handleMethodChange
+
+    "/    className := parseTree arguments at: 3.
+
+    "Created: / 21-08-2014 / 19:01:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+process_timeStamp_author_className_selector_applicationVersion_changesFileName_
+
+
+    ^ self handleMethodChange
+
+    "/    className := parseTree arguments at: 3.
+
+    "Created: / 21-08-2014 / 19:00:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+process_timeStamp_author_className_selector_changesFileName_
+
+    ^ self handleMethodChange
+
+    "/    className := parseTree arguments at: 3.
+
+    "Created: / 21-08-2014 / 18:59:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+process_timeStamp_author_className_selector_prev_
+    ^ self handleMethodChange
+
+    "/    className := parseTree arguments at: 3.
+
+    "Created: / 21-08-2014 / 18:51:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+process_timeStamp_author_className_selector_prev_applicationVersion_
+    ^ self handleMethodChange
+
+    "/    className := parseTree arguments at: 3.
+
+    "Created: / 21-08-2014 / 18:59:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+process_timeStamp_author_className_selector_prev_applicationVersion_changesFileName_
+
+    ^ self handleMethodChange
+
+    "/    className := parseTree arguments at: 3.
+
+    "Created: / 21-08-2014 / 19:00:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+process_timeStamp_author_className_selector_prev_changesFileName_
+    ^ self handleMethodChange
+
+    "/    className := parseTree arguments at: 3.
+
+    "Created: / 21-08-2014 / 18:48:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !ChangeSet::ChangeFileWriter methodsFor:'source writing'!
 
 fileOut: aChangeSet on: aStream
@@ -3983,7 +4136,7 @@
 !
 
 version_SVN
-    ^ '$Id: ChangeSet.st,v 1.247 2014-07-31 08:53:23 vrany Exp $'
+    ^ '$Id: ChangeSet.st,v 1.248 2014-08-21 18:05:33 vrany Exp $'
 ! !
 
 !ChangeSet::ClassSourceWriter::ClassInfo class methodsFor:'instance creation'!
@@ -4662,11 +4815,11 @@
 !ChangeSet class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.247 2014-07-31 08:53:23 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.248 2014-08-21 18:05:33 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.247 2014-07-31 08:53:23 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.248 2014-08-21 18:05:33 vrany Exp $'
 !
 
 version_HG
@@ -4675,6 +4828,6 @@
 !
 
 version_SVN
-    ^ '$Id: ChangeSet.st,v 1.247 2014-07-31 08:53:23 vrany Exp $'
+    ^ '$Id: ChangeSet.st,v 1.248 2014-08-21 18:05:33 vrany Exp $'
 ! !