ChangeSet.st
branchjv
changeset 3846 981cea119bc8
parent 3842 6991b496fe8a
parent 3844 d404026a7a55
child 3857 878ff5dde744
equal deleted inserted replaced
3843:9716dc3d2143 3846:981cea119bc8
   838 
   838 
   839     currentNameSpace := Smalltalk.
   839     currentNameSpace := Smalltalk.
   840     currentPackage := Class packageQuerySignal query.
   840     currentPackage := Class packageQuerySignal query.
   841 
   841 
   842     (reader := aReader) isNil ifTrue:[
   842     (reader := aReader) isNil ifTrue:[
   843 	reader := ChangeFileReader new.
   843         reader := ChangeFileReader new.
   844     ].
   844     ].
   845 
   845 
   846     aStream isEncodedStream ifTrue:[
   846     aStream isEncodedStream ifTrue:[
   847 	encodedStream := aStream
   847         encodedStream := aStream
   848     ] ifFalse:[
   848     ] ifFalse:[
   849 	aStream isPositionable ifTrue:[
   849         aStream isPositionable ifTrue:[
   850 	    encodedStream := EncodedStream decodedStreamFor: aStream
   850             encodedStream := EncodedStream decodedStreamFor: aStream
   851 	] ifFalse:[
   851         ] ifFalse:[
   852 	    encodedStream := EncodedStream stream: aStream encoder: CharacterEncoder nullEncoderInstance
   852             encodedStream := EncodedStream stream: aStream encoder: CharacterEncoder nullEncoderInstance
   853 	].
   853         ].
   854     ].
   854     ].
   855     reportProgress := encodedStream stream isPositionable
   855     reportProgress := encodedStream stream isPositionable
   856 			and:[ ProgressNotification notNil
   856                         and:[ ProgressNotification notNil
   857 			and:[ ProgressNotification isHandled ]].
   857                         and:[ ProgressNotification isHandled ]].
   858     reportProgress ifTrue:[
   858     reportProgress ifTrue:[
   859 	size := encodedStream stream size.
   859         size := encodedStream stream size.
   860     ].
   860     ].
   861 
   861 
   862     reader changeSet:aChangeSet.
   862     reader changeSet:aChangeSet.
   863     reader changeAction:aBlock.
   863     reader changeAction:aBlock.
   864     reader inputStream:encodedStream.
   864     reader inputStream:encodedStream.
   865 
   865 
   866     [encodedStream atEnd] whileFalse:[
   866     [encodedStream atEnd] whileFalse:[
   867 	encodedStream skipSeparators.
   867         encodedStream skipSeparators.
   868 	lineNumber := encodedStream lineNumber.
   868         lineNumber := encodedStream lineNumber.
   869 
   869 
   870 
   870 
   871 	reportProgress ifTrue:[
   871         reportProgress ifTrue:[
   872 	    pos := encodedStream position + 1.
   872             pos := encodedStream position + 1.
   873 	    ProgressNotification notify: nil progress:(100 / size) * pos.
   873             ProgressNotification notify: nil progress:(100 / size) * pos.
   874 	].
   874         ].
   875 
   875 
   876 	chunk := encodedStream nextChunk.
   876         chunk := encodedStream nextChunk.
   877 
   877 
   878 	(chunk notEmptyOrNil) ifTrue:[
   878         (chunk notEmptyOrNil) ifTrue:[
   879 	    Class nameSpaceQuerySignal handle:[:ex| ex proceedWith:currentNameSpace] do:[
   879             Class nameSpaceQuerySignal handle:[:ex| ex proceedWith:currentNameSpace] do:[
   880 		Class packageQuerySignal handle:[:ex| ex proceedWith:currentPackage] do:[
   880                 Class packageQuerySignal handle:[:ex| ex proceedWith:currentPackage] do:[
   881 		    |parser tree ns pkg|
   881                     |parser tree ns pkg|
   882 
   882 
   883 		    parser := Parser for:chunk.
   883                     parser := Parser for:chunk.
   884 		    "/ parser parseForCode.
   884                     "/ parser parseForCode.
   885 		    Parser parseErrorSignal handle:[:ex |
   885                     Parser parseErrorSignal handle:[:ex |
   886 			Transcript showCR:'ChangeSet: error while reading: ',ex description.
   886                         Transcript showCR:'ChangeSet: error while reading: ',ex description.
   887 			tree := #Error.
   887                         tree := #Error.
   888 		    ] do:[
   888                     ] do:[
   889 			tree := parser
   889                         tree := parser
   890 				parseExpressionWithSelf:nil
   890                                 parseExpressionWithSelf:nil
   891 				notifying:nil
   891                                 notifying:nil
   892 				ignoreErrors:true
   892                                 ignoreErrors:true
   893 				ignoreWarnings:true
   893                                 ignoreWarnings:true
   894 				inNameSpace:currentNameSpace.
   894                                 inNameSpace:currentNameSpace.
   895 		    ].
   895                     ].
   896 		    tree ~~ #Error ifTrue:[
   896                     tree ~~ #Error ifTrue:[
   897 			tree isNil ifTrue:[
   897                         tree isNil ifTrue:[
   898 			    "/ Hmm....it could be package-definition chunk in extensions container...
   898                             "/ Hmm....it could be package-definition chunk in extensions container...
   899 			    "/ if there is any package directive in there, extract it.
   899                             "/ if there is any package directive in there, extract it.
   900 			    ((pkg := parser currentPackage) notNil
   900                             ((pkg := parser currentPackage) notNil
   901 			    and:[pkg ~~ currentPackage]) ifTrue:[
   901                             and:[pkg ~~ currentPackage]) ifTrue:[
   902 				currentPackage := pkg
   902                                 currentPackage := pkg
   903 			    ] ifFalse:[
   903                             ] ifFalse:[
   904 				"/ if there is any nameSpace directive in there, extract it.
   904                                 "/ if there is any nameSpace directive in there, extract it.
   905 				((ns := parser currentNameSpace) notNil
   905                                 ((ns := parser currentNameSpace) notNil
   906 				and:[ns ~~ currentNameSpace]) ifTrue:[
   906                                 and:[ns ~~ currentNameSpace]) ifTrue:[
   907 				    currentNameSpace := ns
   907                                     currentNameSpace := ns
   908 				] ifFalse:[
   908                                 ] ifFalse:[
   909 				    change := DoItChange new.
   909                                     change := DoItChange new.
   910 				    change source:chunk.
   910                                     change source:chunk.
   911 				    aBlock valueWithOptionalArgument:change and:lineNumber and:pos.
   911                                     aBlock valueWithOptionalArgument:change and:lineNumber and:pos.
   912 				].
   912                                 ].
   913 			    ].
   913                             ].
   914 			] ifFalse:[
   914                         ] ifFalse:[
   915 			    "/ if there is any nameSpace directive in there, extract it.
   915                             "/ if there is any nameSpace directive in there, extract it.
   916 			    ((ns := parser currentNameSpace) notNil
   916                             ((ns := parser currentNameSpace) notNil
   917 			    and:[ns ~~ currentNameSpace]) ifTrue:[
   917                             and:[ns ~~ currentNameSpace]) ifTrue:[
   918 				currentNameSpace := ns
   918                                 currentNameSpace := ns
   919 			    ].
   919                             ].
   920 			    "/ if there is any package directive in there, extract it.
   920                             "/ if there is any package directive in there, extract it.
   921 			    ((pkg := parser currentPackage) notNil
   921                             ((pkg := parser currentPackage) notNil
   922 			    and:[pkg ~~ currentPackage]) ifTrue:[
   922                             and:[pkg ~~ currentPackage]) ifTrue:[
   923 				currentPackage := pkg
   923                                 currentPackage := pkg
   924 			    ].
   924                             ].
   925 			    "/
   925                             "/
   926 			    "/ what type of chunk is this ...
   926                             "/ what type of chunk is this ...
   927 			    "/
   927                             "/
   928 			    tree isConstant ifTrue:[
   928                             tree isConstant ifTrue:[
   929 				(s := tree evaluate) isString ifTrue:[
   929                                 (s := tree evaluate) isString ifTrue:[
   930 				    (s startsWith:'---- ') ifTrue:[
   930                                     (s startsWith:'---- ') ifTrue:[
   931 					reader inputStream: s readStream.
   931                                         reader inputStream: s readStream.
   932 					reader processInfo: s.
   932                                         reader processInfo: s.
   933 					reader inputStream: encodedStream.
   933                                         reader inputStream: encodedStream.
   934 				    ].
   934                                     ].
   935 				] ifFalse:[
   935                                 ] ifFalse:[
   936 				    self error:'unexpected change-chunk' mayProceed:true
   936                                     self error:'unexpected change-chunk' mayProceed:true
   937 				]
   937                                 ]
   938 			    ] ifFalse:[
   938                             ] ifFalse:[
   939 				tree isMessage ifTrue:[
   939                                 tree isMessage ifTrue:[
   940 				    (reader
   940                                     (reader
   941 					changesFromParseTree:tree
   941                                         changesFromParseTree:tree
   942 					lineNumber:lineNumber
   942                                         lineNumber:lineNumber
   943 					position:pos
   943                                         position:pos
   944 					chunk: chunk
   944                                         chunk: chunk
   945 				    ) ifFalse:[
   945                                     ) ifFalse:[
   946 					change := DoItChange new.
   946                                         change := DoItChange new.
   947 					change source:chunk.
   947                                         change source:chunk.
   948 					aBlock valueWithOptionalArgument:change and:lineNumber and:pos.
   948                                         aBlock valueWithOptionalArgument:change and:lineNumber and:pos.
   949 				    ]
   949                                     ]
   950 				] ifFalse:[
   950                                 ] ifFalse:[
   951 				    InvalidChangeChunkError
   951                                     InvalidChangeChunkError
   952 					raiseRequestErrorString:('unexpected change-chunk i nor around line %1' bindWith:lineNumber)
   952                                         raiseRequestErrorString:('unexpected change-chunk in or around line %1' bindWith:lineNumber)
   953 				]
   953                                 ]
   954 			    ]
   954                             ]
   955 			]
   955                         ]
   956 		    ]
   956                     ]
   957 		]
   957                 ]
   958 	    ]
   958             ]
   959 	]
   959         ]
   960     ].
   960     ].
   961 
   961 
   962     "
   962     "
   963      ChangeSet fromStream:('changes' asFilename readStream)
   963      ChangeSet fromStream:('changes' asFilename readStream)
   964      ChangeSet fromStream:('patches' asFilename readStream)
   964      ChangeSet fromStream:('patches' asFilename readStream)
  4334  hereby transferred.
  4334  hereby transferred.
  4335 "
  4335 "
  4336 !
  4336 !
  4337 
  4337 
  4338 version_SVN
  4338 version_SVN
  4339     ^ '$Id: ChangeSet.st,v 1.260 2015-04-07 10:37:39 cg Exp $'
  4339     ^ '$Id: ChangeSet.st,v 1.261 2015-04-14 11:04:58 cg Exp $'
  4340 ! !
  4340 ! !
  4341 
  4341 
  4342 !ChangeSet::ClassSourceWriter::ClassInfo class methodsFor:'instance creation'!
  4342 !ChangeSet::ClassSourceWriter::ClassInfo class methodsFor:'instance creation'!
  4343 
  4343 
  4344 new
  4344 new
  5014 ! !
  5014 ! !
  5015 
  5015 
  5016 !ChangeSet class methodsFor:'documentation'!
  5016 !ChangeSet class methodsFor:'documentation'!
  5017 
  5017 
  5018 version
  5018 version
  5019     ^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.260 2015-04-07 10:37:39 cg Exp $'
  5019     ^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.261 2015-04-14 11:04:58 cg Exp $'
  5020 !
  5020 !
  5021 
  5021 
  5022 version_CVS
  5022 version_CVS
  5023     ^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.260 2015-04-07 10:37:39 cg Exp $'
  5023     ^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.261 2015-04-14 11:04:58 cg Exp $'
  5024 !
  5024 !
  5025 
  5025 
  5026 version_HG
  5026 version_HG
  5027 
  5027 
  5028     ^ '$Changeset: <not expanded> $'
  5028     ^ '$Changeset: <not expanded> $'
  5029 !
  5029 !
  5030 
  5030 
  5031 version_SVN
  5031 version_SVN
  5032     ^ '$Id: ChangeSet.st,v 1.260 2015-04-07 10:37:39 cg Exp $'
  5032     ^ '$Id: ChangeSet.st,v 1.261 2015-04-14 11:04:58 cg Exp $'
  5033 ! !
  5033 ! !
  5034 
  5034