17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# # ## ### ##### ######## ############# #####################
## Requirements
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require vc::tools::misc ; # Text formatting.
package require vc::tools::log ; # User feedback.
package require vc::fossil::import::cvs::repository ; # Repository management.
package require vc::fossil::import::cvs::state ; # State storage.
package require vc::fossil::import::cvs::integrity ; # State integrity checks.
package require vc::fossil::import::cvs::project::rev ; # Project level changesets
# # ## ### ##### ######## ############# #####################
## Register the pass with the management
|
>
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# # ## ### ##### ######## ############# #####################
## Requirements
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require vc::tools::misc ; # Text formatting.
package require vc::tools::log ; # User feedback.
package require vc::tools::mem ; # Memory tracking.
package require vc::fossil::import::cvs::repository ; # Repository management.
package require vc::fossil::import::cvs::state ; # State storage.
package require vc::fossil::import::cvs::integrity ; # State integrity checks.
package require vc::fossil::import::cvs::project::rev ; # Project level changesets
# # ## ### ##### ######## ############# #####################
## Register the pass with the management
|
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
# Note: We could have written this loop to create the csets
# early, extending them with all their revisions. This
# however would mean lots of (slow) method invokations
# on the csets. Doing it like this, late creation, means
# less such calls. None, but the creation itself.
foreach {mid rid pid} [state run {
SELECT M.mid, R.rid, M.pid
FROM revision R, meta M -- R ==> M, using PK index of M.
WHERE R.mid = M.mid
ORDER BY M.mid, R.date
}] {
if {$lastmeta != $mid} {
if {[llength $revisions]} {
incr n
set p [repository projectof $lastproject]
project::rev %AUTO% $p rev $lastmeta $revisions
set revisions {}
}
set lastmeta $mid
set lastproject $pid
}
lappend revisions $rid
}
if {[llength $revisions]} {
incr n
set p [repository projectof $lastproject]
project::rev %AUTO% $p rev $lastmeta $revisions
}
log write 4 initcsets "Created [nsp $n {revision changeset}]"
return
}
proc CreateSymbolChangesets {} {
log write 3 initcsets {Create changesets based on symbols}
# Tags and branches induce changesets as well, containing the
# revisions they are attached to (tags), or spawned from
# (branches).
set n 0
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
# Note: We could have written this loop to create the csets
# early, extending them with all their revisions. This
# however would mean lots of (slow) method invokations
# on the csets. Doing it like this, late creation, means
# less such calls. None, but the creation itself.
log write 14 initcsets meta_begin
mem::mark
foreach {mid rid pid} [state run {
SELECT M.mid, R.rid, M.pid
FROM revision R, meta M -- R ==> M, using PK index of M.
WHERE R.mid = M.mid
ORDER BY M.mid, R.date
}] {
log write 14 initcsets meta_next
if {$lastmeta != $mid} {
if {[llength $revisions]} {
incr n
set p [repository projectof $lastproject]
log write 14 initcsets meta_cset_begin
mem::mark
project::rev %AUTO% $p rev $lastmeta $revisions
log write 14 initcsets meta_cset_done
mem::mark
set revisions {}
}
set lastmeta $mid
set lastproject $pid
}
lappend revisions $rid
}
if {[llength $revisions]} {
incr n
set p [repository projectof $lastproject]
log write 14 initcsets meta_cset_begin
mem::mark
project::rev %AUTO% $p rev $lastmeta $revisions
log write 14 initcsets meta_cset_done
mem::mark
}
log write 14 initcsets meta_done
mem::mark
log write 4 initcsets "Created [nsp $n {revision changeset}]"
return
}
proc CreateSymbolChangesets {} {
log write 3 initcsets {Create changesets based on symbols}
mem::mark
# Tags and branches induce changesets as well, containing the
# revisions they are attached to (tags), or spawned from
# (branches).
set n 0
|
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
|
if {[llength $branches]} {
incr n
set p [repository projectof $lastproject]
project::rev %AUTO% $p sym::branch $lastsymbol $branches
}
log write 4 initcsets "Created [nsp $n {symbol changeset}]"
return
}
proc BreakInternalDependencies {} {
# This code operates on the revision changesets created by
# 'CreateRevisionChangesets'. As such it has to follow after
# it, before the symbol changesets are made. The changesets
# are inspected for internal conflicts and any such are broken
# by splitting the problematic changeset into multiple
# fragments. The results are changesets which have no internal
# dependencies, only external ones.
log write 3 initcsets {Break internal dependencies}
set old [llength [project::rev all]]
foreach cset [project::rev all] {
$cset breakinternaldependencies
}
set n [expr {[llength [project::rev all]] - $old}]
log write 4 initcsets "Created [nsp $n {additional revision changeset}]"
log write 4 initcsets Ok.
return
}
proc PersistTheChangesets {} {
log write 3 initcsets "Saving [nsp [llength [project::rev all]] {initial changeset}] to the persistent state"
foreach cset [project::rev all] {
|
>
>
>
|
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
|
if {[llength $branches]} {
incr n
set p [repository projectof $lastproject]
project::rev %AUTO% $p sym::branch $lastsymbol $branches
}
log write 4 initcsets "Created [nsp $n {symbol changeset}]"
mem::mark
return
}
proc BreakInternalDependencies {} {
# This code operates on the revision changesets created by
# 'CreateRevisionChangesets'. As such it has to follow after
# it, before the symbol changesets are made. The changesets
# are inspected for internal conflicts and any such are broken
# by splitting the problematic changeset into multiple
# fragments. The results are changesets which have no internal
# dependencies, only external ones.
log write 3 initcsets {Break internal dependencies}
mem::mark
set old [llength [project::rev all]]
foreach cset [project::rev all] {
$cset breakinternaldependencies
}
set n [expr {[llength [project::rev all]] - $old}]
log write 4 initcsets "Created [nsp $n {additional revision changeset}]"
log write 4 initcsets Ok.
mem::mark
return
}
proc PersistTheChangesets {} {
log write 3 initcsets "Saving [nsp [llength [project::rev all]] {initial changeset}] to the persistent state"
foreach cset [project::rev all] {
|
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
|
namespace eval initcsets {
namespace import ::vc::fossil::import::cvs::repository
namespace import ::vc::fossil::import::cvs::state
namespace import ::vc::fossil::import::cvs::integrity
namespace eval project {
namespace import ::vc::fossil::import::cvs::project::rev
}
namespace import ::vc::tools::misc::*
namespace import ::vc::tools::log
log register initcsets
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::pass::initcsets 1.0
return
|
>
>
>
|
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
|
namespace eval initcsets {
namespace import ::vc::fossil::import::cvs::repository
namespace import ::vc::fossil::import::cvs::state
namespace import ::vc::fossil::import::cvs::integrity
namespace eval project {
namespace import ::vc::fossil::import::cvs::project::rev
}
namespace eval mem {
namespace import ::vc::tools::mem::mark
}
namespace import ::vc::tools::misc::*
namespace import ::vc::tools::log
log register initcsets
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::pass::initcsets 1.0
return
|