--- a/Class.st Tue Nov 11 19:47:20 2003 +0100
+++ b/Class.st Thu Nov 13 12:29:50 2003 +0100
@@ -135,81 +135,20 @@
This extracts the relevant info from aString, asking
the sourceCode manager (if there is one)"
- "
- For now, this is a bad design - since the sourceCodeManager
- is not always delivered, here, a fallBack is provided.
- (should probably deliver some RCS-header extractor in any case,
- even if no AbstractSourceCodeManager is present)
- (knowing about the details of RCS headers here is a bad design ...)
- "
-
- |words info nm mgr|
+ |info mgr|
"/
"/ mhmh - ask the default manager
"/
- (mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[
- info := mgr revisionInfoFromString:aString.
- info notNil ifTrue:[
- ^ info
- ]
+ (mgr := Smalltalk at:#SourceCodeManager) isNil ifTrue:[
+ "/
+ "/ fallBack - assume CVS header
+ "/
+ mgr := CVSSourceCodeManager
].
- "/
- "/ fallBack - handles some RCS headers only
- "/ is this really needed ?
- "/
- info := IdentityDictionary new.
- words := aString asCollectionOfWords.
-
- words notEmpty ifTrue:[
- "/
- "/ supported formats:
- "/
- "/ $-Header: pathName rev date time user state $
- "/ $-Revision: rev $
- "/ $-Id: fileName rev date time user state $
- "/
-
- ((words at:1) = '$Header:') ifTrue:[
- nm := words at:2.
- info at:#repositoryPathName put:nm.
- (nm endsWith:',v') ifTrue:[
- nm := nm copyWithoutLast:2
- ].
- info at:#fileName put:nm asFilename baseName.
- words size > 2 ifTrue:[
- (words at:3) = '$' ifFalse:[
- info at:#revision put:(words at:3).
- (words at:4) = '$' ifFalse:[
- info at:#date put:(words at:4).
- info at:#time put:(words at:5).
- info at:#user put:(words at:6).
- info at:#state put:(words at:7).
- ]
- ].
- ].
- ^ info
- ].
- ((words at:1) = '$Revision:') ifTrue:[
- info at:#revision put:(words at:2).
- ^ info
- ].
- ((words at:1) = '$Id:') ifTrue:[
- info at:#fileName put:(words at:2).
- info at:#revision put:(words at:3).
- info at:#date put:(words at:4).
- info at:#time put:(words at:5).
- info at:#user put:(words at:6).
- info at:#state put:(words at:7).
- ^ info
- ].
- ].
-
- ^ nil
-
- "Created: 15.11.1995 / 14:58:35 / cg"
- "Modified: 29.1.1997 / 19:36:31 / cg"
+ info := mgr revisionInfoFromString:aString.
+ ^ info
!
revisionStringFromSource:aMethodSourceString
@@ -4721,30 +4660,32 @@
against the version string as contained in the version method"
|cls meta cannotCheckReason versionMethod info
- versionFromCode versionFromSource oldPos pos src rev|
+ versionFromCode versionFromSource oldPos pos src rev
+ versionMethodsName|
meta := self theMetaclass.
cls := self theNonMetaclass.
cannotCheckReason := nil.
-
- versionMethod := meta compiledMethodAt:(self nameOfVersionMethod).
+ versionMethodsName := self nameOfVersionMethod.
+
+ versionMethod := meta compiledMethodAt:versionMethodsName.
(versionMethod isNil
or:[versionMethod isExecutable not]) ifTrue:[
- versionMethod := cls compiledMethodAt:(self nameOfVersionMethod).
- (versionMethod isNil
- or:[versionMethod isExecutable not]) ifTrue:[
- cannotCheckReason := 'no valid version method'.
- ]
+ versionMethod := cls compiledMethodAt:versionMethodsName.
+ (versionMethod isNil
+ or:[versionMethod isExecutable not]) ifTrue:[
+ cannotCheckReason := 'no valid version method'.
+ ]
] ifFalse:[
- "/
- "/ if its a method returning the string,
- "/ thats the returned value
- "/
- versionFromCode := cls perform:(self nameOfVersionMethod).
- versionFromCode isString ifFalse:[
- cannotCheckReason := 'version method does not return a string'
- ].
+ "/
+ "/ if its a method returning the string,
+ "/ thats the returned value
+ "/
+ versionFromCode := cls perform:versionMethodsName.
+ versionFromCode isString ifFalse:[
+ cannotCheckReason := 'version method does not return a string'
+ ].
].
"/
@@ -4755,52 +4696,52 @@
"/ for the source ...
"/
versionMethod notNil ifTrue:[
- pos := versionMethod sourcePosition.
- pos isInteger ifFalse:[
- "/ mhmh - either no version method,
- "/ or updated due to a checkin.
- "/ in any case, this should be a good source.
-
- ^ true.
- "/ cannotCheckReason := 'no source position for version-method'
- ]
+ pos := versionMethod sourcePosition.
+ pos isInteger ifFalse:[
+ "/ mhmh - either no version method,
+ "/ or updated due to a checkin.
+ "/ in any case, this should be a good source.
+
+ ^ true.
+ "/ cannotCheckReason := 'no source position for version-method'
+ ]
].
cannotCheckReason notNil ifTrue:[
- ('Class [warning]: ' , cannotCheckReason , ' in ' , self name) infoPrintCR.
- 'Class [info]: cannot validate source; trusting source' infoPrintCR.
- ^ true
+ ('Class [warning]: ' , cannotCheckReason , ' in ' , self name) infoPrintCR.
+ 'Class [info]: cannot validate source; trusting source' infoPrintCR.
+ ^ true
].
oldPos := aStream position.
Stream positionErrorSignal handle:[:ex |
- 'Class [info]: position error when accessing source' infoPrintCR.
- ^ false
+ 'Class [info]: position error when accessing source' infoPrintCR.
+ ^ false
] do:[
- aStream position1Based:pos.
+ aStream position1Based:pos.
].
src := aStream nextChunk.
aStream position:oldPos.
(src isNil or:[src isEmpty]) ifTrue:[
- 'Class [info]: empty source for version-method' infoPrintCR.
- ^ false
+ 'Class [info]: empty source for version-method' infoPrintCR.
+ ^ false
].
versionFromSource := Class revisionStringFromSource:src.
versionFromSource = versionFromCode ifTrue:[^ true].
versionFromSource isNil ifTrue:[
- 'Class [info]: version-from source is nil' infoPrintCR.
- ^ false
+ 'Class [info]: version-from source is nil' infoPrintCR.
+ ^ false
].
"/ mhmh - check my binary version ...
info := Class revisionInfoFromString:versionFromSource.
info notNil ifTrue:[
- rev := info at:#revision.
- rev = self binaryRevision ifTrue:[^ true].
+ rev := info at:#revision.
+ rev = self binaryRevision ifTrue:[^ true].
].
'Class [info]: source-version is different from binaryRevision' infoPrintCR.
^ false
@@ -4862,5 +4803,5 @@
!Class class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.448 2003-10-26 15:26:52 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.449 2003-11-13 11:29:50 cg Exp $'
! !