Overview
SHA1 Hash: | 2c08006d9dcaf2e0ed0eb04d23e3083d7d55d6a6 |
---|---|
Date: | 2007-10-25 05:13:41 |
User: | aku |
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. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified tools/cvs2fossil/lib/c2f_frev.tcl from [8b070e3579] to [f165072caa].
@@ -343,26 +343,26 @@ # # ## ### ##### ######## ############# method persist {} { set fid [$myfile id] + set lod [$mylod 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] }] + 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, 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); + 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] }
Modified tools/cvs2fossil/lib/c2f_fsym.tcl from [0342b00fc2] to [ce3e976f91].
@@ -121,35 +121,36 @@ # 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] }] + set lod [$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); + 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, @L@, $sid, $rid, @F@, $mynr); + 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] } } } - state transaction { - state run [string map $map $cmd] - } return } # # ## ### ##### ######## ############# ## State
Modified tools/cvs2fossil/lib/c2f_pcollrev.tcl from [a41e2628dd] to [0cf7d28b69].
@@ -64,37 +64,87 @@ # 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 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 + 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 @@ -155,20 +205,39 @@ 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, - 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, + + -- 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. } - # Author and commit message information is fully global, - # i.e. per repository. + # 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 } @@ -175,18 +244,10 @@ 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 {} {
Modified tools/cvs2fossil/lib/c2f_project.tcl from [cfcc67163f] to [78ad19a406].
@@ -31,11 +31,11 @@ ## Public API constructor {path r} { set mybase $path set myrepository $r - set mytrunk [trunk %AUTO%] + set mytrunk [trunk %AUTO% $self] return } method base {} { return $mybase } method trunk {} { return $mytrunk }
Modified tools/cvs2fossil/lib/c2f_ptrunk.tcl from [eb3e864d33] to [186b2dcb0d].
@@ -23,20 +23,24 @@ snit::type ::vc::fossil::import::cvs::project::trunk { # # ## ### ##### ######## ############# ## Public API - constructor {} { + constructor {project} { + set myid [[$project getsymbol $myname] id] return } - method name {} { return :trunk: } - method 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 # # ## ### ##### ######## #############