4139 "{ Pragma: +optSpace }" |
4138 "{ Pragma: +optSpace }" |
4140 |
4139 |
4141 "return my revision method. Either this is the sourceCodeManager-specific versionMethod, |
4140 "return my revision method. Either this is the sourceCodeManager-specific versionMethod, |
4142 or the fallBack (for backward compatibility)" |
4141 or the fallBack (for backward compatibility)" |
4143 |
4142 |
|
4143 |owner| |
|
4144 |
|
4145 (owner := self owningClass) notNil ifTrue:[^ owner findVersionMethod]. |
|
4146 ^ self findVersionMethodOfManager:self sourceCodeManager |
|
4147 |
|
4148 " |
|
4149 Smalltalk allClassesDo:[:cls | |
|
4150 Transcript show:cls name; show:' -> '; showCR:cls findVersionMethod |
|
4151 ]. |
|
4152 |
|
4153 Number findVersionMethod |
|
4154 FileDirectory findVersionMethod |
|
4155 Metaclass findVersionMethod |
|
4156 Class findVersionMethod |
|
4157 " |
|
4158 |
|
4159 "Modified: / 19-04-2011 / 13:30:42 / cg" |
|
4160 ! |
|
4161 |
|
4162 findVersionMethodOfManager:aSourceCodemanagerOrNil |
|
4163 "{ Pragma: +optSpace }" |
|
4164 |
|
4165 "return my revision method. Either this is the sourceCodeManager-specific versionMethod, |
|
4166 or the fallBack (for backward compatibility)" |
|
4167 |
4144 |owner cls meta versionMethodsToTry| |
4168 |owner cls meta versionMethodsToTry| |
4145 |
4169 |
4146 (owner := self owningClass) notNil ifTrue:[^ owner findVersionMethod]. |
4170 (owner := self owningClass) notNil ifTrue:[^ owner findVersionMethodOfManager:aSourceCodemanagerOrNil]. |
4147 |
4171 |
4148 meta := self theMetaclass. |
4172 meta := self theMetaclass. |
4149 cls := self theNonMetaclass. |
4173 cls := self theNonMetaclass. |
4150 |
4174 |
4151 "/ allow for sc-manager-specific version methods, |
4175 "/ allow for sc-manager-specific version methods, |
4152 "/ before falling back to the default version method. |
4176 "/ before falling back to the default version method. |
4153 versionMethodsToTry := |
4177 versionMethodsToTry := OrderedCollection new. |
4154 OrderedCollection streamContents:[:s | |
4178 aSourceCodemanagerOrNil notNil ifTrue:[ |
4155 |sourceCodeManager| |
4179 versionMethodsToTry add:aSourceCodemanagerOrNil nameOfVersionMethodInClasses. |
4156 |
4180 ]. |
4157 sourceCodeManager := self sourceCodeManager. |
4181 versionMethodsToTry add:self nameOfVersionMethod. "/ fallback |
4158 sourceCodeManager notNil ifTrue:[ |
|
4159 s nextPut:(sourceCodeManager nameOfVersionMethodInClasses) |
|
4160 ]. |
|
4161 s nextPut:self nameOfVersionMethod |
|
4162 ]. |
|
4163 |
4182 |
4164 versionMethodsToTry do:[:versionMethodsName | |
4183 versionMethodsToTry do:[:versionMethodsName | |
4165 |aVersionMethod val| |
4184 |aVersionMethod val| |
4166 |
4185 |
4167 aVersionMethod := meta compiledMethodAt:versionMethodsName. |
4186 aVersionMethod := meta compiledMethodAt:versionMethodsName. |
4184 Number findVersionMethod |
4203 Number findVersionMethod |
4185 FileDirectory findVersionMethod |
4204 FileDirectory findVersionMethod |
4186 Metaclass findVersionMethod |
4205 Metaclass findVersionMethod |
4187 Class findVersionMethod |
4206 Class findVersionMethod |
4188 " |
4207 " |
|
4208 |
|
4209 "Created: / 19-04-2011 / 13:30:05 / cg" |
4189 ! |
4210 ! |
4190 |
4211 |
4191 localSourceStreamFor:sourceFile |
4212 localSourceStreamFor:sourceFile |
4192 "return an open stream on a local sourcefile, nil if that is not available" |
4213 "return an open stream on a local sourcefile, nil if that is not available" |
4193 |
4214 |
4565 time - the time when the logical revision was checked in |
4591 time - the time when the logical revision was checked in |
4566 fileName - the classes source file name |
4592 fileName - the classes source file name |
4567 repositoryPath - the classes source container |
4593 repositoryPath - the classes source container |
4568 " |
4594 " |
4569 |
4595 |
4570 |vsnString info mgr| |
4596 ^ self revisionInfoOfManager:self sourceCodeManager |
4571 |
|
4572 vsnString := self revisionString. |
|
4573 vsnString notNil ifTrue:[ |
|
4574 mgr := self sourceCodeManager. |
|
4575 mgr notNil ifTrue:[ |
|
4576 info := mgr revisionInfoFromString:vsnString |
|
4577 ] ifFalse:[ |
|
4578 info := Class revisionInfoFromString:vsnString. |
|
4579 ]. |
|
4580 info notNil ifTrue:[ |
|
4581 info binaryRevision:self binaryRevision. |
|
4582 ] |
|
4583 ]. |
|
4584 ^ info |
|
4585 |
4597 |
4586 " |
4598 " |
4587 Object revisionString |
4599 Object revisionString |
4588 Object revisionInfo |
4600 Object revisionInfo |
4589 Image revisionInfo |
4601 Image revisionInfo |
4590 " |
4602 " |
4591 |
4603 |
4592 "Created: / 11-11-1995 / 14:27:20 / cg" |
4604 "Created: / 11-11-1995 / 14:27:20 / cg" |
4593 "Modified: / 26-03-1997 / 00:13:17 / stefan" |
4605 "Modified: / 26-03-1997 / 00:13:17 / stefan" |
4594 "Modified: / 22-10-2008 / 20:35:53 / cg" |
4606 "Modified: / 19-04-2011 / 13:41:24 / cg" |
|
4607 ! |
|
4608 |
|
4609 revisionInfoOfManager:aSourceCodemanagerOrNil |
|
4610 "return an object filled with revision info. |
|
4611 This extracts the relevant info from the revisionString. |
|
4612 The revisionInfo contains all or a subset of: |
|
4613 binaryRevision - the revision upon which the binary of this class is based |
|
4614 revision - the revision upon which the class is based logically |
|
4615 (different, if a changed class was checked in, but not yet recompiled) |
|
4616 user - the user who checked in the logical revision |
|
4617 date - the date when the logical revision was checked in |
|
4618 time - the time when the logical revision was checked in |
|
4619 fileName - the classes source file name |
|
4620 repositoryPath - the classes source container |
|
4621 " |
|
4622 |
|
4623 |vsnString info| |
|
4624 |
|
4625 aSourceCodemanagerOrNil notNil ifTrue:[ |
|
4626 vsnString := self revisionStringOfManager:aSourceCodemanagerOrNil. |
|
4627 ]. |
|
4628 vsnString isNil ifTrue:[ |
|
4629 vsnString := self revisionStringOfManager:nil. |
|
4630 ]. |
|
4631 vsnString isNil ifTrue:[^ nil]. |
|
4632 |
|
4633 aSourceCodemanagerOrNil notNil ifTrue:[ |
|
4634 info := aSourceCodemanagerOrNil revisionInfoFromString:vsnString |
|
4635 ] ifFalse:[ |
|
4636 info := Class revisionInfoFromString:vsnString. |
|
4637 ]. |
|
4638 info notNil ifTrue:[ |
|
4639 info binaryRevision:self binaryRevision. |
|
4640 ]. |
|
4641 ^ info |
|
4642 |
|
4643 " |
|
4644 Object revisionString |
|
4645 Object revisionInfo |
|
4646 Image revisionInfo |
|
4647 " |
|
4648 |
|
4649 "Modified: / 26-03-1997 / 00:13:17 / stefan" |
|
4650 "Created: / 19-04-2011 / 13:41:13 / cg" |
4595 ! |
4651 ! |
4596 |
4652 |
4597 revisionString |
4653 revisionString |
4598 "{ Pragma: +optSpace }" |
4654 "{ Pragma: +optSpace }" |
4599 |
4655 |
4601 classes #version method. Either this is a method returning that string, |
4657 classes #version method. Either this is a method returning that string, |
4602 or it's a comment-only method and the comment defines the version. |
4658 or it's a comment-only method and the comment defines the version. |
4603 If the receiver is unloaded, or the source is not accessable, |
4659 If the receiver is unloaded, or the source is not accessable, |
4604 or no such method exists, then nil is returned." |
4660 or no such method exists, then nil is returned." |
4605 |
4661 |
4606 |owner versionMethod| |
4662 ^ self revisionStringOfManager:nil |
4607 |
|
4608 (owner := self owningClass) notNil ifTrue:[^ owner revisionString]. |
|
4609 |
|
4610 versionMethod := self findVersionMethod. |
|
4611 versionMethod notNil ifTrue:[ |
|
4612 ^ versionMethod valueWithReceiver:(self theNonMetaclass) arguments:#() |
|
4613 ]. |
|
4614 ^ nil. |
|
4615 |
4663 |
4616 " |
4664 " |
4617 Smalltalk allClassesDo:[:cls | |
4665 Smalltalk allClassesDo:[:cls | |
4618 Transcript show:cls name; show:' -> '; showCR:cls revisionString |
4666 Transcript show:cls name; show:' -> '; showCR:cls revisionString |
4619 ]. |
4667 ]. |
4624 " |
4672 " |
4625 |
4673 |
4626 "Created: / 29-10-1995 / 19:28:03 / cg" |
4674 "Created: / 29-10-1995 / 19:28:03 / cg" |
4627 "Modified: / 01-04-1997 / 23:37:25 / stefan" |
4675 "Modified: / 01-04-1997 / 23:37:25 / stefan" |
4628 "Modified: / 07-02-2001 / 18:03:39 / ps" |
4676 "Modified: / 07-02-2001 / 18:03:39 / ps" |
4629 "Modified: / 22-10-2008 / 20:33:49 / cg" |
4677 "Modified: / 19-04-2011 / 13:38:07 / cg" |
|
4678 ! |
|
4679 |
|
4680 revisionStringOfManager:aSourceCodeManagerOrNil |
|
4681 "{ Pragma: +optSpace }" |
|
4682 |
|
4683 "return my revision string; that one is extracted from the |
|
4684 classes #version method. Either this is a method returning that string, |
|
4685 or it's a comment-only method and the comment defines the version. |
|
4686 If the receiver is unloaded, or the source is not accessable, |
|
4687 or no such method exists, then nil is returned." |
|
4688 |
|
4689 |owner versionMethod| |
|
4690 |
|
4691 (owner := self owningClass) notNil ifTrue:[^ owner revisionString]. |
|
4692 |
|
4693 versionMethod := self findVersionMethodOfManager:aSourceCodeManagerOrNil. |
|
4694 versionMethod notNil ifTrue:[ |
|
4695 ^ versionMethod valueWithReceiver:(self theNonMetaclass) arguments:#() |
|
4696 ]. |
|
4697 ^ nil. |
|
4698 |
|
4699 " |
|
4700 Smalltalk allClassesDo:[:cls | |
|
4701 Transcript show:cls name; show:' -> '; showCR:cls revisionString |
|
4702 ]. |
|
4703 |
|
4704 Number revisionString |
|
4705 FileDirectory revisionString |
|
4706 Metaclass revisionString |
|
4707 " |
|
4708 |
|
4709 "Modified: / 01-04-1997 / 23:37:25 / stefan" |
|
4710 "Modified: / 07-02-2001 / 18:03:39 / ps" |
|
4711 "Created: / 19-04-2011 / 13:37:42 / cg" |
4630 ! |
4712 ! |
4631 |
4713 |
4632 setBinaryRevision:aString |
4714 setBinaryRevision:aString |
4633 "set the revision-ID. |
4715 "set the revision-ID. |
4634 This should normally not be done in the running system, as the source-manager |
4716 This should normally not be done in the running system, as the source-manager |