|
fdbc01d…
|
aku
|
1 |
## -*- tcl -*- |
|
fdbc01d…
|
aku
|
2 |
# # ## ### ##### ######## ############# ##################### |
|
6b78df3…
|
drh
|
3 |
## Copyright (c) 2007-2008 Andreas Kupries. |
|
fdbc01d…
|
aku
|
4 |
# |
|
fdbc01d…
|
aku
|
5 |
# This software is licensed as described in the file LICENSE, which |
|
fdbc01d…
|
aku
|
6 |
# you should have received as part of this distribution. |
|
fdbc01d…
|
aku
|
7 |
# |
|
fdbc01d…
|
aku
|
8 |
# This software consists of voluntary contributions made by many |
|
fdbc01d…
|
aku
|
9 |
# individuals. For exact contribution history, see the revision |
|
fdbc01d…
|
aku
|
10 |
# history and logs, available at http://fossil-scm.hwaci.com/fossil |
|
fdbc01d…
|
aku
|
11 |
# # ## ### ##### ######## ############# ##################### |
|
fdbc01d…
|
aku
|
12 |
|
|
c3d5104…
|
aku
|
13 |
## Pass II. This pass parses the collected rcs archives and extracts |
|
fdbc01d…
|
aku
|
14 |
## all the information they contain (revisions, and symbols). |
|
fdbc01d…
|
aku
|
15 |
|
|
fdbc01d…
|
aku
|
16 |
# # ## ### ##### ######## ############# ##################### |
|
fdbc01d…
|
aku
|
17 |
## Requirements |
|
fdbc01d…
|
aku
|
18 |
|
|
f888f06…
|
aku
|
19 |
package require Tcl 8.4 ; # Required runtime. |
|
f888f06…
|
aku
|
20 |
package require snit ; # OO system. |
|
f888f06…
|
aku
|
21 |
package require vc::tools::trouble ; # Error reporting. |
|
f888f06…
|
aku
|
22 |
package require vc::tools::log ; # User feedback. |
|
f888f06…
|
aku
|
23 |
package require vc::fossil::import::cvs::pass ; # Pass management. |
|
f888f06…
|
aku
|
24 |
package require vc::fossil::import::cvs::repository ; # Repository management. |
|
f888f06…
|
aku
|
25 |
package require vc::fossil::import::cvs::state ; # State storage. |
|
131f051…
|
aku
|
26 |
package require vc::fossil::import::cvs::integrity ; # State integrity checks. |
|
e45f47e…
|
aku
|
27 |
package require vc::fossil::import::cvs::project::sym ; # Project level symbols. |
|
e45f47e…
|
aku
|
28 |
package require vc::fossil::import::cvs::file::rev ; # File level revisions. |
|
f888f06…
|
aku
|
29 |
package require vc::rcs::parser ; # Rcs archive data extraction. |
|
fdbc01d…
|
aku
|
30 |
|
|
fdbc01d…
|
aku
|
31 |
# # ## ### ##### ######## ############# ##################### |
|
fdbc01d…
|
aku
|
32 |
## Register the pass with the management |
|
fdbc01d…
|
aku
|
33 |
|
|
fdbc01d…
|
aku
|
34 |
vc::fossil::import::cvs::pass define \ |
|
fdbc01d…
|
aku
|
35 |
CollectRev \ |
|
fdbc01d…
|
aku
|
36 |
{Collect revisions and symbols} \ |
|
fdbc01d…
|
aku
|
37 |
::vc::fossil::import::cvs::pass::collrev |
|
fdbc01d…
|
aku
|
38 |
|
|
fdbc01d…
|
aku
|
39 |
# # ## ### ##### ######## ############# ##################### |
|
b679ca3…
|
aku
|
40 |
## |
|
fdbc01d…
|
aku
|
41 |
|
|
fdbc01d…
|
aku
|
42 |
snit::type ::vc::fossil::import::cvs::pass::collrev { |
|
fdbc01d…
|
aku
|
43 |
# # ## ### ##### ######## ############# |
|
fdbc01d…
|
aku
|
44 |
## Public API |
|
fdbc01d…
|
aku
|
45 |
|
|
fdbc01d…
|
aku
|
46 |
typemethod setup {} { |
|
fdbc01d…
|
aku
|
47 |
# Define names and structure of the persistent state of this |
|
fdbc01d…
|
aku
|
48 |
# pass. |
|
fdbc01d…
|
aku
|
49 |
|
|
e288af3…
|
aku
|
50 |
state use project |
|
e288af3…
|
aku
|
51 |
state use file |
|
fdbc01d…
|
aku
|
52 |
|
|
fdbc01d…
|
aku
|
53 |
# We deal with per project and per file data, the first |
|
fdbc01d…
|
aku
|
54 |
# collated from the second. |
|
fdbc01d…
|
aku
|
55 |
|
|
fdbc01d…
|
aku
|
56 |
# Per file we have general information, ..., and then |
|
fdbc01d…
|
aku
|
57 |
# revisions and symbols. The latter can be further separated |
|
fdbc01d…
|
aku
|
58 |
# into tags and branches. At project level the per-file |
|
fdbc01d…
|
aku
|
59 |
# symbols information is merged. |
|
fdbc01d…
|
aku
|
60 |
|
|
fdbc01d…
|
aku
|
61 |
# File level ... |
|
adf168e…
|
aku
|
62 |
# Revisions, Branches, Tags |
|
adf168e…
|
aku
|
63 |
# |
|
adf168e…
|
aku
|
64 |
# Pseudo class hierarchy |
|
adf168e…
|
aku
|
65 |
# Tag <- Symbol <- Event |
|
adf168e…
|
aku
|
66 |
# Branch <- Symbol <- Event |
|
adf168e…
|
aku
|
67 |
# Revision <- Event |
|
adf168e…
|
aku
|
68 |
|
|
e288af3…
|
aku
|
69 |
state extend revision { |
|
2c08006…
|
aku
|
70 |
-- Revisions. Identified by a global numeric id each |
|
2c08006…
|
aku
|
71 |
-- belongs to a single file, identified by its id. It |
|
2c08006…
|
aku
|
72 |
-- further has a dotted revision number (DTN). |
|
2c08006…
|
aku
|
73 |
-- |
|
2c08006…
|
aku
|
74 |
-- Constraint: The dotted revision number is unique within |
|
2c08006…
|
aku
|
75 |
-- the file. See end of definition. |
|
2c08006…
|
aku
|
76 |
|
|
adf168e…
|
aku
|
77 |
rid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
|
2c08006…
|
aku
|
78 |
fid INTEGER NOT NULL REFERENCES file, -- File owning revision. |
|
2c08006…
|
aku
|
79 |
rev TEXT NOT NULL, -- Dotted Rev Number. |
|
2c08006…
|
aku
|
80 |
|
|
2c08006…
|
aku
|
81 |
-- All revisions belong to a line-of-development, |
|
2c08006…
|
aku
|
82 |
-- identified by a symbol (project level). During data |
|
2c08006…
|
aku
|
83 |
-- collection it was a file-level branch symbol. |
|
2c08006…
|
aku
|
84 |
-- |
|
2c08006…
|
aku
|
85 |
-- Constraint: All the LOD symbols are in the same project |
|
2c08006…
|
aku
|
86 |
-- as the file itself. This cannot be |
|
2c08006…
|
aku
|
87 |
-- expressed in CREATE TABLE syntax. |
|
2c08006…
|
aku
|
88 |
|
|
2c08006…
|
aku
|
89 |
lod INTEGER NOT NULL REFERENCES symbol, -- Line of development |
|
2c08006…
|
aku
|
90 |
|
|
2c08006…
|
aku
|
91 |
-- The revisions in a file are organized in a forest of |
|
2c08006…
|
aku
|
92 |
-- trees, with the main lines defined through the parent / |
|
2c08006…
|
aku
|
93 |
-- child references. A revision without a parent is the |
|
2c08006…
|
aku
|
94 |
-- root of a tree, and a revision without a child is a |
|
2c08006…
|
aku
|
95 |
-- leaf. |
|
2c08006…
|
aku
|
96 |
|
|
2c08006…
|
aku
|
97 |
-- Constraints: All revisions coupled through parent/child |
|
2c08006…
|
aku
|
98 |
-- refer to the same LOD symbol. The parent |
|
2c08006…
|
aku
|
99 |
-- of a child of X is X. The child of a |
|
2c08006…
|
aku
|
100 |
-- parent of X is X. |
|
2c08006…
|
aku
|
101 |
|
|
2c08006…
|
aku
|
102 |
parent INTEGER REFERENCES revision, |
|
2c08006…
|
aku
|
103 |
child INTEGER REFERENCES revision, |
|
2c08006…
|
aku
|
104 |
|
|
2c08006…
|
aku
|
105 |
-- The representation of a branch in a tree is the |
|
2c08006…
|
aku
|
106 |
-- exception to the three constraints above. |
|
2c08006…
|
aku
|
107 |
|
|
2c08006…
|
aku
|
108 |
-- The beginning of a branch is represented by a non-NULL |
|
2c08006…
|
aku
|
109 |
-- bparent of a revision. This revision B is the first on |
|
2c08006…
|
aku
|
110 |
-- the branch. Its parent P is the revision the branch is |
|
2c08006…
|
aku
|
111 |
-- rooted in, and it is not the child of P. B and P refer |
|
2c08006…
|
aku
|
112 |
-- to different LOD symbols. The bparent of B is also its |
|
2c08006…
|
aku
|
113 |
-- LOD, and the LOD of its children. |
|
2c08006…
|
aku
|
114 |
|
|
2c08006…
|
aku
|
115 |
bparent INTEGER REFERENCES symbol, |
|
2c08006…
|
aku
|
116 |
|
|
2c08006…
|
aku
|
117 |
-- Lastly we keep information is about non-trunk default |
|
2c08006…
|
aku
|
118 |
-- branches (NTDB) in the revisions. |
|
2c08006…
|
aku
|
119 |
|
|
2c08006…
|
aku
|
120 |
-- All revisions on the NTDB have 'isdefault' TRUE, |
|
2c08006…
|
aku
|
121 |
-- everyone else FALSE. The last revision X on the NTDB |
|
2c08006…
|
aku
|
122 |
-- which is still considered to be on the trunk as well |
|
2c08006…
|
aku
|
123 |
-- has a non-NULL 'dbchild' which refers to the root of |
|
2c08006…
|
aku
|
124 |
-- the trunk. The root also has a non-NULL dbparent |
|
2c08006…
|
aku
|
125 |
-- refering to X. |
|
2c08006…
|
aku
|
126 |
|
|
2c08006…
|
aku
|
127 |
isdefault INTEGER NOT NULL, |
|
2c08006…
|
aku
|
128 |
dbparent INTEGER REFERENCES revision, |
|
2c08006…
|
aku
|
129 |
dbchild INTEGER REFERENCES revision, |
|
2c08006…
|
aku
|
130 |
|
|
2c08006…
|
aku
|
131 |
-- The main payload of the revision are the date/time it |
|
2c08006…
|
aku
|
132 |
-- was entered, its state, operation (= type/class), text |
|
2c08006…
|
aku
|
133 |
-- content, and meta data (author, log message, branch, |
|
2c08006…
|
aku
|
134 |
-- project). The last is encoded as single id, see table |
|
2c08006…
|
aku
|
135 |
-- 'meta'. The date/time is given in seconds since the |
|
3e76f2a…
|
aku
|
136 |
-- epoch, for easy comparison. |
|
2c08006…
|
aku
|
137 |
|
|
7ab490d…
|
aku
|
138 |
op INTEGER NOT NULL REFERENCES optype, |
|
2c08006…
|
aku
|
139 |
date INTEGER NOT NULL, |
|
2c08006…
|
aku
|
140 |
state TEXT NOT NULL, |
|
7ab490d…
|
aku
|
141 |
mid INTEGER NOT NULL REFERENCES meta, |
|
2c08006…
|
aku
|
142 |
|
|
2c08006…
|
aku
|
143 |
UNIQUE (fid, rev) -- The DTN is unique within the revision's file. |
|
2c08006…
|
aku
|
144 |
} |
|
aa04ac9…
|
aku
|
145 |
|
|
aa04ac9…
|
aku
|
146 |
# Blobs contain the information needed to extract revisions |
|
aa04ac9…
|
aku
|
147 |
# from rcs archive files. As such each revision has an |
|
aa04ac9…
|
aku
|
148 |
# associated blob. However we can have blobs without |
|
aa04ac9…
|
aku
|
149 |
# revisions. This happens if a logically irrelevant revision |
|
aa04ac9…
|
aku
|
150 |
# is removed. We may however still need its blob to correctly |
|
aa04ac9…
|
aku
|
151 |
# expand other revisions, both its contents and for the |
|
aa04ac9…
|
aku
|
152 |
# ordering. |
|
aa04ac9…
|
aku
|
153 |
|
|
aa04ac9…
|
aku
|
154 |
state extend blob { |
|
aa04ac9…
|
aku
|
155 |
bid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
|
aa04ac9…
|
aku
|
156 |
rid INTEGER REFERENCES revision, |
|
aa04ac9…
|
aku
|
157 |
fid INTEGER NOT NULL REFERENCES file, -- File owning blob. |
|
aa04ac9…
|
aku
|
158 |
|
|
aa04ac9…
|
aku
|
159 |
-- The text content is an (offset,length) pair into the |
|
aa04ac9…
|
aku
|
160 |
-- rcs archive. For deltas we additionally refer to the |
|
aa04ac9…
|
aku
|
161 |
-- parent blob the delta is made against. |
|
aa04ac9…
|
aku
|
162 |
|
|
aa04ac9…
|
aku
|
163 |
coff INTEGER NOT NULL, |
|
aa04ac9…
|
aku
|
164 |
clen INTEGER NOT NULL, |
|
aa04ac9…
|
aku
|
165 |
pid INTEGER REFERENCES blob, |
|
aa04ac9…
|
aku
|
166 |
|
|
aa04ac9…
|
aku
|
167 |
UNIQUE (rid) |
|
aa04ac9…
|
aku
|
168 |
} { fid } |
|
aa04ac9…
|
aku
|
169 |
# Index on owning file to collect all blobs of a file when the |
|
aa04ac9…
|
aku
|
170 |
# time for its expansion comes. |
|
e288af3…
|
aku
|
171 |
|
|
e288af3…
|
aku
|
172 |
state extend optype { |
|
7ab490d…
|
aku
|
173 |
oid INTEGER NOT NULL PRIMARY KEY, |
|
7ab490d…
|
aku
|
174 |
name TEXT NOT NULL, |
|
e45f47e…
|
aku
|
175 |
UNIQUE(name) |
|
7ab490d…
|
aku
|
176 |
} |
|
7ab490d…
|
aku
|
177 |
state run { |
|
e45f47e…
|
aku
|
178 |
INSERT INTO optype VALUES (-1,'delete'); -- The opcode names are the |
|
e45f47e…
|
aku
|
179 |
INSERT INTO optype VALUES ( 0,'nothing'); -- fixed pieces, see myopstate |
|
e45f47e…
|
aku
|
180 |
INSERT INTO optype VALUES ( 1,'add'); -- in file::rev. myopcode is |
|
e45f47e…
|
aku
|
181 |
INSERT INTO optype VALUES ( 2,'change'); -- loaded from this. |
|
e45f47e…
|
aku
|
182 |
} |
|
95af789…
|
aku
|
183 |
|
|
e288af3…
|
aku
|
184 |
state extend revisionbranchchildren { |
|
95af789…
|
aku
|
185 |
-- The non-primary children of a revision, as reachable |
|
95af789…
|
aku
|
186 |
-- through a branch symbol, are listed here. This is |
|
95af789…
|
aku
|
187 |
-- needed by pass 5 to break internal dependencies in a |
|
95af789…
|
aku
|
188 |
-- changeset. |
|
95af789…
|
aku
|
189 |
|
|
95af789…
|
aku
|
190 |
rid INTEGER NOT NULL REFERENCES revision, |
|
95af789…
|
aku
|
191 |
brid INTEGER NOT NULL REFERENCES revision, |
|
95af789…
|
aku
|
192 |
UNIQUE(rid,brid) |
|
95af789…
|
aku
|
193 |
} |
|
95af789…
|
aku
|
194 |
|
|
e288af3…
|
aku
|
195 |
state extend tag { |
|
adf168e…
|
aku
|
196 |
tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
|
adf168e…
|
aku
|
197 |
fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to |
|
adf168e…
|
aku
|
198 |
lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk) |
|
adf168e…
|
aku
|
199 |
sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the tag |
|
adf168e…
|
aku
|
200 |
|
|
adf168e…
|
aku
|
201 |
rev INTEGER NOT NULL REFERENCES revision -- The revision being tagged. |
|
74854a3…
|
aku
|
202 |
} { rev sid } |
|
74854a3…
|
aku
|
203 |
# Indices on: rev (revision successors) |
|
74854a3…
|
aku
|
204 |
# sid (tag predecessors, branch successors/predecessors) |
|
adf168e…
|
aku
|
205 |
|
|
e288af3…
|
aku
|
206 |
state extend branch { |
|
adf168e…
|
aku
|
207 |
bid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
|
adf168e…
|
aku
|
208 |
fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to |
|
adf168e…
|
aku
|
209 |
lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk) |
|
adf168e…
|
aku
|
210 |
sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the branch |
|
adf168e…
|
aku
|
211 |
|
|
79c227a…
|
aku
|
212 |
root INTEGER REFERENCES revision, -- Revision the branch sprouts from |
|
adf168e…
|
aku
|
213 |
first INTEGER REFERENCES revision, -- First revision committed to the branch |
|
7ab490d…
|
aku
|
214 |
bra TEXT NOT NULL, -- branch number |
|
7ab490d…
|
aku
|
215 |
pos INTEGER NOT NULL -- creation order in root. |
|
79c227a…
|
aku
|
216 |
|
|
79c227a…
|
aku
|
217 |
-- A branch can exist without root. It happens when the |
|
79c227a…
|
aku
|
218 |
-- only revision on trunk is the unnecessary dead one the |
|
79c227a…
|
aku
|
219 |
-- branch was sprouted from and it has commits. The branch |
|
79c227a…
|
aku
|
220 |
-- will exist to be the LOD of its revisions, nothing to |
|
79c227a…
|
aku
|
221 |
-- sprout from, the dead revision was removed, hence no |
|
79c227a…
|
aku
|
222 |
-- root. |
|
74854a3…
|
aku
|
223 |
} { root first sid } |
|
74854a3…
|
aku
|
224 |
# Indices on: root (revision successors) |
|
74854a3…
|
aku
|
225 |
# first (revision predecessors) |
|
74854a3…
|
aku
|
226 |
# sid (tag predecessors, branch successors/predecessors) |
|
fdbc01d…
|
aku
|
227 |
|
|
fdbc01d…
|
aku
|
228 |
# Project level ... |
|
fdbc01d…
|
aku
|
229 |
# pLineOfDevelopment, pSymbol, pBranch, pTag, pTrunk |
|
fdbc01d…
|
aku
|
230 |
# |
|
fdbc01d…
|
aku
|
231 |
# pTrunk <- pLineOfDevelopment |
|
fdbc01d…
|
aku
|
232 |
# pBranch <- pSymbol, pLineOfDevelopment |
|
fdbc01d…
|
aku
|
233 |
# pTag <- pSymbol, pLineOfDevelopment |
|
fdbc01d…
|
aku
|
234 |
|
|
e288af3…
|
aku
|
235 |
state extend symbol { |
|
fdbc01d…
|
aku
|
236 |
sid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
|
fdbc01d…
|
aku
|
237 |
pid INTEGER NOT NULL REFERENCES project, -- Project the symbol belongs to |
|
fdbc01d…
|
aku
|
238 |
name TEXT NOT NULL, |
|
c3d5104…
|
aku
|
239 |
type INTEGER NOT NULL REFERENCES symtype, -- enum { excluded = 0, tag, branch, undefined } |
|
fdbc01d…
|
aku
|
240 |
|
|
fdbc01d…
|
aku
|
241 |
tag_count INTEGER NOT NULL, -- How often the symbol is used as tag. |
|
fdbc01d…
|
aku
|
242 |
branch_count INTEGER NOT NULL, -- How often the symbol is used as branch |
|
fdbc01d…
|
aku
|
243 |
commit_count INTEGER NOT NULL, -- How often a file was committed on the symbol |
|
fdbc01d…
|
aku
|
244 |
|
|
fdbc01d…
|
aku
|
245 |
UNIQUE (pid, name) -- Symbols are unique within the project |
|
fdbc01d…
|
aku
|
246 |
} |
|
fdbc01d…
|
aku
|
247 |
|
|
e288af3…
|
aku
|
248 |
state extend blocker { |
|
6f8667b…
|
aku
|
249 |
-- For each symbol we save which other symbols are |
|
6f8667b…
|
aku
|
250 |
-- blocking its removal (if the user asks for it). |
|
6f8667b…
|
aku
|
251 |
|
|
b679ca3…
|
aku
|
252 |
sid INTEGER NOT NULL REFERENCES symbol, -- |
|
fdbc01d…
|
aku
|
253 |
bid INTEGER NOT NULL REFERENCES symbol, -- Sprouted from sid, blocks it. |
|
fdbc01d…
|
aku
|
254 |
UNIQUE (sid, bid) |
|
fdbc01d…
|
aku
|
255 |
} |
|
fdbc01d…
|
aku
|
256 |
|
|
e288af3…
|
aku
|
257 |
state extend parent { |
|
6f8667b…
|
aku
|
258 |
-- For each symbol we save which other symbols can act as |
|
6f8667b…
|
aku
|
259 |
-- a possible parent in some file, and how often. |
|
6f8667b…
|
aku
|
260 |
|
|
b679ca3…
|
aku
|
261 |
sid INTEGER NOT NULL REFERENCES symbol, -- |
|
fdbc01d…
|
aku
|
262 |
pid INTEGER NOT NULL REFERENCES symbol, -- Possible parent of sid |
|
6f8667b…
|
aku
|
263 |
n INTEGER NOT NULL, -- How often pid can act as parent. |
|
fdbc01d…
|
aku
|
264 |
UNIQUE (sid, pid) |
|
fdbc01d…
|
aku
|
265 |
} |
|
fdbc01d…
|
aku
|
266 |
|
|
e288af3…
|
aku
|
267 |
state extend symtype { |
|
f888f06…
|
aku
|
268 |
tid INTEGER NOT NULL PRIMARY KEY, |
|
f888f06…
|
aku
|
269 |
name TEXT NOT NULL, |
|
f888f06…
|
aku
|
270 |
plural TEXT NOT NULL, |
|
c3d5104…
|
aku
|
271 |
UNIQUE (name) |
|
f888f06…
|
aku
|
272 |
UNIQUE (plural) |
|
c3d5104…
|
aku
|
273 |
} |
|
c3d5104…
|
aku
|
274 |
state run { |
|
6809145…
|
aku
|
275 |
INSERT INTO symtype VALUES (0,'excluded', 'excluded'); -- The ids are the fixed |
|
6809145…
|
aku
|
276 |
INSERT INTO symtype VALUES (1,'tag', 'tags'); -- pieces, see project::sym, |
|
6809145…
|
aku
|
277 |
INSERT INTO symtype VALUES (2,'branch', 'branches'); -- getsymtypes and associated |
|
6809145…
|
aku
|
278 |
INSERT INTO symtype VALUES (3,'undefined','undefined'); -- typevariables. |
|
c3d5104…
|
aku
|
279 |
} |
|
c3d5104…
|
aku
|
280 |
|
|
e288af3…
|
aku
|
281 |
state extend meta { |
|
2c08006…
|
aku
|
282 |
-- Meta data of revisions. See revision.mid for the |
|
2c08006…
|
aku
|
283 |
-- reference. Many revisions can share meta data. This is |
|
2c08006…
|
aku
|
284 |
-- actually one of the criterions used to sort revisions |
|
2c08006…
|
aku
|
285 |
-- into changesets. |
|
2c08006…
|
aku
|
286 |
|
|
2c08006…
|
aku
|
287 |
mid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
|
2c08006…
|
aku
|
288 |
|
|
2c08006…
|
aku
|
289 |
-- Meta data belongs to a specific project, stronger, to a |
|
2c08006…
|
aku
|
290 |
-- branch in that project. It further has a log message, |
|
2c08006…
|
aku
|
291 |
-- and its author. This is unique with the project and |
|
2c08006…
|
aku
|
292 |
-- branch. |
|
2c08006…
|
aku
|
293 |
|
|
2c08006…
|
aku
|
294 |
pid INTEGER NOT NULL REFERENCES project, -- |
|
2c08006…
|
aku
|
295 |
bid INTEGER NOT NULL REFERENCES symbol, -- |
|
2c08006…
|
aku
|
296 |
aid INTEGER NOT NULL REFERENCES author, -- |
|
2c08006…
|
aku
|
297 |
cid INTEGER NOT NULL REFERENCES cmessage, -- |
|
2c08006…
|
aku
|
298 |
|
|
2c08006…
|
aku
|
299 |
UNIQUE (pid, bid, aid, cid) |
|
2c08006…
|
aku
|
300 |
|
|
2c08006…
|
aku
|
301 |
-- Constraints: The project of the meta data of a revision |
|
2c08006…
|
aku
|
302 |
-- X is the same as the project of X itself. |
|
2c08006…
|
aku
|
303 |
-- |
|
2c08006…
|
aku
|
304 |
-- ............ The branch of the meta data of a revision |
|
2c08006…
|
aku
|
305 |
-- X is the same as the line of development |
|
2c08006…
|
aku
|
306 |
-- of X itself. |
|
2c08006…
|
aku
|
307 |
} |
|
2c08006…
|
aku
|
308 |
|
|
2c08006…
|
aku
|
309 |
# Authors and commit messages are fully global, i.e. per |
|
2c08006…
|
aku
|
310 |
# repository. |
|
2c08006…
|
aku
|
311 |
|
|
e288af3…
|
aku
|
312 |
state extend author { |
|
6809145…
|
aku
|
313 |
aid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, -- Pool of the unique |
|
6809145…
|
aku
|
314 |
name TEXT NOT NULL UNIQUE -- author names. |
|
2c08006…
|
aku
|
315 |
} |
|
2c08006…
|
aku
|
316 |
|
|
e288af3…
|
aku
|
317 |
state extend cmessage { |
|
6809145…
|
aku
|
318 |
cid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, -- Pool of the unique |
|
6809145…
|
aku
|
319 |
text TEXT NOT NULL UNIQUE -- log messages |
|
2c08006…
|
aku
|
320 |
} |
|
2c08006…
|
aku
|
321 |
|
|
f888f06…
|
aku
|
322 |
project::sym getsymtypes |
|
e45f47e…
|
aku
|
323 |
file::rev getopcodes |
|
ae19c0f…
|
aku
|
324 |
return |
|
ae19c0f…
|
aku
|
325 |
} |
|
ae19c0f…
|
aku
|
326 |
|
|
ae19c0f…
|
aku
|
327 |
typemethod load {} { |
|
e288af3…
|
aku
|
328 |
state use symbol |
|
e288af3…
|
aku
|
329 |
state use symtype |
|
e288af3…
|
aku
|
330 |
state use optype |
|
c3d5104…
|
aku
|
331 |
|
|
f888f06…
|
aku
|
332 |
project::sym getsymtypes |
|
e45f47e…
|
aku
|
333 |
file::rev getopcodes |
|
f888f06…
|
aku
|
334 |
repository loadsymbols |
|
fdbc01d…
|
aku
|
335 |
return |
|
fdbc01d…
|
aku
|
336 |
} |
|
fdbc01d…
|
aku
|
337 |
|
|
fdbc01d…
|
aku
|
338 |
typemethod run {} { |
|
ae19c0f…
|
aku
|
339 |
# Pass manager interface. Executed to perform the |
|
ae19c0f…
|
aku
|
340 |
# functionality of the pass. |
|
ae19c0f…
|
aku
|
341 |
|
|
8a93ffa…
|
aku
|
342 |
set rbase [repository base?] |
|
8a93ffa…
|
aku
|
343 |
foreach project [repository projects] { |
|
7208c7a…
|
mjanssen
|
344 |
set base [::file join $rbase [$project base]] |
|
8a93ffa…
|
aku
|
345 |
log write 1 collrev "Processing $base" |
|
8a93ffa…
|
aku
|
346 |
|
|
8a93ffa…
|
aku
|
347 |
foreach file [$project files] { |
|
8a93ffa…
|
aku
|
348 |
set path [$file path] |
|
8a93ffa…
|
aku
|
349 |
log write 2 collrev "Parsing $path" |
|
be89123…
|
aku
|
350 |
if {[catch { |
|
7208c7a…
|
mjanssen
|
351 |
parser process [::file join $base $path] $file |
|
be89123…
|
aku
|
352 |
} msg]} { |
|
be89123…
|
aku
|
353 |
global errorCode |
|
be89123…
|
aku
|
354 |
if {$errorCode eq "vc::rcs::parser"} { |
|
be89123…
|
aku
|
355 |
trouble fatal "$path is not a valid RCS archive ($msg)" |
|
be89123…
|
aku
|
356 |
} else { |
|
be89123…
|
aku
|
357 |
global errorInfo |
|
be89123…
|
aku
|
358 |
trouble internal $errorInfo |
|
be89123…
|
aku
|
359 |
} |
|
adf168e…
|
aku
|
360 |
} else { |
|
adf168e…
|
aku
|
361 |
# We persist the core of the data collected about |
|
adf168e…
|
aku
|
362 |
# each file immediately after it has been parsed |
|
adf168e…
|
aku
|
363 |
# and wrangled into shape, and then drop it from |
|
adf168e…
|
aku
|
364 |
# memory. This is done to keep the amount of |
|
adf168e…
|
aku
|
365 |
# required memory within sensible limits. Without |
|
adf168e…
|
aku
|
366 |
# doing it this way we would easily gobble up 1G |
|
adf168e…
|
aku
|
367 |
# of RAM or more with all the objects (revisions |
|
adf168e…
|
aku
|
368 |
# and file-level symbols). |
|
adf168e…
|
aku
|
369 |
|
|
adf168e…
|
aku
|
370 |
$file persist |
|
be89123…
|
aku
|
371 |
} |
|
3a00ac5…
|
aku
|
372 |
|
|
3a00ac5…
|
aku
|
373 |
$file drop |
|
8a93ffa…
|
aku
|
374 |
} |
|
6f8667b…
|
aku
|
375 |
|
|
6f8667b…
|
aku
|
376 |
$project purgeghostsymbols |
|
8a93ffa…
|
aku
|
377 |
} |
|
8a93ffa…
|
aku
|
378 |
|
|
8a93ffa…
|
aku
|
379 |
repository persistrev |
|
96b7bfb…
|
aku
|
380 |
repository printrevstatistics |
|
131f051…
|
aku
|
381 |
integrity strict |
|
8a93ffa…
|
aku
|
382 |
|
|
fdbc01d…
|
aku
|
383 |
log write 1 collrev "Scan completed" |
|
ae19c0f…
|
aku
|
384 |
return |
|
ae19c0f…
|
aku
|
385 |
} |
|
ae19c0f…
|
aku
|
386 |
|
|
ae19c0f…
|
aku
|
387 |
typemethod discard {} { |
|
ae19c0f…
|
aku
|
388 |
# Pass manager interface. Executed for all passes after the |
|
ae19c0f…
|
aku
|
389 |
# run passes, to remove all data of this pass from the state, |
|
ae19c0f…
|
aku
|
390 |
# as being out of date. |
|
ae19c0f…
|
aku
|
391 |
|
|
ae19c0f…
|
aku
|
392 |
state discard revision |
|
ae19c0f…
|
aku
|
393 |
state discard tag |
|
ae19c0f…
|
aku
|
394 |
state discard branch |
|
ae19c0f…
|
aku
|
395 |
state discard symbol |
|
ae19c0f…
|
aku
|
396 |
state discard blocker |
|
ae19c0f…
|
aku
|
397 |
state discard parent |
|
c3d5104…
|
aku
|
398 |
state discard symtype |
|
ae19c0f…
|
aku
|
399 |
state discard meta |
|
ae19c0f…
|
aku
|
400 |
state discard author |
|
ae19c0f…
|
aku
|
401 |
state discard cmessage |
|
2434ad3…
|
aku
|
402 |
return |
|
2434ad3…
|
aku
|
403 |
} |
|
2434ad3…
|
aku
|
404 |
|
|
808fbc4…
|
aku
|
405 |
# TODO: Move this code to the integrity module |
|
2434ad3…
|
aku
|
406 |
proc Paranoia {} { |
|
2434ad3…
|
aku
|
407 |
# This code performs a number of paranoid checks of the |
|
6f8667b…
|
aku
|
408 |
# database, searching for inconsistent cross-references. |
|
2434ad3…
|
aku
|
409 |
log write 4 collrev {Check database consistency} |
|
2434ad3…
|
aku
|
410 |
|
|
831e8f3…
|
aku
|
411 |
set n 0 ; # Counter for the checks (we print an id before the |
|
831e8f3…
|
aku
|
412 |
# main label). |
|
2434ad3…
|
aku
|
413 |
|
|
2434ad3…
|
aku
|
414 |
# Find all revisions which disagree with their line of |
|
2434ad3…
|
aku
|
415 |
# development about the project they are owned by. |
|
2434ad3…
|
aku
|
416 |
Check \ |
|
2434ad3…
|
aku
|
417 |
{Revisions and their LODs have to be in the same project} \ |
|
2434ad3…
|
aku
|
418 |
{disagrees with its LOD about owning project} { |
|
2434ad3…
|
aku
|
419 |
SELECT F.name, R.rev |
|
808fbc4…
|
aku
|
420 |
FROM revision R, file F, symbol S |
|
808fbc4…
|
aku
|
421 |
WHERE R.fid = F.fid -- Get file of revision |
|
808fbc4…
|
aku
|
422 |
AND R.lod = S.sid -- Get symbol for revision's LOD |
|
808fbc4…
|
aku
|
423 |
AND F.pid != S.pid -- but symbol is for a different project |
|
2434ad3…
|
aku
|
424 |
; |
|
2434ad3…
|
aku
|
425 |
} |
|
2434ad3…
|
aku
|
426 |
# Find all revisions which disgree with their meta data about |
|
2434ad3…
|
aku
|
427 |
# the project they are owned by. |
|
2434ad3…
|
aku
|
428 |
Check \ |
|
2434ad3…
|
aku
|
429 |
{Revisions and their meta data have to be in the same project} \ |
|
2434ad3…
|
aku
|
430 |
{disagrees with its meta data about owning project} { |
|
2434ad3…
|
aku
|
431 |
SELECT F.name, R.rev |
|
808fbc4…
|
aku
|
432 |
FROM revision R, file F, meta M |
|
808fbc4…
|
aku
|
433 |
WHERE R.fid = F.fid -- Get file of revision |
|
808fbc4…
|
aku
|
434 |
AND R.mid = M.mid -- Get meta data of revision |
|
808fbc4…
|
aku
|
435 |
AND F.pid != M.pid -- but is for a different project |
|
2434ad3…
|
aku
|
436 |
; |
|
2434ad3…
|
aku
|
437 |
} |
|
2434ad3…
|
aku
|
438 |
# Find all revisions which disgree with their meta data about |
|
2434ad3…
|
aku
|
439 |
# the branch/line of development they belong to. |
|
2434ad3…
|
aku
|
440 |
Check \ |
|
2434ad3…
|
aku
|
441 |
{Revisions and their meta data have to be in the same LOD} \ |
|
2434ad3…
|
aku
|
442 |
{disagrees with its meta data about owning LOD} { |
|
2434ad3…
|
aku
|
443 |
SELECT F.name, R.rev |
|
808fbc4…
|
aku
|
444 |
FROM revision R, meta M, file F |
|
808fbc4…
|
aku
|
445 |
WHERE R.mid = M.mid -- Get meta data of revision |
|
808fbc4…
|
aku
|
446 |
AND R.lod != M.bid -- but is for a different LOD |
|
808fbc4…
|
aku
|
447 |
AND R.fid = F.fid -- Get file of revision |
|
70d4a81…
|
aku
|
448 |
; |
|
70d4a81…
|
aku
|
449 |
} |
|
70d4a81…
|
aku
|
450 |
# Find all revisions with a primary child which disagrees |
|
70d4a81…
|
aku
|
451 |
# about the file they belong to. |
|
70d4a81…
|
aku
|
452 |
Check \ |
|
70d4a81…
|
aku
|
453 |
{Revisions and their primary children have to be in the same file} \ |
|
70d4a81…
|
aku
|
454 |
{disagrees with its primary child about the owning file} { |
|
70d4a81…
|
aku
|
455 |
SELECT F.name, R.rev |
|
808fbc4…
|
aku
|
456 |
FROM revision R, revision C, file F |
|
808fbc4…
|
aku
|
457 |
WHERE R.fid = F.fid -- Get file of revision |
|
808fbc4…
|
aku
|
458 |
AND R.child IS NOT NULL -- Restrict to non-leaf revisions |
|
808fbc4…
|
aku
|
459 |
AND R.child = C.rid -- Get child (has to exist) |
|
808fbc4…
|
aku
|
460 |
AND C.fid != R.fid -- Whic wrongly is in a different file |
|
70d4a81…
|
aku
|
461 |
; |
|
70d4a81…
|
aku
|
462 |
} |
|
70d4a81…
|
aku
|
463 |
|
|
70d4a81…
|
aku
|
464 |
# Find all revisions with a branch parent symbol whose parent |
|
70d4a81…
|
aku
|
465 |
# disagrees about the file they belong to. |
|
70d4a81…
|
aku
|
466 |
Check \ |
|
70d4a81…
|
aku
|
467 |
{Revisions and their branch children have to be in the same file} \ |
|
70d4a81…
|
aku
|
468 |
{at the beginning of its branch and its parent disagree about the owning file} { |
|
70d4a81…
|
aku
|
469 |
SELECT F.name, R.rev |
|
808fbc4…
|
aku
|
470 |
FROM revision R, revision P, file F |
|
808fbc4…
|
aku
|
471 |
WHERE R.fid = F.fid -- Get file of revision |
|
808fbc4…
|
aku
|
472 |
AND R.bparent IS NOT NULL -- Restrict to first on branch |
|
808fbc4…
|
aku
|
473 |
AND R.parent = P.rid -- Get out-of-branch parent |
|
808fbc4…
|
aku
|
474 |
AND R.fid != P.fid -- Which wrongly is in a different file |
|
2434ad3…
|
aku
|
475 |
; |
|
2434ad3…
|
aku
|
476 |
} |
|
2434ad3…
|
aku
|
477 |
# Find all revisions with a non-NTDB child which disagrees |
|
2434ad3…
|
aku
|
478 |
# about the file they belong to. |
|
2434ad3…
|
aku
|
479 |
Check \ |
|
2434ad3…
|
aku
|
480 |
{Revisions and their non-NTDB children have to be in the same file} \ |
|
2434ad3…
|
aku
|
481 |
{disagrees with its non-NTDB child about the owning file} { |
|
2434ad3…
|
aku
|
482 |
SELECT F.name, R.rev |
|
808fbc4…
|
aku
|
483 |
FROM revision R, revision C, file F |
|
808fbc4…
|
aku
|
484 |
WHERE R.fid = F.fid -- Get file of revision |
|
808fbc4…
|
aku
|
485 |
AND R.dbchild IS NOT NULL -- Restrict to semi-last NTDB revision |
|
808fbc4…
|
aku
|
486 |
AND R.dbchild = C.rid -- Got to associated trunk revision |
|
808fbc4…
|
aku
|
487 |
AND C.fid != R.fid -- Which wrongly is in a different file |
|
70d4a81…
|
aku
|
488 |
; |
|
70d4a81…
|
aku
|
489 |
} |
|
70d4a81…
|
aku
|
490 |
# Find all revisions which have a primary child, but the child |
|
70d4a81…
|
aku
|
491 |
# does not have them as parent. |
|
70d4a81…
|
aku
|
492 |
Check \ |
|
70d4a81…
|
aku
|
493 |
{Revisions have to be parents of their primary children} \ |
|
70d4a81…
|
aku
|
494 |
{is not the parent of its primary child} { |
|
70d4a81…
|
aku
|
495 |
SELECT F.name, R.rev |
|
808fbc4…
|
aku
|
496 |
FROM revision R, revision C, file F |
|
808fbc4…
|
aku
|
497 |
WHERE R.fid = F.fid -- Get file of revision |
|
808fbc4…
|
aku
|
498 |
AND R.child IS NOT NULL -- Restrict to non-leaves |
|
808fbc4…
|
aku
|
499 |
AND R.child = C.rid -- Get the child (has to exist) |
|
808fbc4…
|
aku
|
500 |
AND C.parent != R.rid -- Which does not have us as its parent. |
|
70d4a81…
|
aku
|
501 |
; |
|
70d4a81…
|
aku
|
502 |
} |
|
70d4a81…
|
aku
|
503 |
# Find all revisions which have a primrary child, but the |
|
70d4a81…
|
aku
|
504 |
# child has a branch parent symbol making them brach starters. |
|
70d4a81…
|
aku
|
505 |
Check \ |
|
70d4a81…
|
aku
|
506 |
{Primary children of revisions must not start branches} \ |
|
70d4a81…
|
aku
|
507 |
{is parent of a primary child which is the beginning of a branch} { |
|
70d4a81…
|
aku
|
508 |
SELECT F.name, R.rev |
|
808fbc4…
|
aku
|
509 |
FROM revision R, revision C, file F |
|
808fbc4…
|
aku
|
510 |
WHERE R.fid = F.fid -- Get file of revision |
|
808fbc4…
|
aku
|
511 |
AND R.child IS NOT NULL -- Restrict to non-leaves |
|
808fbc4…
|
aku
|
512 |
AND R.child = C.rid -- Get the child (has to exist) |
|
808fbc4…
|
aku
|
513 |
AND C.bparent IS NOT NULL -- wrongly claiming to be first on branch |
|
70d4a81…
|
aku
|
514 |
; |
|
70d4a81…
|
aku
|
515 |
} |
|
70d4a81…
|
aku
|
516 |
# Find all revisions without branch parent symbol which have a |
|
70d4a81…
|
aku
|
517 |
# parent, but the parent does not have them as primary child. |
|
70d4a81…
|
aku
|
518 |
Check \ |
|
70d4a81…
|
aku
|
519 |
{Revisions have to be primary children of their parents, if any} \ |
|
2434ad3…
|
aku
|
520 |
{is not the child of its parent} { |
|
2434ad3…
|
aku
|
521 |
SELECT F.name, R.rev |
|
808fbc4…
|
aku
|
522 |
FROM revision R, revision P, file F |
|
808fbc4…
|
aku
|
523 |
WHERE R.fid = F.fid |
|
808fbc4…
|
aku
|
524 |
AND R.bparent IS NULL -- Get file of revision |
|
808fbc4…
|
aku
|
525 |
AND R.parent IS NOT NULL -- Restrict to everything not first on a branch |
|
808fbc4…
|
aku
|
526 |
AND R.parent = P.rid -- Get the parent (has to exist) |
|
808fbc4…
|
aku
|
527 |
AND P.child != R.rid -- Which do not have us as their child |
|
2434ad3…
|
aku
|
528 |
; |
|
2434ad3…
|
aku
|
529 |
} |
|
70d4a81…
|
aku
|
530 |
# Find all revisions with a branch parent symbol which do not |
|
70d4a81…
|
aku
|
531 |
# have a parent. |
|
2434ad3…
|
aku
|
532 |
Check \ |
|
2434ad3…
|
aku
|
533 |
{Branch starting revisions have to have a parent} \ |
|
2434ad3…
|
aku
|
534 |
{at the beginning of its branch has no parent} { |
|
2434ad3…
|
aku
|
535 |
SELECT F.name, R.rev |
|
808fbc4…
|
aku
|
536 |
FROM revision R, file F |
|
808fbc4…
|
aku
|
537 |
WHERE R.fid = F.fid -- Get file of revision |
|
808fbc4…
|
aku
|
538 |
AND R.bparent IS NOT NULL -- Restrict to first on a branch |
|
808fbc4…
|
aku
|
539 |
AND R.parent IS NULL -- But there is no out-of-branch parent |
|
70d4a81…
|
aku
|
540 |
; |
|
70d4a81…
|
aku
|
541 |
} |
|
70d4a81…
|
aku
|
542 |
# Find all revisions with a branch parent symbol whose parent |
|
70d4a81…
|
aku
|
543 |
# has them as primary child. |
|
70d4a81…
|
aku
|
544 |
Check \ |
|
70d4a81…
|
aku
|
545 |
{Branch starting revisions must not be primary children of their parents} \ |
|
70d4a81…
|
aku
|
546 |
{at the beginning of its branch is the primary child of its parent} { |
|
70d4a81…
|
aku
|
547 |
SELECT F.name, R.rev |
|
808fbc4…
|
aku
|
548 |
FROM revision R, revision P, file F |
|
808fbc4…
|
aku
|
549 |
WHERE R.fid = F.fid -- Get file of revision |
|
808fbc4…
|
aku
|
550 |
AND R.bparent IS NOT NULL -- Restrict to first on a branch |
|
808fbc4…
|
aku
|
551 |
AND R.parent IS NOT NULL -- Which are not detached |
|
808fbc4…
|
aku
|
552 |
AND R.parent = P.rid -- Get their non-branch parent |
|
808fbc4…
|
aku
|
553 |
AND P.child = R.rid -- which improperly has them as primary child |
|
2434ad3…
|
aku
|
554 |
; |
|
2434ad3…
|
aku
|
555 |
} |
|
2434ad3…
|
aku
|
556 |
# Find all revisions with a non-NTDB child which are not on |
|
2434ad3…
|
aku
|
557 |
# the NTDB. |
|
2434ad3…
|
aku
|
558 |
Check \ |
|
2434ad3…
|
aku
|
559 |
{NTDB to trunk transition has to begin on NTDB} \ |
|
2434ad3…
|
aku
|
560 |
{has a non-NTDB child, yet is not on the NTDB} { |
|
2434ad3…
|
aku
|
561 |
SELECT F.name, R.rev |
|
808fbc4…
|
aku
|
562 |
FROM revision R, file F |
|
808fbc4…
|
aku
|
563 |
WHERE R.fid = F.fid -- Get file of revision |
|
808fbc4…
|
aku
|
564 |
AND R.dbchild IS NOT NULL -- Restrict to semi-last NTDB revision |
|
808fbc4…
|
aku
|
565 |
AND NOT R.isdefault -- Improperly claiming to not be on NTDB |
|
2434ad3…
|
aku
|
566 |
; |
|
2434ad3…
|
aku
|
567 |
} |
|
2434ad3…
|
aku
|
568 |
# Find all revisions with a NTDB parent which are on the NTDB. |
|
2434ad3…
|
aku
|
569 |
Check \ |
|
2434ad3…
|
aku
|
570 |
{NTDB to trunk transition has to end on non-NTDB} \ |
|
2434ad3…
|
aku
|
571 |
{has a NTDB parent, yet is on the NTDB} { |
|
2434ad3…
|
aku
|
572 |
SELECT F.name, R.rev |
|
808fbc4…
|
aku
|
573 |
FROM revision R, file F |
|
808fbc4…
|
aku
|
574 |
WHERE R.fid = F.fid -- Get file of revision |
|
808fbc4…
|
aku
|
575 |
AND R.dbparent IS NOT NULL -- Restrict to trunk roots with NTDB around |
|
808fbc4…
|
aku
|
576 |
AND R.isdefault -- But root improperly claims to be on NTDB |
|
2434ad3…
|
aku
|
577 |
; |
|
2434ad3…
|
aku
|
578 |
} |
|
2434ad3…
|
aku
|
579 |
# Find all revisions with a child which disagrees about the |
|
2434ad3…
|
aku
|
580 |
# line of development they belong to. |
|
2434ad3…
|
aku
|
581 |
Check \ |
|
70d4a81…
|
aku
|
582 |
{Revisions and their primary children have to be in the same LOD} \ |
|
70d4a81…
|
aku
|
583 |
{and its primary child disagree about their LOD} { |
|
2434ad3…
|
aku
|
584 |
SELECT F.name, R.rev |
|
808fbc4…
|
aku
|
585 |
FROM revision R, revision C, file F |
|
808fbc4…
|
aku
|
586 |
WHERE R.fid = F.fid -- Get file of revision |
|
808fbc4…
|
aku
|
587 |
AND R.child IS NOT NULL -- Restrict to non-leaves |
|
808fbc4…
|
aku
|
588 |
AND R.child = C.rid -- Get child (has to exist) |
|
808fbc4…
|
aku
|
589 |
AND C.lod != R.lod -- which improperly uses a different LOD |
|
2434ad3…
|
aku
|
590 |
; |
|
2434ad3…
|
aku
|
591 |
} |
|
2434ad3…
|
aku
|
592 |
# Find all revisions with a non-NTDB child which agrees about |
|
2434ad3…
|
aku
|
593 |
# the line of development they belong to. |
|
2434ad3…
|
aku
|
594 |
Check \ |
|
2434ad3…
|
aku
|
595 |
{NTDB and trunk revisions have to be in different LODs} \ |
|
2434ad3…
|
aku
|
596 |
{on NTDB and its non-NTDB child wrongly agree about their LOD} { |
|
70d4a81…
|
aku
|
597 |
SELECT F.name, R.rev |
|
808fbc4…
|
aku
|
598 |
FROM revision R, revision C, file F |
|
808fbc4…
|
aku
|
599 |
WHERE R.fid = F.fid -- Get file of revision |
|
808fbc4…
|
aku
|
600 |
AND R.dbchild IS NOT NULL -- Restrict to semi-last NTDB revision |
|
808fbc4…
|
aku
|
601 |
AND R.dbchild = C.rid -- Get associated trunk root revision |
|
808fbc4…
|
aku
|
602 |
AND C.lod = R.lod -- Improperly uses the same LOD |
|
70d4a81…
|
aku
|
603 |
; |
|
70d4a81…
|
aku
|
604 |
} |
|
70d4a81…
|
aku
|
605 |
# Find all revisions with a branch parent symbol which is not |
|
70d4a81…
|
aku
|
606 |
# their LOD. |
|
70d4a81…
|
aku
|
607 |
Check \ |
|
70d4a81…
|
aku
|
608 |
{Branch starting revisions have to have their LOD as branch parent symbol} \ |
|
70d4a81…
|
aku
|
609 |
{at the beginning of its branch does not have the branch symbol as its LOD} { |
|
70d4a81…
|
aku
|
610 |
SELECT F.name, R.rev |
|
808fbc4…
|
aku
|
611 |
FROM revision R, file F |
|
808fbc4…
|
aku
|
612 |
WHERE R.fid = F.fid -- Get file of revision |
|
808fbc4…
|
aku
|
613 |
AND R.bparent IS NOT NULL -- Restrict to revisions first on a branch |
|
808fbc4…
|
aku
|
614 |
AND R.lod != R.bparent -- and their branch is not their LOD |
|
70d4a81…
|
aku
|
615 |
; |
|
70d4a81…
|
aku
|
616 |
} |
|
70d4a81…
|
aku
|
617 |
# Find all revisions with a branch parent symbol whose parent |
|
70d4a81…
|
aku
|
618 |
# is in the same line of development. |
|
2434ad3…
|
aku
|
619 |
Check \ |
|
2434ad3…
|
aku
|
620 |
{Revisions and their branch children have to be in different LODs} \ |
|
2434ad3…
|
aku
|
621 |
{at the beginning of its branch and its parent wrongly agree about their LOD} { |
|
2434ad3…
|
aku
|
622 |
SELECT F.name, R.rev |
|
808fbc4…
|
aku
|
623 |
FROM revision R, revision P, file F |
|
808fbc4…
|
aku
|
624 |
WHERE R.fid = F.fid -- Get file of revision |
|
808fbc4…
|
aku
|
625 |
AND R.bparent IS NOT NULL -- Restrict to revisions first on a branch |
|
808fbc4…
|
aku
|
626 |
AND R.parent = P.rid -- Get their non-branch parent |
|
808fbc4…
|
aku
|
627 |
AND R.lod = P.lod -- Which improperly uses the same LOD |
|
2434ad3…
|
aku
|
628 |
; |
|
2434ad3…
|
aku
|
629 |
} |
|
2434ad3…
|
aku
|
630 |
return |
|
2434ad3…
|
aku
|
631 |
} |
|
2434ad3…
|
aku
|
632 |
|
|
2434ad3…
|
aku
|
633 |
proc Check {header label sql} { |
|
2434ad3…
|
aku
|
634 |
upvar 1 n n |
|
2434ad3…
|
aku
|
635 |
set ok 1 |
|
2434ad3…
|
aku
|
636 |
foreach {fname revnr} [state run $sql] { |
|
2434ad3…
|
aku
|
637 |
set ok 0 |
|
2434ad3…
|
aku
|
638 |
trouble fatal "$fname <$revnr> $label" |
|
2434ad3…
|
aku
|
639 |
} |
|
2434ad3…
|
aku
|
640 |
log write 5 collrev "\[[format %02d [incr n]]\] [expr {$ok ? "Ok " : "Failed"}] ... $header" |
|
fdbc01d…
|
aku
|
641 |
return |
|
fdbc01d…
|
aku
|
642 |
} |
|
fdbc01d…
|
aku
|
643 |
|
|
fdbc01d…
|
aku
|
644 |
# # ## ### ##### ######## ############# |
|
fdbc01d…
|
aku
|
645 |
## Internal methods |
|
fdbc01d…
|
aku
|
646 |
|
|
fdbc01d…
|
aku
|
647 |
# # ## ### ##### ######## ############# |
|
fdbc01d…
|
aku
|
648 |
## Configuration |
|
fdbc01d…
|
aku
|
649 |
|
|
fdbc01d…
|
aku
|
650 |
pragma -hasinstances no ; # singleton |
|
fdbc01d…
|
aku
|
651 |
pragma -hastypeinfo no ; # no introspection |
|
fdbc01d…
|
aku
|
652 |
pragma -hastypedestroy no ; # immortal |
|
fdbc01d…
|
aku
|
653 |
|
|
fdbc01d…
|
aku
|
654 |
# # ## ### ##### ######## ############# |
|
fdbc01d…
|
aku
|
655 |
} |
|
fdbc01d…
|
aku
|
656 |
|
|
fdbc01d…
|
aku
|
657 |
namespace eval ::vc::fossil::import::cvs::pass { |
|
fdbc01d…
|
aku
|
658 |
namespace export collrev |
|
fdbc01d…
|
aku
|
659 |
namespace eval collrev { |
|
ec05316…
|
aku
|
660 |
namespace import ::vc::rcs::parser |
|
fdbc01d…
|
aku
|
661 |
namespace import ::vc::fossil::import::cvs::repository |
|
fdbc01d…
|
aku
|
662 |
namespace import ::vc::fossil::import::cvs::state |
|
131f051…
|
aku
|
663 |
namespace import ::vc::fossil::import::cvs::integrity |
|
f888f06…
|
aku
|
664 |
namespace eval project { |
|
f888f06…
|
aku
|
665 |
namespace import ::vc::fossil::import::cvs::project::sym |
|
e45f47e…
|
aku
|
666 |
} |
|
e45f47e…
|
aku
|
667 |
namespace eval file { |
|
e45f47e…
|
aku
|
668 |
namespace import ::vc::fossil::import::cvs::file::rev |
|
f888f06…
|
aku
|
669 |
} |
|
fdbc01d…
|
aku
|
670 |
namespace import ::vc::tools::trouble |
|
fdbc01d…
|
aku
|
671 |
namespace import ::vc::tools::log |
|
fdbc01d…
|
aku
|
672 |
log register collrev |
|
fdbc01d…
|
aku
|
673 |
} |
|
fdbc01d…
|
aku
|
674 |
} |
|
fdbc01d…
|
aku
|
675 |
|
|
fdbc01d…
|
aku
|
676 |
# # ## ### ##### ######## ############# ##################### |
|
fdbc01d…
|
aku
|
677 |
## Ready |
|
fdbc01d…
|
aku
|
678 |
|
|
fdbc01d…
|
aku
|
679 |
package provide vc::fossil::import::cvs::pass::collrev 1.0 |
|
fdbc01d…
|
aku
|
680 |
return |