Fossil

Check-in [2c08006d9d]
Login

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

Overview
Comment:Changed the coding of trunk symbols. Using NULL makes for difficult comparisons later when doing integrity checks. Each trunk now has a regular unique id as a symbol. Added documentation to the table definitions, about references, constraints, etc.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2c08006d9dcaf2e0ed0eb04d23e3083d7d55d6a6
User & Date: aku 2007-10-25 05:13:41.000
Context
2007-10-25
05:14
Formatting change, code alignment. ... (check-in: 7375ebb988 user: aku tags: trunk)
05:13
Changed the coding of trunk symbols. Using NULL makes for difficult comparisons later when doing integrity checks. Each trunk now has a regular unique id as a symbol. Added documentation to the table definitions, about references, constraints, etc. ... (check-in: 2c08006d9d user: aku tags: trunk)
2007-10-24
14:44
Extended pass manager to keep timing data for the executed passes and show them after completion of all passes. ... (check-in: 05f9c95573 user: aku tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to tools/cvs2fossil/lib/c2f_frev.tcl.
341
342
343
344
345
346
347

348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
	return [join [lrange [split $branchnr .] 0 end-1] .]
    }

    # # ## ### ##### ######## #############

    method persist {} {
	set fid [$myfile id]

	set op  $myopcode($myoperation)
	set idb $myisondefaultbranch

	struct::list assign $mytext cs cl
	set cl [expr {$cl - $cs}]

	lappend map @L@ [expr { [$mylod istrunk]        ? "NULL" : [$mylod          id] }]
	lappend map @P@ [expr { ($myparent       eq "") ? "NULL" : [$myparent       id] }]
	lappend map @C@ [expr { ($mychild        eq "") ? "NULL" : [$mychild        id] }]
	lappend map @DP [expr { ($mydbparent     eq "") ? "NULL" : [$mydbparent     id] }]
	lappend map @DC [expr { ($mydbchild      eq "") ? "NULL" : [$mydbchild      id] }]
	lappend map @BP [expr { ($myparentbranch eq "") ? "NULL" : [$myparentbranch id] }]

	set cmd {
	    INSERT INTO revision ( rid,   fid, lod,  rev,      date,    state,    mid,       cs,  cl, op,   isdefault, parent, child, dbparent, dbchild, bparent)
	    VALUES               ($myid, $fid, @L@, $myrevnr, $mydate, $mystate, $mymetaid, $cs, $cl, $op, $idb,       @P@,    @C@,   @DP,      @DC,     @BP);
	}

	state transaction {
	    state run [string map $map $cmd]
	}
	return
    }







>



|
|

<







|
|







341
342
343
344
345
346
347
348
349
350
351
352
353
354

355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
	return [join [lrange [split $branchnr .] 0 end-1] .]
    }

    # # ## ### ##### ######## #############

    method persist {} {
	set fid [$myfile id]
	set lod [$mylod id]
	set op  $myopcode($myoperation)
	set idb $myisondefaultbranch

	struct::list assign $mytext coff end
	set clen [expr {$end - $coff}]


	lappend map @P@ [expr { ($myparent       eq "") ? "NULL" : [$myparent       id] }]
	lappend map @C@ [expr { ($mychild        eq "") ? "NULL" : [$mychild        id] }]
	lappend map @DP [expr { ($mydbparent     eq "") ? "NULL" : [$mydbparent     id] }]
	lappend map @DC [expr { ($mydbchild      eq "") ? "NULL" : [$mydbchild      id] }]
	lappend map @BP [expr { ($myparentbranch eq "") ? "NULL" : [$myparentbranch id] }]

	set cmd {
	    INSERT INTO revision ( rid,   fid,  rev,      lod, parent, child,  isdefault, dbparent, dbchild, bparent,  op,  date,    state,    mid,       coff,  clen)
	    VALUES               ($myid, $fid, $myrevnr, $lod, @P@,    @C@,   $idb,       @DP,      @DC,     @BP    , $op, $mydate, $mystate, $mymetaid, $coff, $clen);
	}

	state transaction {
	    state run [string map $map $cmd]
	}
	return
    }
Changes to tools/cvs2fossil/lib/c2f_fsym.tcl.
119
120
121
122
123
124
125
126
127
128
129
130
131

132
133
134

135
136
137
138
139
140
141
142
143



144
145
146
147
148
149
150
151
152
153
154
155
156
157
	# NOTE: mybranchposition is currently not saved. This can
	# likely be figured out later from the id itself. If yes, we
	# can also get rid of 'sortbranches' (cvs::file) and the
	# associated information.

	set fid [$myfile   id]
	set sid [$mysymbol id]

	lappend map @L@ [expr { [$mylod istrunk] ? "NULL" : [$mylod id] }]

	switch -exact -- $mytype {
	    tag {
		set rid [$mytagrev id]

		set cmd {
		    INSERT INTO tag ( tid,   fid, lod,  sid,  rev)
		    VALUES          ($myid, $fid, @L@, $sid, $rid);

		}
	    }
	    branch {
		lappend map @F@ [expr { ($mybranchchild eq "") ? "NULL" : [$mybranchchild id] }]

		set rid [$mybranchparent id]
		set cmd {
		    INSERT INTO branch ( bid,   fid, lod,  sid,  root, first, bra )
		    VALUES             ($myid, $fid, @L@, $sid, $rid,  @F@, $mynr);



		}
	    }
	}

	state transaction {
	    state run [string map $map $cmd]
	}
	return
    }

    # # ## ### ##### ######## #############
    ## State

    # Persistent:







|
<




>
|
|
|
>







|
|
>
>
>




<
<
<







119
120
121
122
123
124
125
126

127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151



152
153
154
155
156
157
158
	# NOTE: mybranchposition is currently not saved. This can
	# likely be figured out later from the id itself. If yes, we
	# can also get rid of 'sortbranches' (cvs::file) and the
	# associated information.

	set fid [$myfile   id]
	set sid [$mysymbol id]
	set lod [$mylod    id]


	switch -exact -- $mytype {
	    tag {
		set rid [$mytagrev id]
		state transaction {
		    state run {
			INSERT INTO tag ( tid,   fid,  lod,  sid,  rev)
			VALUES          ($myid, $fid, $lod, $sid, $rid);
		    }
		}
	    }
	    branch {
		lappend map @F@ [expr { ($mybranchchild eq "") ? "NULL" : [$mybranchchild id] }]

		set rid [$mybranchparent id]
		set cmd {
		    INSERT INTO branch ( bid,   fid,  lod,  sid,  root, first, bra )
		    VALUES             ($myid, $fid, $lod, $sid, $rid,  @F@,  $mynr);
		}
		state transaction {
		    state run [string map $map $cmd]
		}
	    }
	}




	return
    }

    # # ## ### ##### ######## #############
    ## State

    # Persistent:
Changes to tools/cvs2fossil/lib/c2f_pcollrev.tcl.
62
63
64
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
	#
	# Pseudo class hierarchy
	#	Tag      <- Symbol <- Event
	#	Branch   <- Symbol <- Event
	#	Revision           <- Event

	state writing revision {







	    rid  INTEGER  NOT NULL  PRIMARY KEY AUTOINCREMENT,
	    fid  INTEGER  NOT NULL  REFERENCES file,   -- File the item belongs to










	    lod  INTEGER            REFERENCES symbol, -- Line of development (NULL => Trunk)

	    -- The tags and branches belonging to a revision can be

	    -- determined by selecting on the backreferences in the

	    -- tag and branch tables.


	    rev   TEXT     NOT NULL,                 -- revision number
	    date  INTEGER  NOT NULL,                 -- date of entry, seconds since epoch
	    state TEXT     NOT NULL,                 -- state of revision
	    mid   INTEGER  NOT NULL REFERENCES meta, -- meta data (author, commit message)


	    cs    INTEGER  NOT NULL,                 -- Revision content as offset and


	    cl    INTEGER  NOT NULL,                 -- length into the archive file.








	    -- Derived information, and links


	    -- Basic: Parent/Child
	    -- NTDB:  DefaultParent/DefaultChild
	    -- Branches: Branch parent revision





	    op        INTEGER NOT NULL,
	    isdefault INTEGER NOT NULL,
	    parent    INTEGER        REFERENCES revision,
	    child     INTEGER        REFERENCES revision,
	    dbparent  INTEGER        REFERENCES revision,
	    dbchild   INTEGER        REFERENCES revision,









	    bparent   INTEGER        REFERENCES symbol







	}

	state writing tag {
	    tid  INTEGER  NOT NULL  PRIMARY KEY AUTOINCREMENT,
	    fid  INTEGER  NOT NULL  REFERENCES file,     -- File the item belongs to
	    lod  INTEGER            REFERENCES symbol,   -- Line of development (NULL => Trunk)








>
>
>
>
>
>
>

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

|
>
|
>
|

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

>
|
>
>
|
|
|
>
>
>
>

<
|
<
<
|
|
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>







62
63
64
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125

126


127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
	#
	# Pseudo class hierarchy
	#	Tag      <- Symbol <- Event
	#	Branch   <- Symbol <- Event
	#	Revision           <- Event

	state writing revision {
	    -- Revisions. Identified by a global numeric id each
	    -- belongs to a single file, identified by its id. It
	    -- further has a dotted revision number (DTN).
	    --
	    -- Constraint: The dotted revision number is unique within
            --             the file. See end of definition.

	    rid  INTEGER  NOT NULL  PRIMARY KEY AUTOINCREMENT,
	    fid  INTEGER  NOT NULL  REFERENCES file,   -- File owning revision.
	    rev  TEXT     NOT NULL,                    -- Dotted Rev Number.

	    -- All revisions belong to a line-of-development,
	    -- identified by a symbol (project level). During data
	    -- collection it was a file-level branch symbol.
	    --
	    -- Constraint: All the LOD symbols are in the same project
	    --             as the file itself. This cannot be
	    --             expressed in CREATE TABLE syntax.

	    lod  INTEGER  NOT NULL  REFERENCES symbol, -- Line of development

	    -- The revisions in a file are organized in a forest of
	    -- trees, with the main lines defined through the parent /
	    -- child references. A revision without a parent is the
	    -- root of a tree, and a revision without a child is a
	    -- leaf.

	    -- Constraints: All revisions coupled through parent/child
	    --              refer to the same LOD symbol. The parent
	    --              of a child of X is X. The child of a
	    --              parent of X is X.

	    parent  INTEGER            REFERENCES revision,
	    child   INTEGER            REFERENCES revision,

	    -- The representation of a branch in a tree is the
	    -- exception to the three constraints above.

	    -- The beginning of a branch is represented by a non-NULL
	    -- bparent of a revision. This revision B is the first on
	    -- the branch. Its parent P is the revision the branch is
	    -- rooted in, and it is not the child of P. B and P refer
	    -- to different LOD symbols. The bparent of B is also its
	    -- LOD, and the LOD of its children.

	    bparent INTEGER            REFERENCES symbol,

	    -- Lastly we keep information is about non-trunk default
	    -- branches (NTDB) in the revisions.

	    -- All revisions on the NTDB have 'isdefault' TRUE,
	    -- everyone else FALSE. The last revision X on the NTDB
	    -- which is still considered to be on the trunk as well
	    -- has a non-NULL 'dbchild' which refers to the root of
	    -- the trunk. The root also has a non-NULL dbparent
	    -- refering to X.


	    isdefault INTEGER  NOT NULL,


	    dbparent  INTEGER            REFERENCES revision,
	    dbchild   INTEGER            REFERENCES revision,

	    -- The main payload of the revision are the date/time it
	    -- was entered, its state, operation (= type/class), text
	    -- content, and meta data (author, log message, branch,
	    -- project). The last is encoded as single id, see table
	    -- 'meta'. The date/time is given in seconds since the
	    -- epoch, for easy comparison. The text content is an
	    -- (offset,length) pair into the rcs archive.

	    op    INTEGER  NOT NULL,
	    date  INTEGER  NOT NULL,
	    state TEXT     NOT NULL,
	    mid   INTEGER  NOT NULL REFERENCES meta,
	    coff  INTEGER  NOT NULL,
	    clen  INTEGER  NOT NULL,

	    UNIQUE (fid, rev) -- The DTN is unique within the revision's file.
	}

	state writing tag {
	    tid  INTEGER  NOT NULL  PRIMARY KEY AUTOINCREMENT,
	    fid  INTEGER  NOT NULL  REFERENCES file,     -- File the item belongs to
	    lod  INTEGER            REFERENCES symbol,   -- Line of development (NULL => Trunk)

153
154
155
156
157
158
159





160






161
162
163
164

165
166






167
168

169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
	state writing parent {
	    sid INTEGER  NOT NULL  REFERENCES symbol, -- 
	    pid INTEGER  NOT NULL  REFERENCES symbol, -- Possible parent of sid
	    UNIQUE (sid, pid)
	}

	state writing meta {





	    mid INTEGER  NOT NULL  PRIMARY KEY  AUTOINCREMENT,






	    pid INTEGER  NOT NULL  REFERENCES project,  -- project the commit was on
	    bid INTEGER            REFERENCES symbol,   -- branch the commit was on, NULL for :trunk:
	    aid INTEGER  NOT NULL  REFERENCES author,
	    cid INTEGER  NOT NULL  REFERENCES cmessage,

	    UNIQUE (pid, bid, aid, cid)
	}







	# Author and commit message information is fully global,

	# i.e. per repository.

	state writing author {
	    aid  INTEGER  NOT NULL  PRIMARY KEY  AUTOINCREMENT,
	    name TEXT     NOT NULL  UNIQUE
	}

	state writing cmessage {
	    cid  INTEGER  NOT NULL  PRIMARY KEY  AUTOINCREMENT,
	    text TEXT     NOT NULL  UNIQUE
	}

	# Consistency constraints.
	#
	# Items (Tags, Branches, Revisions) belong to a file to a
	# project. All refer to other items, and symbols, which again
	# belong to a project. The projects have to agree with each
	# other. I.e. items may not refer to items or symbols which
	# belong to a different project than their own.

	return
    }

    typemethod load {} {
	# TODO
	return
    }







>
>
>
>
>

>
>
>
>
>
>
|
|
|
|
>

|
>
>
>
>
>
>
|
|
>
|











<
<
<
<
<
<
<
<







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
239
240
241
242
243
244
245
246
247
248
249








250
251
252
253
254
255
256
	state writing parent {
	    sid INTEGER  NOT NULL  REFERENCES symbol, -- 
	    pid INTEGER  NOT NULL  REFERENCES symbol, -- Possible parent of sid
	    UNIQUE (sid, pid)
	}

	state writing meta {
	    -- Meta data of revisions. See revision.mid for the
	    -- reference. Many revisions can share meta data. This is
	    -- actually one of the criterions used to sort revisions
	    -- into changesets.

	    mid INTEGER  NOT NULL  PRIMARY KEY  AUTOINCREMENT,

	    -- Meta data belongs to a specific project, stronger, to a
	    -- branch in that project. It further has a log message,
	    -- and its author. This is unique with the project and
	    -- branch.

	    pid INTEGER  NOT NULL  REFERENCES project,  --
	    bid INTEGER  NOT NULL  REFERENCES symbol,   --
	    aid INTEGER  NOT NULL  REFERENCES author,   --
	    cid INTEGER  NOT NULL  REFERENCES cmessage, --

	    UNIQUE (pid, bid, aid, cid)

	    -- Constraints: The project of the meta data of a revision
	    --              X is the same as the project of X itself.
	    --
	    -- ............ The branch of the meta data of a revision
	    --              X is the same as the line of development
	    --              of X itself.
	}

	# Authors and commit messages are fully global, i.e. per
	# repository.

	state writing author {
	    aid  INTEGER  NOT NULL  PRIMARY KEY  AUTOINCREMENT,
	    name TEXT     NOT NULL  UNIQUE
	}

	state writing cmessage {
	    cid  INTEGER  NOT NULL  PRIMARY KEY  AUTOINCREMENT,
	    text TEXT     NOT NULL  UNIQUE
	}









	return
    }

    typemethod load {} {
	# TODO
	return
    }
Changes to tools/cvs2fossil/lib/c2f_project.tcl.
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
snit::type ::vc::fossil::import::cvs::project {
    # # ## ### ##### ######## #############
    ## Public API

    constructor {path r} {
	set mybase       $path
	set myrepository $r
	set mytrunk      [trunk %AUTO%]
	return
    }

    method base  {} { return $mybase  }
    method trunk {} { return $mytrunk }

    method printbase {} {







|







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
snit::type ::vc::fossil::import::cvs::project {
    # # ## ### ##### ######## #############
    ## Public API

    constructor {path r} {
	set mybase       $path
	set myrepository $r
	set mytrunk      [trunk %AUTO% $self]
	return
    }

    method base  {} { return $mybase  }
    method trunk {} { return $mytrunk }

    method printbase {} {
Changes to tools/cvs2fossil/lib/c2f_ptrunk.tcl.
21
22
23
24
25
26
27
28

29
30
31
32
33
34
35
36
37



38
39
40
41
42
43
44
# # ## ### ##### ######## ############# #####################
## 

snit::type ::vc::fossil::import::cvs::project::trunk {
    # # ## ### ##### ######## #############
    ## Public API

    constructor {} {

	return
    }

    method name    {} { return :trunk: }
    method id      {} { return {}      }
    method istrunk {} { return 1 }

    # # ## ### ##### ######## #############
    ## State




    # # ## ### ##### ######## #############
    ## Internal methods

    # # ## ### ##### ######## #############
    ## Configuration








|
>



|
|




>
>
>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# # ## ### ##### ######## ############# #####################
## 

snit::type ::vc::fossil::import::cvs::project::trunk {
    # # ## ### ##### ######## #############
    ## Public API

    constructor {project} {
	set myid [[$project getsymbol $myname] id]
	return
    }

    method name    {} { return $myname }
    method id      {} { return $myid   }
    method istrunk {} { return 1 }

    # # ## ### ##### ######## #############
    ## State

    typevariable myname :trunk: ; # Name shared by all trunk symbols.
    variable     myid   {}      ; # The trunk's symbol id.

    # # ## ### ##### ######## #############
    ## Internal methods

    # # ## ### ##### ######## #############
    ## Configuration