author | convert-repo |
Tue, 28 May 2019 03:27:24 +0000 | |
changeset 1097 | 180bdb478bc0 |
parent 1071 | aa0ecb4c9138 |
permissions | -rw-r--r-- |
429 | 1 |
"{ Package: 'stx:goodies/monticello' }"! |
2 |
||
3 |
!Annotation class methodsFor:'instance creation'! |
|
395 | 4 |
|
5 |
mctimestamp: aString |
|
6 |
||
7 |
^MCTimestampAnnotation new timestamp: aString |
|
8 |
||
9 |
"Created: / 14-09-2010 / 15:35:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10 |
! ! |
|
11 |
||
429 | 12 |
!Behavior methodsFor:'*monticello-squeakCompatibility'! |
395 | 13 |
|
14 |
traitCompositionString |
|
15 |
^ '{}' |
|
16 |
||
17 |
"Created: / 26-08-2009 / 12:43:23 / Jaroslav Havlin <havlij6@fel.cvut.cz>" |
|
18 |
! ! |
|
19 |
||
429 | 20 |
!Behavior methodsFor:'*monticello-squeakCompatibility'! |
150 | 21 |
|
22 |
typeOfClass |
|
395 | 23 |
"Answer a symbol uniquely describing the type of the receiver" |
24 |
"self instSpec = CompiledMethod instSpec ifTrue:[^#compiledMethod]." "Very special!!" |
|
25 |
self isBytes ifTrue:[^#bytes]. |
|
26 |
(self isWords and:[self isPointers not]) ifTrue:[^#words]. |
|
27 |
self isWeakPointers ifTrue:[^#weak]. |
|
28 |
self isVariable ifTrue:[^#variable]. |
|
29 |
^#normal. |
|
30 |
||
31 |
"Created: / 26-08-2009 / 12:45:50 / Jaroslav Havlin <havlij6@fel.cvut.cz>" |
|
32 |
! ! |
|
33 |
||
429 | 34 |
!Change methodsFor:'accessing'! |
395 | 35 |
|
36 |
mcDefinition |
|
1041 | 37 |
"retrieve the original mcDefinition from which I was created. |
38 |
Only the major change keeps that ref to avoid multiple mc's to be generated |
|
39 |
(i.e. comment changes do not)" |
|
395 | 40 |
|
41 |
^self objectAttributeAt: #mcDefinition |
|
42 |
||
43 |
"Created: / 08-11-2010 / 17:56:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
44 |
! ! |
|
45 |
||
429 | 46 |
!Change methodsFor:'accessing'! |
395 | 47 |
|
1041 | 48 |
mcDefinition: anMCDefinition |
49 |
"remember the original mcDefinition from which I was created. |
|
50 |
Only the major change keeps that ref to avoid multiple mc's to be generated |
|
51 |
(i.e. comment changes do not)" |
|
395 | 52 |
|
1041 | 53 |
^self objectAttributeAt: #mcDefinition put: anMCDefinition |
395 | 54 |
|
55 |
"Created: / 08-11-2010 / 17:56:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
150 | 56 |
! ! |
136 | 57 |
|
436
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
58 |
!CharacterArray methodsFor:'*monticello-squeakCompatibility'! |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
59 |
|
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
60 |
asStringWithNativeLineEndings |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
61 |
|
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
62 |
^self copyReplaceAll:Character return with: Character cr |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
63 |
|
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
64 |
"Created: / 12-09-2010 / 16:00:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
65 |
"Modified: / 13-10-2010 / 17:27:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
66 |
! ! |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
67 |
|
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
68 |
!CharacterArray methodsFor:'*monticello-squeakCompatibility'! |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
69 |
|
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
70 |
asStringWithSqueakLineEndings |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
71 |
|
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
72 |
^self copyReplaceAll:Character cr with: Character return |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
73 |
|
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
74 |
"Created: / 12-09-2010 / 16:00:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
75 |
"Modified: / 13-10-2010 / 17:28:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
76 |
! ! |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
77 |
|
429 | 78 |
!Class methodsFor:'*monticello'! |
136 | 79 |
|
80 |
asClassDefinition |
|
395 | 81 |
^ MCClassDefinition |
82 |
name: self name |
|
736
43645227af41
care for nil superclass in Class >> asClassDefinition
Claus Gittinger <cg@exept.de>
parents:
732
diff
changeset
|
83 |
superclassName: (self superclass isNil ifTrue:['nil'] ifFalse:[self superclass name]) |
395 | 84 |
traitComposition: self traitCompositionString |
85 |
classTraitComposition: self class traitCompositionString |
|
86 |
category: self category |
|
87 |
instVarNames: self instVarNames |
|
88 |
classVarNames: self classVarNames |
|
89 |
poolDictionaryNames: self poolDictionaryNames |
|
90 |
classInstVarNames: self class instVarNames |
|
91 |
type: self typeOfClass |
|
92 |
comment: (self organization classComment ? '') asStringWithSqueakLineEndings |
|
93 |
commentStamp: self organization commentStamp |
|
94 |
||
95 |
"Modified: / 12-09-2010 / 17:19:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
136 | 96 |
! ! |
97 |
||
429 | 98 |
!Class methodsFor:'*monticello'! |
136 | 99 |
|
100 |
classDefinitions |
|
888
f5d285e135d2
Fix in ProjectDefinition>>monticelloName.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
883
diff
changeset
|
101 |
self isLoaded ifFalse:[self autoload]. |
136 | 102 |
^ Array with: self asClassDefinition |
103 |
! ! |
|
104 |
||
429 | 105 |
!Class methodsFor:'*monticello'! |
136 | 106 |
|
107 |
poolDictionaryNames |
|
160 | 108 |
^ self sharedPools "/ collect: [:ea | ea name "self environment keyAtIdentityValue: ea"] |
136 | 109 |
! ! |
110 |
||
429 | 111 |
!ClassDescription methodsFor:'*monticello-squeakCompatibility'! |
395 | 112 |
|
113 |
mcDefinition |
|
114 |
||
115 |
|s| |
|
116 |
||
117 |
s := WriteStream on:(String new). |
|
118 |
self |
|
119 |
basicFileOutDefinitionOn:s |
|
120 |
withNameSpace:false |
|
121 |
withPackage:false. |
|
122 |
s position: s position - 1. |
|
123 |
||
124 |
^ s contents |
|
125 |
||
126 |
"Created: / 11-09-2010 / 18:06:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
127 |
! ! |
|
128 |
||
429 | 129 |
!Object methodsFor:'*monticello'! |
136 | 130 |
|
131 |
isConflict |
|
132 |
^false |
|
133 |
! ! |
|
134 |
||
839
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
135 |
!PackageInfo methodsFor:'testing'! |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
136 |
|
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
137 |
isMCStXPackageInfo |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
138 |
^ false |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
139 |
|
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
140 |
"Created: / 29-05-2013 / 01:08:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
141 |
! ! |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
142 |
|
429 | 143 |
!ProjectDefinition class methodsFor:'code generation'! |
395 | 144 |
|
452
cbc2f85f11f8
fixes for remembering Monticello metadata
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
437
diff
changeset
|
145 |
monticelloAncestry_code |
cbc2f85f11f8
fixes for remembering Monticello metadata
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
437
diff
changeset
|
146 |
|
459
cae7224c4ab3
fixes for remembering Monticello metadata
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
452
diff
changeset
|
147 |
^'#()' |
452
cbc2f85f11f8
fixes for remembering Monticello metadata
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
437
diff
changeset
|
148 |
|
cbc2f85f11f8
fixes for remembering Monticello metadata
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
437
diff
changeset
|
149 |
"Created: / 25-08-2011 / 16:49:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
cbc2f85f11f8
fixes for remembering Monticello metadata
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
437
diff
changeset
|
150 |
! ! |
cbc2f85f11f8
fixes for remembering Monticello metadata
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
437
diff
changeset
|
151 |
|
839
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
152 |
!ProjectDefinition class methodsFor:'accessing - monticello'! |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
153 |
|
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
154 |
monticelloName |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
155 |
"Return name of the package for Monticello. |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
156 |
|
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
157 |
Historically, Monticello package membership is based on |
878 | 158 |
naming conventions. All classes whose category name starts with |
159 |
package name are considerer as belonging to the package, others |
|
160 |
do not. If classes' category does not match this naming convention, |
|
161 |
the package will fail to load back properly. |
|
839
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
162 |
|
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
163 |
Here, infer such prefix. Individual packages may override this method |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
164 |
and return a string to enforce a particular name." |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
165 |
|
878 | 166 |
| cats longest prefix index nm | |
839
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
167 |
|
889
329193445e6f
Funny, previous fix does not work. This code does.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
888
diff
changeset
|
168 |
cats := (self classes collect:[:each | each autoload; category ]) asSet. |
839
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
169 |
cats remove:#'* Projects & Packages *'. |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
170 |
cats size == 1 ifTrue:[ |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
171 |
^ cats anElement |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
172 |
]. |
878 | 173 |
cats isEmpty ifTrue:[ |
174 |
^ 'Misc_Changes' |
|
175 |
]. |
|
975 | 176 |
longest := cats |
177 |
inject:cats anElement |
|
839
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
178 |
into:[:cat :each | |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
179 |
each size > cat size ifTrue:[ |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
180 |
each |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
181 |
] ifFalse:[ cat ] |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
182 |
]. |
975 | 183 |
|
839
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
184 |
prefix := ''. |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
185 |
[ |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
186 |
(index := longest indexOf:$- startingAt:prefix size + 2) ~~ 0 |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
187 |
] whileTrue:[ |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
188 |
prefix := longest copyTo:index - 1. |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
189 |
(cats allSatisfy:[:each | each startsWith:prefix ]) ifTrue:[ |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
190 |
nm := prefix. |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
191 |
]. |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
192 |
]. |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
193 |
nm notNil ifTrue:[ |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
194 |
^ nm |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
195 |
]. |
975 | 196 |
^ self package asString copyReplaceAny:':/' with:$_. |
197 |
||
198 |
"/ self |
|
199 |
"/ error:'Cannot infer Monticello package name from class categories. Please define #mcName explicitly' |
|
839
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
200 |
|
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
201 |
"Created: / 29-05-2013 / 01:36:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
888
f5d285e135d2
Fix in ProjectDefinition>>monticelloName.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
883
diff
changeset
|
202 |
"Modified: / 23-06-2013 / 21:12:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
839
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
203 |
! ! |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
204 |
|
883
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
205 |
!ProjectDefinition class methodsFor:'accessing - monticello'! |
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
206 |
|
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
207 |
monticelloNameForMCZ |
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
208 |
"Return the name of package used to build .mcz file. |
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
209 |
Defaults to sanitized monticelloName" |
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
210 |
|
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
211 |
^self monticelloName asString copy replaceAll: $/ with: $_; replaceAll: $: with: $_ |
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
212 |
|
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
213 |
"Created: / 07-06-2013 / 01:48:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
214 |
! ! |
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
215 |
|
452
cbc2f85f11f8
fixes for remembering Monticello metadata
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
437
diff
changeset
|
216 |
!ProjectDefinition class methodsFor:'code generation'! |
cbc2f85f11f8
fixes for remembering Monticello metadata
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
437
diff
changeset
|
217 |
|
395 | 218 |
monticelloTimestamps_code |
219 |
||
220 |
| methodsWithTimestamp | |
|
221 |
methodsWithTimestamp := OrderedCollection new. |
|
222 |
||
223 |
self classes do:[:cls| |
|
224 |
cls methodsDo:[:mthd| |
|
225 |
(mthd hasAnnotation: #mctimestamp:) ifTrue:[ |
|
226 |
methodsWithTimestamp add: mthd |
|
227 |
] |
|
228 |
]. |
|
229 |
]. |
|
230 |
self extensionMethods do:[:mthd| |
|
231 |
(mthd hasAnnotation: #mctimestamp:) ifTrue:[ |
|
232 |
methodsWithTimestamp add: mthd |
|
233 |
] |
|
234 |
]. |
|
235 |
||
236 |
^self monticelloTimestamps_codeFor: methodsWithTimestamp |
|
237 |
||
238 |
" |
|
239 |
stx_goodies_mondrian_core monticelloTimestamps_code |
|
240 |
" |
|
241 |
||
242 |
"Created: / 09-11-2010 / 18:23:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
243 |
! ! |
|
244 |
||
429 | 245 |
!ProjectDefinition class methodsFor:'code generation'! |
395 | 246 |
|
247 |
monticelloTimestamps_codeFor: methods |
|
248 |
||
249 |
| code | |
|
250 |
code := String new writeStream. |
|
251 |
code nextPutAll:'monticelloTimestamps |
|
252 |
||
253 |
^#('. |
|
254 |
methods do:[:mthd| |
|
255 |
code |
|
256 |
tab; tab; |
|
257 |
nextPut:$(; |
|
258 |
nextPutAll: mthd mclass fullName; |
|
259 |
space; |
|
260 |
nextPutAll: mthd selector; |
|
261 |
space; |
|
262 |
nextPutAll: (mthd annotationAt: #mctimestamp:) timestamp storeString; |
|
263 |
nextPut:$); |
|
264 |
cr. |
|
265 |
]. |
|
266 |
code nextPutAll:' |
|
267 |
)'. |
|
268 |
||
269 |
^code contents |
|
270 |
||
271 |
" |
|
272 |
stx_goodies_mondrian_core mcTimestamps_code |
|
273 |
" |
|
274 |
||
275 |
"Created: / 09-11-2010 / 18:27:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
276 |
! ! |
|
277 |
||
429 | 278 |
!SequenceableCollection methodsFor:'*monticello-squeakCompatibility'! |
395 | 279 |
|
280 |
copyReplaceAll: oldSubstring with: newSubstring asTokens: ifTokens |
|
281 |
"Answer a copy of the receiver in which all occurrences of |
|
282 |
oldSubstring have been replaced by newSubstring. |
|
283 |
ifTokens (valid for Strings only) specifies that the characters |
|
284 |
surrounding the recplacement must not be alphanumeric. |
|
285 |
Bruce Simth, must be incremented by 1 and not |
|
286 |
newSubstring if ifTokens is true. See example below. " |
|
287 |
||
288 |
| aString startSearch currentIndex endIndex | |
|
289 |
(ifTokens and: [(self isString) not]) |
|
290 |
ifTrue: [(self isKindOf: Text) ifFalse: [ |
|
291 |
self error: 'Token replacement only valid for Strings']]. |
|
292 |
aString := self. |
|
293 |
startSearch := 1. |
|
294 |
[(currentIndex := aString indexOfSubCollection: oldSubstring startingAt: startSearch) |
|
295 |
> 0] |
|
296 |
whileTrue: |
|
297 |
[endIndex := currentIndex + oldSubstring size - 1. |
|
298 |
(ifTokens not |
|
299 |
or: [(currentIndex = 1 |
|
300 |
or: [(aString at: currentIndex-1) isAlphaNumeric not]) |
|
301 |
and: [endIndex = aString size |
|
302 |
or: [(aString at: endIndex+1) isAlphaNumeric not]]]) |
|
303 |
ifTrue: [aString := aString |
|
304 |
copyReplaceFrom: currentIndex |
|
305 |
to: endIndex |
|
306 |
with: newSubstring. |
|
307 |
startSearch := currentIndex + newSubstring size] |
|
308 |
ifFalse: [ |
|
309 |
ifTokens |
|
310 |
ifTrue: [startSearch := currentIndex + 1] |
|
311 |
ifFalse: [startSearch := currentIndex + newSubstring size]]]. |
|
312 |
^ aString |
|
313 |
||
314 |
"Test case: |
|
315 |
'test te string' copyReplaceAll: 'te' with: 'longone' asTokens: true " |
|
316 |
||
317 |
"Created: / 26-08-2009 / 12:40:34 / Jaroslav Havlin <havlij6@fel.cvut.cz>" |
|
318 |
! ! |
|
319 |
||
429 | 320 |
!Stream methodsFor:'*monticello'! |
136 | 321 |
|
322 |
isMessageStream |
|
323 |
^ false |
|
324 |
! ! |
|
325 |
||
429 | 326 |
!String methodsFor:'*monticello'! |
136 | 327 |
|
328 |
extractNumber |
|
329 |
^ ('0', self select: [:ea | ea isDigit]) asNumber |
|
330 |
! ! |
|
331 |
||
429 | 332 |
!String methodsFor:'*monticello-squeakCompatibility'! |
395 | 333 |
|
334 |
withSqueakLineEndings |
|
1071 | 335 |
"Answer a copy of myself in which all sequences of |
336 |
<CR><LF> or <LF> have been changed to <CR>. |
|
337 |
Notice; that ST/X uses LF as line end internally" |
|
338 |
||
395 | 339 |
| newText | |
340 |
(self includes: Character lf) ifFalse: [ ^self copy ]. |
|
341 |
newText := self copyReplaceAll: String crlf with: String cr. |
|
342 |
(newText asString includes: Character lf) ifFalse: [ ^newText ]. |
|
343 |
^newText copyReplaceAll: String lf with: String cr asTokens: false. |
|
344 |
||
1071 | 345 |
" |
346 |
('a' , String lf , 'b' , |
|
347 |
String return , 'c' , |
|
348 |
String crlf , 'd' , |
|
349 |
String crlf) withSqueakLineEndings |
|
350 |
" |
|
351 |
||
395 | 352 |
"Created: / 26-08-2009 / 11:35:56 / Jaroslav Havlin <havlij6@fel.cvut.cz>" |
1071 | 353 |
"Modified (comment): / 26-08-2018 / 13:34:17 / Claus Gittinger" |
395 | 354 |
! ! |
355 |
||
429 | 356 |
!StringCollection methodsFor:'converting'! |
395 | 357 |
|
358 |
asStringWithNativeLineEndings |
|
359 |
||
360 |
^self asString |
|
361 |
||
362 |
"Created: / 12-09-2010 / 15:58:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
363 |
! ! |
|
364 |
||
429 | 365 |
!StringCollection methodsFor:'converting'! |
395 | 366 |
|
367 |
asStringWithSqueakLineEndings |
|
368 |
||
369 |
^ self |
|
370 |
asStringWith:Character return |
|
371 |
from:1 to:(self size) |
|
372 |
compressTabs:false |
|
373 |
final:nil |
|
374 |
||
375 |
"Created: / 12-09-2010 / 15:58:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
376 |
! ! |
|
377 |
||
429 | 378 |
!Symbol methodsFor:'*monticello-squeakCompatibility'! |
395 | 379 |
|
380 |
isDoIt |
|
381 |
^ (self == #DoIt) or:[ self == #DoItIn: ]. |
|
382 |
||
383 |
"Created: / 26-08-2009 / 11:46:44 / Jaroslav Havlin <havlij6@fel.cvut.cz>" |
|
384 |
! ! |
|
385 |
||
429 | 386 |
!Timestamp class methodsFor:'*monticello-instance creation'! |
395 | 387 |
|
388 |
fromMethodTimeStamp: aString |
|
389 |
| stream | |
|
390 |
stream := ReadStream on: aString. |
|
391 |
stream skipSeparators. |
|
392 |
stream skipTo: Character space. |
|
393 |
^self readFrom: stream. |
|
394 |
! ! |
|
395 |
||
429 | 396 |
!Tools::NewSystemBrowser methodsFor:'menu actions-monticello'! |
395 | 397 |
|
398 |
projectMenuMonticelloCommit |
|
736
43645227af41
care for nil superclass in Class >> asClassDefinition
Claus Gittinger <cg@exept.de>
parents:
732
diff
changeset
|
399 |
| packageName package workingCopy | |
395 | 400 |
|
401 |
packageName := self theSingleSelectedProject. |
|
736
43645227af41
care for nil superclass in Class >> asClassDefinition
Claus Gittinger <cg@exept.de>
parents:
732
diff
changeset
|
402 |
packageName isNil ifTrue:[ |
43645227af41
care for nil superclass in Class >> asClassDefinition
Claus Gittinger <cg@exept.de>
parents:
732
diff
changeset
|
403 |
Dialog information:'Please select a single project'. |
43645227af41
care for nil superclass in Class >> asClassDefinition
Claus Gittinger <cg@exept.de>
parents:
732
diff
changeset
|
404 |
^ self. |
43645227af41
care for nil superclass in Class >> asClassDefinition
Claus Gittinger <cg@exept.de>
parents:
732
diff
changeset
|
405 |
]. |
43645227af41
care for nil superclass in Class >> asClassDefinition
Claus Gittinger <cg@exept.de>
parents:
732
diff
changeset
|
406 |
|
943 | 407 |
self withWaitCursorDo:[ |
408 |
SourceCodeManagerUtilities basicNew |
|
409 |
validateConsistencyOfPackage:packageName |
|
410 |
doClasses:true |
|
411 |
doExtensions:true. |
|
786
8c0dffd42eb8
class: Tools::NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
412 |
|
943 | 413 |
package := MCPackage named: packageName. |
414 |
workingCopy := package workingCopy. |
|
415 |
MCCommitDialog new |
|
416 |
workingCopy: workingCopy; |
|
417 |
open |
|
418 |
]. |
|
395 | 419 |
|
420 |
"Created: / 14-09-2010 / 22:54:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
421 |
! ! |
|
422 |
||
736
43645227af41
care for nil superclass in Class >> asClassDefinition
Claus Gittinger <cg@exept.de>
parents:
732
diff
changeset
|
423 |
!UndefinedObject methodsFor:'* monticello'! |
150 | 424 |
|
425 |
typeOfClass |
|
426 |
"Necessary to support disjoint class hierarchies." |
|
427 |
||
428 |
^#normal |
|
429 |
! ! |
|
430 |
||
554 | 431 |
!UserPreferences methodsFor:'accessing-scm-monticello'! |
395 | 432 |
|
433 |
mcEnabled |
|
554 | 434 |
"/ needed for MCSettingsApp |
395 | 435 |
|
436 |
^self at: #mcEnabled ifAbsent: [true]. |
|
437 |
||
438 |
"Created: / 16-09-2010 / 09:44:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
439 |
"Modified: / 16-09-2010 / 14:50:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
554 | 440 |
"Modified (comment): / 15-01-2012 / 14:12:53 / cg" |
395 | 441 |
! ! |
442 |
||
554 | 443 |
!UserPreferences methodsFor:'accessing-scm-monticello'! |
395 | 444 |
|
445 |
mcEnabled: aBoolean |
|
554 | 446 |
"/ needed for MCSettingsApp |
395 | 447 |
|
448 |
self at: #mcEnabled put: aBoolean. |
|
449 |
||
450 |
"Created: / 16-09-2010 / 09:44:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
571 | 451 |
"Modified: / 27-08-2012 / 11:54:43 / cg" |
395 | 452 |
! ! |
453 |
||
554 | 454 |
!UserPreferences methodsFor:'accessing-scm-monticello'! |
395 | 455 |
|
456 |
mcRepositories |
|
562
d48401867000
Fixes in preferences reading/storing
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
554
diff
changeset
|
457 |
"Returns a list of MCRepository as in LITERAL ARRAY ENCODING" |
395 | 458 |
|
562
d48401867000
Fixes in preferences reading/storing
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
554
diff
changeset
|
459 |
^self at: #mcRepositories ifAbsent:[#(Array)]. |
395 | 460 |
|
461 |
" |
|
562
d48401867000
Fixes in preferences reading/storing
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
554
diff
changeset
|
462 |
UserPreferences current mcRepositories |
d48401867000
Fixes in preferences reading/storing
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
554
diff
changeset
|
463 |
UserPreferences current mcRepositories: #(Array) |
395 | 464 |
" |
465 |
||
466 |
"Created: / 16-09-2010 / 09:47:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
562
d48401867000
Fixes in preferences reading/storing
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
554
diff
changeset
|
467 |
"Modified (comment): / 04-04-2012 / 11:08:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
395 | 468 |
! ! |
469 |
||
571 | 470 |
!UserPreferences methodsFor:'accessing-scm-monticello'! |
471 |
||
472 |
mcRepositories: aCollection |
|
473 |
"/ needed for MCSettingsApp |
|
474 |
||
475 |
self at: #mcRepositories put: aCollection. |
|
476 |
||
477 |
"Created: / 27-08-2012 / 11:54:34 / cg" |
|
478 |
! ! |
|
479 |
||
429 | 480 |
!VersionInfo methodsFor:'accessing'! |
395 | 481 |
|
482 |
timeStamp |
|
483 |
||
484 |
^Timestamp |
|
485 |
fromDate: (Date fromString: date) |
|
486 |
andTime: (Time fromString: time) |
|
487 |
||
488 |
"Created: / 09-09-2010 / 15:20:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
489 |
! ! |
|
490 |
||
429 | 491 |
!stx_goodies_monticello class methodsFor:'documentation'! |
182 | 492 |
|
493 |
extensionsVersion_CVS |
|
1041 | 494 |
^ '$Header$' |
786
8c0dffd42eb8
class: Tools::NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
495 |
! ! |
883
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
496 |