Overview
SHA1 Hash: | 79c227a9c0acd62dc2d96248acdc5b95af138c13 |
---|---|
Date: | 2007-12-01 18:36:26 |
User: | aku |
Comment: | Bugfix. Handle free-floating branches (their root revision was removed as unnecessary). |
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_file.tcl from [91fadc851a] to [995eee5b4c].
@@ -766,10 +766,11 @@ # use operation 'add', no need to change that. The first # revision on each branch becomes a new and disconnected # root. foreach branch [$root branches] { + $branch cutbranchparent if {![$branch haschild]} continue set first [$branch child] $first cutfromparentbranch $first cutfromparent $branch cutchild
Modified tools/cvs2fossil/lib/c2f_fsym.tcl from [a9a75d2cd2] to [6b46b59edb].
@@ -119,14 +119,15 @@ integrity assert {$mybranchchildrevnr eq ""} {Child already defined} set mybranchchildrevnr $revnr return } - method setposition {n} { set mybranchposition $n ; return } - method setparent {rev} { set mybranchparent $rev ; return } - method setchild {rev} { set mybranchchild $rev ; return } - method cutchild {} { set mybranchchild "" ; return } + method setposition {n} { set mybranchposition $n ; return } + method setparent {rev} { set mybranchparent $rev ; return } + method setchild {rev} { set mybranchchild $rev ; return } + method cutchild {} { set mybranchchild "" ; return } + method cutbranchparent {} { set mybranchparent "" ; return } method branchnr {} { return $mynr } method parentrevnr {} { return $mybranchparentrevnr } method childrevnr {} { return $mybranchchildrevnr } method haschildrev {} { return [expr {$mybranchchildrevnr ne ""}] } @@ -185,16 +186,16 @@ VALUES ($myid, $fid, $lod, $sid, $rid); } } } branch { - lappend map @F@ [expr { ($mybranchchild eq "") ? "NULL" : [$mybranchchild id] }] - - set rid [$mybranchparent id] + lappend map @F@ [expr { ($mybranchchild eq "") ? "NULL" : [$mybranchchild id] }] + lappend map @P@ [expr { ($mybranchparent eq "") ? "NULL" : [$mybranchparent id] }] + set cmd { INSERT INTO branch ( bid, fid, lod, sid, root, first, bra, pos ) - VALUES ($myid, $fid, $lod, $sid, $rid, @F@, $mynr, $mybranchposition); + VALUES ($myid, $fid, $lod, $sid, @P@, @F@, $mynr, $mybranchposition); } state transaction { state run [string map $map $cmd] } }
Modified tools/cvs2fossil/lib/c2f_pcollrev.tcl from [ea94dc166c] to [531ee2ff11].
@@ -182,14 +182,21 @@ bid 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) sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the branch - root INTEGER NOT NULL REFERENCES revision, -- Revision the branch sprouts from + root INTEGER REFERENCES revision, -- Revision the branch sprouts from first INTEGER REFERENCES revision, -- First revision committed to the branch bra TEXT NOT NULL, -- branch number pos INTEGER NOT NULL -- creation order in root. + + -- A branch can exist without root. It happens when the + -- only revision on trunk is the unnecessary dead one the + -- branch was sprouted from and it has commits. The branch + -- will exist to be the LOD of its revisions, nothing to + -- sprout from, the dead revision was removed, hence no + -- root. } # Project level ... # pLineOfDevelopment, pSymbol, pBranch, pTag, pTrunk #
Modified tools/cvs2fossil/lib/c2f_pfiltersym.tcl from [2020f6d70d] to [940562fb7e].
@@ -318,10 +318,18 @@ AND S.name != ':trunk:' AND T.rev = R.rid }] set branchestoadjust [state run { + SELECT B.bid, B.fid, B.lod, B.pos, P.pid, S.name, NULL, NULL + FROM branch B, preferedparent P, symbol S + WHERE B.sid = P.sid + AND B.lod != P.pid + AND P.pid = S.sid + AND S.name != ':trunk:' + AND B.root IS NULL -- Accept free-floating branch + UNION SELECT B.bid, B.fid, B.lod, B.pos, P.pid, S.name, R.rev, R.rid FROM branch B, preferedparent P, symbol S, revision R WHERE B.sid = P.sid AND B.lod != P.pid AND P.pid = S.sid @@ -344,11 +352,10 @@ set fmt %[string length $tmax]s set mxs [format $fmt $tmax] set n 0 foreach {id fid lod pid preferedname revnr rid} $tagstoadjust { - # BOTTLE-NECK ... # # The check if the candidate (pid) is truly viable is # based finding the branch as possible parent, and done # now instead of as part of the already complex join. @@ -412,11 +419,18 @@ # ... AND P.pid IN (SELECT BX.sid # FROM branch BX # WHERE BX.root = R.rid # AND BX.pos > B.pos) - if {![state one { + # Note: rid eq "" hear means that this is a free-floating + # branch, whose original root was removed as a unnecessary + # dead revision (See 'file::RemoveIrrelevantDeletions'). + # Such a branch can be regrafted without trouble and there + # is no need to look for the new parent in its + # non-existent root. + + if {($rid ne "") && ![state one { SELECT COUNT(*) FROM branch B WHERE B.sid = $pid AND B.root = $rid AND B.pos > $pos