Fossil SCM

fossil-scm / tools / cvs2fossil / lib / c2f_pcsetdeps.tcl
Blame History Raw 136 lines
1
## -*- tcl -*-
2
# # ## ### ##### ######## ############# #####################
3
## Copyright (c) 2007 Andreas Kupries.
4
#
5
# This software is licensed as described in the file LICENSE, which
6
# you should have received as part of this distribution.
7
#
8
# This software consists of voluntary contributions made by many
9
# individuals. For exact contribution history, see the revision
10
# history and logs, available at http://fossil-scm.hwaci.com/fossil
11
# # ## ### ##### ######## ############# #####################
12
13
## Pass VI. This pass computes the dependencies between the changesets
14
## from the file level dependencies and stores them in the state for
15
## use by the cycle breaker and topological sorting passes.
16
17
# # ## ### ##### ######## ############# #####################
18
## Requirements
19
20
package require Tcl 8.4 ; # Required runtime.
21
package require snit ; # OO system.
22
package require vc::tools::misc ; # Text formatting.
23
package require vc::tools::log ; # User feedback.
24
package require vc::fossil::import::cvs::state ; # State storage.
25
package require vc::fossil::import::cvs::project::rev ; # Project level changesets
26
27
# # ## ### ##### ######## ############# #####################
28
## Register the pass with the management
29
30
vc::fossil::import::cvs::pass define \
31
CsetDeps \
32
{Compute and cache ChangeSet Dependencies} \
33
::vc::fossil::import::cvs::pass::csetdeps
34
35
# # ## ### ##### ######## ############# #####################
36
##
37
38
snit::type ::vc::fossil::import::cvs::pass::csetdeps {
39
# # ## ### ##### ######## #############
40
## Public API
41
42
typemethod setup {} {
43
# Define the names and structure of the persistent state of
44
# this pass.
45
46
state use project
47
state use file
48
state use revision
49
state use revisionbranchchildren
50
state use branch
51
state use tag
52
state use symbol
53
state use preferedparent
54
state use changeset
55
state use csitem
56
57
# A table listing for each changeset the set of successor
58
# changesets. The predecessor information is implied.
59
60
state extend cssuccessor {
61
cid INTEGER NOT NULL REFERENCES changeset,
62
nid INTEGER NOT NULL REFERENCES changeset,
63
UNIQUE (cid,nid)
64
} {cid nid}
65
# Index on both columns for fast forward and back retrieval.
66
return
67
}
68
69
typemethod load {} {
70
# Pass manager interface. Executed to load data computed by
71
# this pass into memory when this pass is skipped instead of
72
# executed.
73
74
state use cssuccessor
75
return
76
}
77
78
typemethod run {} {
79
# Pass manager interface. Executed to perform the
80
# functionality of the pass.
81
82
set n 0
83
set max [llength [project::rev all]]
84
85
foreach cset [project::rev all] {
86
log progress 2 csetdeps $n $max
87
# NOTE: Consider to commit only every N calls.
88
state transaction {
89
$cset determinesuccessors
90
}
91
incr n
92
}
93
return
94
}
95
96
typemethod discard {} {
97
# Pass manager interface. Executed for all passes after the
98
# run passes, to remove all data of this pass from the state,
99
# as being out of date.
100
101
state discard cssuccessor
102
return
103
}
104
105
# # ## ### ##### ######## #############
106
## Internal methods
107
108
# # ## ### ##### ######## #############
109
## Configuration
110
111
pragma -hasinstances no ; # singleton
112
pragma -hastypeinfo no ; # no introspection
113
pragma -hastypedestroy no ; # immortal
114
115
# # ## ### ##### ######## #############
116
}
117
118
namespace eval ::vc::fossil::import::cvs::pass {
119
namespace export csetdeps
120
namespace eval csetdeps {
121
namespace import ::vc::fossil::import::cvs::state
122
namespace eval project {
123
namespace import ::vc::fossil::import::cvs::project::rev
124
}
125
namespace import ::vc::tools::misc::*
126
namespace import ::vc::tools::log
127
log register csetdeps
128
}
129
}
130
131
# # ## ### ##### ######## ############# #####################
132
## Ready
133
134
package provide vc::fossil::import::cvs::pass::csetdeps 1.0
135
return
136

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button