43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
typemethod setup {} {
# Define the names and structure of the persistent state of
# this pass.
state reading meta
state reading revision
state reading branch
state reading tag
state reading symbol
# Data per changeset, namely the project it belongs to, how it
# was induced (revision or symbol), plus reference to the
# primary entry causing it (meta entry or symbol). An adjunct
|
>
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
typemethod setup {} {
# Define the names and structure of the persistent state of
# this pass.
state reading meta
state reading revision
state reading revisionbranchchildren
state reading branch
state reading tag
state reading symbol
# Data per changeset, namely the project it belongs to, how it
# was induced (revision or symbol), plus reference to the
# primary entry causing it (meta entry or symbol). An adjunct
|
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
typemethod run {} {
# Pass manager interface. Executed to perform the
# functionality of the pass.
set csets {}
state transaction {
CreateRevisionChangesets csets ; # Group file revisions into csets.
CreateSymbolChangesets csets ; # Create csets for tags and branches.
PersistTheChangesets $csets
}
return
}
typemethod discard {} {
# Pass manager interface. Executed for all passes after the
# run passes, to remove all data of this pass from the state,
|
|
>
|
|
|
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
typemethod run {} {
# Pass manager interface. Executed to perform the
# functionality of the pass.
set csets {}
state transaction {
CreateRevisionChangesets csets ; # Group file revisions into csets.
BreakInternalDependencies csets ; # Split the csets based on internal conflicts.
CreateSymbolChangesets csets ; # Create csets for tags and branches.
PersistTheChangesets $csets
}
return
}
typemethod discard {} {
# Pass manager interface. Executed for all passes after the
# run passes, to remove all data of this pass from the state,
|
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
set p [repository projectof $lastproject]
lappend csets [project::rev %AUTO% $p sym $lastsymbol $revisions]
}
log write 4 initcsets "Created [nsp $n {symbol changeset}]"
return
}
proc PersistTheChangesets {csets} {
log write 3 initcsets {Saving the created changesets to the persistent state}
foreach cset $csets {
$cset persist
}
log write 4 initcsets {Ok.}
return
}
# # ## ### ##### ######## #############
## Configuration
pragma -hasinstances no ; # singleton
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
268
269
270
271
272
273
274
275
276
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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
|
set p [repository projectof $lastproject]
lappend csets [project::rev %AUTO% $p sym $lastsymbol $revisions]
}
log write 4 initcsets "Created [nsp $n {symbol changeset}]"
return
}
proc BreakInternalDependencies {cv} {
upvar 1 $cv csets
# 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 n 0
foreach cset $csets {
# The main method for splitting does only one split, which
# may not be enough. The code here iterates until no more
# splits can be performed. An iterative algorithm was
# chosen over a recursive one to prevent running into
# stack limits.
set tosplit [list $cset]
set at 0
while {$at < [llength $tosplit]} {
# Note here how we are __not__ advancing in the list
# when we were able to break the current
# changeset into two pieces, causing the loop to
# immediately check the first of the two pieces
# again for further break possibilities. The
# other piece is added at the end, thus processed
# later.
while {[[lindex $tosplit $at] breakinternaldependencies tosplit]} {}
incr at
}
# At last the generated fragments are added to the main
# list of changesets. The first element is skipped as it
# is already in the list.
foreach cset [lrange $tosplit 1 end] { lappend csets $cset ; incr n }
}
log write 4 initcsets "Created [nsp $n {additional revision changeset}]"
log write 4 initcsets Ok.
return
}
proc PersistTheChangesets {csets} {
log write 3 initcsets "Saving [nsp [llength $csets] {initial changeset}] to the persistent state"
foreach cset $csets {
$cset persist
}
log write 4 initcsets Ok.
return
}
# # ## ### ##### ######## #############
## Configuration
pragma -hasinstances no ; # singleton
|