Fossil

Check-in [215d2f1a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Brought knowledge of the new types to the state definition, changed the creation of the initial changesets to use tags and branches.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:215d2f1ad99b8705e7fe961fa169cf76430c7864
User & Date: aku 2007-11-29 06:21:57
Context
2007-11-29
06:23
Updated the code printing the changeset statistics to know about change to the changeset types. check-in: 8e301242 user: aku tags: trunk
06:21
Brought knowledge of the new types to the state definition, changed the creation of the initial changesets to use tags and branches. check-in: 215d2f1a user: aku tags: trunk
06:10
Integrate the new singletons with the main class, route the relevant places to them. check-in: c74fe3de user: aku tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tools/cvs2fossil/lib/c2f_pinitcsets.tcl.

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86




87
88
89
90
91
92
93
94
95
96
97
98
...
101
102
103
104
105
106
107




108
109
110
111
112
113
114
...
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
...
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
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
	    src   INTEGER  NOT NULL -- REFERENCES meta|symbol (type dependent)
	}
	state writing cstype {
	    tid   INTEGER  NOT NULL  PRIMARY KEY  AUTOINCREMENT,
	    name  TEXT     NOT NULL,
	    UNIQUE (name)
	}
	state run {
	    INSERT INTO cstype VALUES (0,'rev');
	    INSERT INTO cstype VALUES (1,'sym');
	}

	# Map from changesets to the (file level) revisions they
	# contain. The pos'ition provides an order of the revisions
	# within a changeset. They are unique within the changeset.
	# The revisions are in principle unique, if we were looking
	# only at revision changesets. However a revision can appear
	# in both revision and symbol changesets, and in multiple
	# symbol changesets as well. So we can only say that it is
	# unique within the changeset.
	#
	# TODO: Check if integrity checks are possible.





	state writing csrevision {
	    cid  INTEGER  NOT NULL  REFERENCES changeset,
	    pos  INTEGER  NOT NULL,
	    rid  INTEGER  NOT NULL  REFERENCES revision,
	    UNIQUE (cid, pos),
	    UNIQUE (cid, rid)
	}

	project::rev getcstypes
	return
    }
................................................................................
	# Pass manager interface. Executed to load data computed by
	# this pass into memory when this pass is skipped instead of
	# executed.

	state reading changeset
	state reading csrevision
	state reading cstype





	foreach {id pid cstype srcid} [state run {
	    SELECT C.cid, C.pid, CS.name, C.src
	    FROM   changeset C, cstype CS
	    WHERE  C.type = CS.tid
	    ORDER BY C.cid
	}] {
................................................................................
		SELECT C.rid
		FROM   csrevision C
		WHERE  C.cid = $id
		ORDER  BY C.pos
	    }] $id]
	}

	project::rev getcstypes
	project::rev loadcounter
	return
    }

    typemethod run {} {
	# Pass manager interface. Executed to perform the
	# functionality of the pass.
................................................................................

	set n 0

	# First process the tags, then the branches. We know that
	# their ids do not overlap with each other.

	set lastsymbol  {}
	set lastlod     {}
	set lastproject {}
	set revisions   {}

	foreach {sid rid lod pid} [state run {
	    SELECT S.sid, R.rid, R.lod, S.pid
	    FROM  tag T, revision R, symbol S     -- T ==> R/S, using PK indices of R, S.
	    WHERE T.rev = R.rid
	    AND   T.sid = S.sid
	    ORDER BY S.sid, R.lod, R.date
	}] {
	    if {($lastlod != $lod) || ($lastsymbol != $sid)} {
		if {[llength $revisions]} {
		    incr n
		    set  p [repository projectof $lastproject]
		    project::rev %AUTO% $p sym $lastsymbol $revisions
		    set revisions {}
		}
		set lastsymbol  $sid
		set lastlod     $lod
		set lastproject $pid
	    }
	    lappend revisions $rid
	}

	if {[llength $revisions]} {
	    incr n
	    set  p [repository projectof $lastproject]
	    project::rev %AUTO% $p sym $lastsymbol $revisions
	}

	set lastsymbol {}
	set lastlod    {}
	set lasproject {}
	set revisions  {}

	foreach {sid rid lod pid} [state run {
	    SELECT S.sid, R.rid, R.lod, S.pid
	    FROM  branch B, revision R, symbol S  -- B ==> R/S, using PK indices of R, S.
	    WHERE B.root = R.rid
	    AND   B.sid  = S.sid
	    ORDER BY S.sid, R.lod, R.date
	}] {
	    if {($lastlod != $lod) || ($lastsymbol != $sid)} {
		if {[llength $revisions]} {
		    incr n
		    set  p [repository projectof $lastproject]
		    project::rev %AUTO% $p sym $lastsymbol $revisions
		    set revisions {}
		}
		set lastsymbol  $sid
		set lastlod     $lod
		set lastproject $pid
	    }
	    lappend revisions $rid
	}

	if {[llength $revisions]} {
	    incr n
	    set  p [repository projectof $lastproject]
	    project::rev %AUTO% $p sym $lastsymbol $revisions
	}

	log write 4 initcsets "Created [nsp $n {symbol changeset}]"
	return
    }

    proc BreakInternalDependencies {} {







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
>




|







 







>
>
>
>







 







<







 







<



|
|
|
<
|
|

|



|



<








|



<



|
|
|
<
|
|

|



|



<








|







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
...
124
125
126
127
128
129
130

131
132
133
134
135
136
137
...
230
231
232
233
234
235
236

237
238
239
240
241
242

243
244
245
246
247
248
249
250
251
252
253

254
255
256
257
258
259
260
261
262
263
264
265

266
267
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
	    src   INTEGER  NOT NULL -- REFERENCES meta|symbol (type dependent)
	}
	state writing cstype {
	    tid   INTEGER  NOT NULL  PRIMARY KEY  AUTOINCREMENT,
	    name  TEXT     NOT NULL,
	    UNIQUE (name)
	}
	# Note: Keep the labels used here in sync with the names for
	#       singleton helper classes for 'project::rev'. They are
	#       the valid type names for changesets and also hardwired
	#       in some code.
	state run {
	    INSERT INTO cstype VALUES (0,'rev');
	    INSERT INTO cstype VALUES (1,'sym::tag');
	    INSERT INTO cstype VALUES (2,'sym::branch');
	}

	# Map from changesets to the (file level) revisions, tags, or
	# branches they contain. The pos'ition provides an order of
	# the items within a changeset. They are unique within the
	# changeset.  The items are in principle unique, if we were
	# looking only at relevant changesets. However as they come
	# from disparate sources the same id may have different
	# meaning, be in different changesets and so is formally not
	# unique. So we can only say that it is unique within the
	# changeset. The integrity module has stronger checks.

	state writing csrevision {
	    cid  INTEGER  NOT NULL  REFERENCES changeset,
	    pos  INTEGER  NOT NULL,
	    rid  INTEGER  NOT NULL, -- REFERENCES revision|tag|branch
	    UNIQUE (cid, pos),
	    UNIQUE (cid, rid)
	}

	project::rev getcstypes
	return
    }
................................................................................
	# Pass manager interface. Executed to load data computed by
	# this pass into memory when this pass is skipped instead of
	# executed.

	state reading changeset
	state reading csrevision
	state reading cstype

	# Need the types first, the constructor in the loop below uses
	# them to assert the correctness of type names.
	project::rev getcstypes

	foreach {id pid cstype srcid} [state run {
	    SELECT C.cid, C.pid, CS.name, C.src
	    FROM   changeset C, cstype CS
	    WHERE  C.type = CS.tid
	    ORDER BY C.cid
	}] {
................................................................................
		SELECT C.rid
		FROM   csrevision C
		WHERE  C.cid = $id
		ORDER  BY C.pos
	    }] $id]
	}


	project::rev loadcounter
	return
    }

    typemethod run {} {
	# Pass manager interface. Executed to perform the
	# functionality of the pass.
................................................................................

	set n 0

	# First process the tags, then the branches. We know that
	# their ids do not overlap with each other.

	set lastsymbol  {}

	set lastproject {}
	set revisions   {}

	foreach {sid rid pid} [state run {
	    SELECT S.sid, T.tid, S.pid
	    FROM  tag T, symbol S     -- T ==> R/S, using PK indices of R, S.

	    WHERE T.sid = S.sid
	    ORDER BY S.sid, T.tid
	}] {
	    if {$lastsymbol != $sid} {
		if {[llength $revisions]} {
		    incr n
		    set  p [repository projectof $lastproject]
		    project::rev %AUTO% $p sym::tag $lastsymbol $revisions
		    set revisions {}
		}
		set lastsymbol  $sid

		set lastproject $pid
	    }
	    lappend revisions $rid
	}

	if {[llength $revisions]} {
	    incr n
	    set  p [repository projectof $lastproject]
	    project::rev %AUTO% $p sym::tag $lastsymbol $revisions
	}

	set lastsymbol {}

	set lasproject {}
	set revisions  {}

	foreach {sid rid pid} [state run {
	    SELECT S.sid, B.bid, S.pid
	    FROM  branch B, symbol S  -- B ==> R/S, using PK indices of R, S.

	    WHERE B.sid  = S.sid
	    ORDER BY S.sid, B.bid
	}] {
	    if {$lastsymbol != $sid} {
		if {[llength $revisions]} {
		    incr n
		    set  p [repository projectof $lastproject]
		    project::rev %AUTO% $p sym::branch $lastsymbol $revisions
		    set revisions {}
		}
		set lastsymbol  $sid

		set lastproject $pid
	    }
	    lappend revisions $rid
	}

	if {[llength $revisions]} {
	    incr n
	    set  p [repository projectof $lastproject]
	    project::rev %AUTO% $p sym::branch $lastsymbol $revisions
	}

	log write 4 initcsets "Created [nsp $n {symbol changeset}]"
	return
    }

    proc BreakInternalDependencies {} {