author | Claus Gittinger <cg@exept.de> |
Thu, 03 Nov 2016 13:22:28 +0100 | |
changeset 1014 | 8e77e7bafd66 |
parent 913 | 224fedf76aa7 |
child 996 | ab948c69360b |
child 1028 | 56fccc9a0176 |
permissions | -rw-r--r-- |
32 | 1 |
"{ Package: 'stx:goodies/monticello' }" |
2 |
||
3 |
MCVersionReader subclass:#MCMczReader |
|
4 |
instanceVariableNames:'zip infoCache' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
638 | 7 |
category:'SCM-Monticello-Storing' |
32 | 8 |
! |
9 |
||
10 |
||
11 |
!MCMczReader class methodsFor:'accessing'! |
|
12 |
||
13 |
extension |
|
14 |
^ 'mcz' |
|
15 |
! ! |
|
16 |
||
17 |
!MCMczReader class methodsFor:'testing'! |
|
18 |
||
19 |
supportsDependencies |
|
20 |
^ true |
|
21 |
! |
|
22 |
||
23 |
supportsVersions |
|
24 |
^ true |
|
25 |
! ! |
|
26 |
||
208 | 27 |
!MCMczReader methodsFor:'as yet unclassified'! |
32 | 28 |
|
29 |
associate: tokens |
|
208 | 30 |
|
31 |
^MCLazyPropertyDictionary withTokens: tokens. |
|
32 |
||
33 |
" |
|
32 | 34 |
| result | |
208 | 35 |
result := Dictionary new. |
36 |
tokens pairWiseDo: [:key :value | |
|
37 |
| tmp | |
|
38 |
tmp := value. |
|
39 |
value isString ifFalse: [tmp := value collect: [:ea | self associate: ea]]. |
|
40 |
value = 'nil' ifTrue: [tmp := '']. |
|
41 |
result at: key put: tmp]. |
|
32 | 42 |
^ result |
208 | 43 |
" |
32 | 44 |
|
208 | 45 |
"Modified: / 28-10-2010 / 15:25:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
46 |
! |
|
32 | 47 |
|
48 |
extractDefinitionsFrom: member |
|
208 | 49 |
| reader rc | |
50 |
(rc := (MCSnapshotReader readerClassForFileNamed: member fileName)) |
|
51 |
ifNotNil: |
|
52 |
[ reader := rc on: (self zip contentsOf: member fileName). |
|
53 |
definitions addAll: reader definitions] |
|
54 |
||
55 |
"Modified: / 11-09-2010 / 21:50:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
32 | 56 |
! |
57 |
||
58 |
extractDependencyFrom: zipMember |
|
59 |
^ MCVersionDependency |
|
60 |
package: (MCPackage named: (zipMember fileName copyAfterLast: $/)) |
|
61 |
info: (self extractInfoFrom: (self parseMember: zipMember fileName)) |
|
62 |
! |
|
63 |
||
64 |
extractInfoFrom: dict |
|
141
0f1d8459da84
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
32
diff
changeset
|
65 |
^ self infoCache at: (dict at: #id) ifAbsentPut: |
208 | 66 |
[MCLazyVersionInfo withProperties: dict] |
67 |
" |
|
68 |
[MCVersionInfo |
|
141
0f1d8459da84
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
32
diff
changeset
|
69 |
name: (dict at: #name ifAbsent: ['']) |
208 | 70 |
id: (UUID fromString: (dict at: #id)) |
141
0f1d8459da84
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
32
diff
changeset
|
71 |
message: (dict at: #message ifAbsent: ['']) |
0f1d8459da84
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
32
diff
changeset
|
72 |
date: ([Date fromString: (dict at: #date) ] on: Error do: [ :ex | ex return: nil ]) |
0f1d8459da84
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
32
diff
changeset
|
73 |
time: ([ Time fromString:(dict at: #time)] on: Error do: [ :ex | ex return: nil ]) |
0f1d8459da84
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
32
diff
changeset
|
74 |
author: (dict at: #author ifAbsent: ['']) |
208 | 75 |
ancestors: ((dict at: #ancestors ifAbsent:#()) collect: [:ea | self extractInfoFrom: ea]) |
141
0f1d8459da84
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
32
diff
changeset
|
76 |
stepChildren: ((dict at: #stepChildren ifAbsent: [#()]) collect: [:ea | self extractInfoFrom: ea])] |
208 | 77 |
" |
78 |
||
79 |
"Modified: / 28-10-2010 / 17:53:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
32 | 80 |
! |
81 |
||
82 |
infoCache |
|
208 | 83 |
^ infoCache ifNil: [infoCache := Dictionary new] |
32 | 84 |
! |
85 |
||
86 |
loadDefinitions |
|
913 | 87 |
|doNotShowAgainHolder| |
88 |
||
89 |
doNotShowAgainHolder := false asValue. |
|
90 |
||
208 | 91 |
definitions := OrderedCollection new. |
913 | 92 |
(self zip isValidPath: 'snapshot.bin') ifTrue:[ |
93 |
[ |
|
94 |
^ definitions := (DataStream on: (self zip contentsOf: 'snapshot.bin') |
|
95 |
asByteArray readStream) next definitions |
|
96 |
] on: Error do: [:fallThrough| |
|
97 |
doNotShowAgainHolder value ifTrue:[fallThrough proceed]. |
|
98 |
||
99 |
"/ self halt:fallThrough description |
|
100 |
Dialog aboutToOpenBoxNotificationSignal handle:[:ex | |
|
101 |
ex box addCheckBoxAtBottom:'Do not show this dialog again.' on:doNotShowAgainHolder. |
|
102 |
] do:[ |
|
103 |
|answer| |
|
104 |
||
105 |
answer := Dialog confirmWithCancel:(fallThrough description,'\\Try proceeding with binary? (if NO, source is loaded)') withCRs. |
|
106 |
answer isNil ifTrue:[AbortOperationRequest raise]. |
|
107 |
answer ifTrue:[ |
|
108 |
fallThrough proceed |
|
109 |
]. |
|
110 |
]. |
|
111 |
] |
|
112 |
]. |
|
113 |
"otherwise (binay broken), try source" |
|
522 | 114 |
|
208 | 115 |
self breakPoint:#jv. |
141
0f1d8459da84
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
32
diff
changeset
|
116 |
(self zip membersMatching: 'snapshot/*') |
0f1d8459da84
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
32
diff
changeset
|
117 |
do: [:m | self extractDefinitionsFrom: m]. |
208 | 118 |
|
119 |
"Modified: / 14-09-2010 / 21:22:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
522 | 120 |
"Modified: / 25-11-2011 / 16:55:00 / cg" |
32 | 121 |
! |
122 |
||
123 |
loadDependencies |
|
208 | 124 |
dependencies := (self zip membersMatching: 'dependencies/*') collect: [:m | self extractDependencyFrom: m]. |
125 |
dependencies := dependencies asArray. |
|
126 |
||
32 | 127 |
! |
128 |
||
129 |
loadPackage |
|
130 |
| dict | |
|
208 | 131 |
dict := self parseMember: 'package'. |
132 |
package := MCPackage named: (dict at: #name) |
|
32 | 133 |
! |
134 |
||
135 |
loadVersionInfo |
|
208 | 136 |
info := self extractInfoFrom: (self parseMember: 'version') |
32 | 137 |
! |
138 |
||
139 |
parseMember: fileName |
|
208 | 140 |
| tokens | |
141 |
tokens := (self scanner scanTokens: (self zip contentsOf: fileName)) first. |
|
142 |
^ self associate: tokens |
|
32 | 143 |
! |
144 |
||
145 |
scanner |
|
146 |
^ MCScanner |
|
147 |
! |
|
148 |
||
149 |
zip |
|
483 | 150 |
(zip isNil or:[zip fileSize == 0]) ifTrue:[ |
151 |
zip := ZipArchive readingFrom:stream |
|
152 |
]. |
|
153 |
^ zip |
|
154 |
||
155 |
"Modified: / 07-09-2011 / 14:55:18 / cg" |
|
32 | 156 |
! ! |
157 |
||
158 |
!MCMczReader class methodsFor:'documentation'! |
|
159 |
||
160 |
version |
|
913 | 161 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCMczReader.st,v 1.8 2014-02-12 17:30:06 cg Exp $' |
141
0f1d8459da84
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
32
diff
changeset
|
162 |
! |
0f1d8459da84
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
32
diff
changeset
|
163 |
|
0f1d8459da84
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
32
diff
changeset
|
164 |
version_CVS |
913 | 165 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCMczReader.st,v 1.8 2014-02-12 17:30:06 cg Exp $' |
208 | 166 |
! |
167 |
||
168 |
version_SVN |
|
913 | 169 |
^ '$Id: MCMczReader.st,v 1.8 2014-02-12 17:30:06 cg Exp $' |
32 | 170 |
! ! |
913 | 171 |