Fossil SCM
Continued work on pass 4. Now propagating the project level information about prefered parents down to the file level tags. Same for the file level branches is not yet done.
Commit
3a530ef9473884c08bb9303099f77f9f84af354c
Parent
ffafc0bd6541fe2…
1 file changed
+62
-6
| --- tools/cvs2fossil/lib/c2f_pfiltersym.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pfiltersym.tcl | ||
| @@ -71,10 +71,12 @@ | ||
| 71 | 71 | |
| 72 | 72 | state transaction { |
| 73 | 73 | FilterExcludedSymbols |
| 74 | 74 | MutateTagsToBranch |
| 75 | 75 | MutateBranchesToTag |
| 76 | + AdjustTagParents | |
| 77 | + AdjustBranchParents | |
| 76 | 78 | |
| 77 | 79 | # Consider a rerun of the pass 2 paranoia checks. |
| 78 | 80 | } |
| 79 | 81 | |
| 80 | 82 | log write 1 filtersym "Filtering completed" |
| @@ -194,17 +196,16 @@ | ||
| 194 | 196 | # file level tags which are actually converted as branches |
| 195 | 197 | # (project level), and put them into the correct table. |
| 196 | 198 | |
| 197 | 199 | set branch [project::sym branch] |
| 198 | 200 | |
| 199 | - set tagstomutate [state run { | |
| 201 | + foreach {id fid lod sid rev} [state run { | |
| 200 | 202 | SELECT T.tid, T.fid, T.lod, T.sid, T.rev |
| 201 | 203 | FROM tag T, symbol S |
| 202 | 204 | WHERE T.sid = S.sid |
| 203 | 205 | AND S.type = $branch |
| 204 | - }] | |
| 205 | - foreach {id fid lod sid rev} $tagstomutate { | |
| 206 | + }] { | |
| 206 | 207 | state run { |
| 207 | 208 | DELETE FROM tag WHERE tid = $id ; |
| 208 | 209 | INSERT INTO branch (bid, fid, lod, sid, root, first, bra) |
| 209 | 210 | VALUES ($id, $fid, $lod, $sid, $rev, NULL, ''); |
| 210 | 211 | } |
| @@ -219,25 +220,80 @@ | ||
| 219 | 220 | # file level branches which are actually converted as tags |
| 220 | 221 | # (project level), and put them into the correct table. |
| 221 | 222 | |
| 222 | 223 | set tag [project::sym tag] |
| 223 | 224 | |
| 224 | - set branchestomutate [state run { | |
| 225 | + foreach {id fid lod sid root first bra} [state run { | |
| 225 | 226 | SELECT B.bid, B.fid, B.lod, B.sid, B.root, B.first, B.bra |
| 226 | 227 | FROM branch B, symbol S |
| 227 | 228 | WHERE B.sid = S.sid |
| 228 | 229 | AND S.type = $tag |
| 229 | - }] | |
| 230 | - foreach {id fid lod sid root first bra} $branchestomutate { | |
| 230 | + }] { | |
| 231 | 231 | state run { |
| 232 | 232 | DELETE FROM branch WHERE bid = $id ; |
| 233 | 233 | INSERT INTO tag (tid, fid, lod, sid, rev) |
| 234 | 234 | VALUES ($id, $fid, $lod, $sid, $root); |
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | return |
| 238 | 238 | } |
| 239 | + | |
| 240 | + # Adjust the parents of symbols to their preferred parents. | |
| 241 | + | |
| 242 | + # If a file level ymbol has a preferred parent that is different | |
| 243 | + # than its current parent, and if the preferred parent is an | |
| 244 | + # allowed parent of the symbol in this file, then we graft the | |
| 245 | + # aSymbol onto its preferred parent. | |
| 246 | + | |
| 247 | + proc AdjustTagParents {} { | |
| 248 | + log write 3 filtersym "Adjust tag parents" | |
| 249 | + | |
| 250 | + # Find the tags whose current parent (lod) is not the prefered | |
| 251 | + # parent, the prefered parent is not the trunk, and the | |
| 252 | + # prefered parent is a possible parent per the tag's file (). | |
| 253 | + | |
| 254 | + foreach {id fid lod pid preferedname revnr} [state run { | |
| 255 | + SELECT T.tid, T.fid, T.lod, P.pid, S.name, R.rev | |
| 256 | + FROM tag T, preferedparent P, symbol S, revision R | |
| 257 | + WHERE T.sid = P.sid | |
| 258 | + AND T.lod != P.pid | |
| 259 | + AND P.pid = S.sid | |
| 260 | + AND S.name != ':trunk:' | |
| 261 | + AND T.rev = R.rid | |
| 262 | + AND P.pid IN (SELECT B.sid FROM branch B WHERE B.root = R.rid) | |
| 263 | + }] { | |
| 264 | + # The names for use in the log output are retrieved | |
| 265 | + # separately, to keep the join selecting the adjustable | |
| 266 | + # tags small, not burdened with the dereferencing of links | |
| 267 | + # to name. | |
| 268 | + | |
| 269 | + set tagname [lindex [state run { | |
| 270 | + SELECT S.name FROM tag T, symbol S WHERE T.sid = S.sid AND T.tid = $id | |
| 271 | + }] 0] | |
| 272 | + set oldname [lindex [state run { | |
| 273 | + SELECT L.name FROM symbol L WHERE L.sid = $lod | |
| 274 | + }] 0] | |
| 275 | + struct::list assign [state run { | |
| 276 | + SELECT F.name, P.name | |
| 277 | + FROM file F, project P | |
| 278 | + WHERE F.fid = $fid AND F.pid = P.pid | |
| 279 | + }] fname prname | |
| 280 | + | |
| 281 | + # Do the grafting. | |
| 282 | + | |
| 283 | + log write 3 filtersym "$prname : Grafting tag '$tagname' on $fname/$revnr from '$oldname' onto '$preferedname'" | |
| 284 | + state run { | |
| 285 | + UPDATE tag SET lod = $pid WHERE tid = $id ; | |
| 286 | + } | |
| 287 | + } | |
| 288 | + return | |
| 289 | + } | |
| 290 | + | |
| 291 | + proc AdjustBranchParents {} { | |
| 292 | + log write 3 filtersym "Adjust branch parents" | |
| 293 | + return | |
| 294 | + } | |
| 239 | 295 | |
| 240 | 296 | # # ## ### ##### ######## ############# |
| 241 | 297 | ## Configuration |
| 242 | 298 | |
| 243 | 299 | pragma -hasinstances no ; # singleton |
| 244 | 300 |
| --- tools/cvs2fossil/lib/c2f_pfiltersym.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pfiltersym.tcl | |
| @@ -71,10 +71,12 @@ | |
| 71 | |
| 72 | state transaction { |
| 73 | FilterExcludedSymbols |
| 74 | MutateTagsToBranch |
| 75 | MutateBranchesToTag |
| 76 | |
| 77 | # Consider a rerun of the pass 2 paranoia checks. |
| 78 | } |
| 79 | |
| 80 | log write 1 filtersym "Filtering completed" |
| @@ -194,17 +196,16 @@ | |
| 194 | # file level tags which are actually converted as branches |
| 195 | # (project level), and put them into the correct table. |
| 196 | |
| 197 | set branch [project::sym branch] |
| 198 | |
| 199 | set tagstomutate [state run { |
| 200 | SELECT T.tid, T.fid, T.lod, T.sid, T.rev |
| 201 | FROM tag T, symbol S |
| 202 | WHERE T.sid = S.sid |
| 203 | AND S.type = $branch |
| 204 | }] |
| 205 | foreach {id fid lod sid rev} $tagstomutate { |
| 206 | state run { |
| 207 | DELETE FROM tag WHERE tid = $id ; |
| 208 | INSERT INTO branch (bid, fid, lod, sid, root, first, bra) |
| 209 | VALUES ($id, $fid, $lod, $sid, $rev, NULL, ''); |
| 210 | } |
| @@ -219,25 +220,80 @@ | |
| 219 | # file level branches which are actually converted as tags |
| 220 | # (project level), and put them into the correct table. |
| 221 | |
| 222 | set tag [project::sym tag] |
| 223 | |
| 224 | set branchestomutate [state run { |
| 225 | SELECT B.bid, B.fid, B.lod, B.sid, B.root, B.first, B.bra |
| 226 | FROM branch B, symbol S |
| 227 | WHERE B.sid = S.sid |
| 228 | AND S.type = $tag |
| 229 | }] |
| 230 | foreach {id fid lod sid root first bra} $branchestomutate { |
| 231 | state run { |
| 232 | DELETE FROM branch WHERE bid = $id ; |
| 233 | INSERT INTO tag (tid, fid, lod, sid, rev) |
| 234 | VALUES ($id, $fid, $lod, $sid, $root); |
| 235 | } |
| 236 | } |
| 237 | return |
| 238 | } |
| 239 | |
| 240 | # # ## ### ##### ######## ############# |
| 241 | ## Configuration |
| 242 | |
| 243 | pragma -hasinstances no ; # singleton |
| 244 |
| --- tools/cvs2fossil/lib/c2f_pfiltersym.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pfiltersym.tcl | |
| @@ -71,10 +71,12 @@ | |
| 71 | |
| 72 | state transaction { |
| 73 | FilterExcludedSymbols |
| 74 | MutateTagsToBranch |
| 75 | MutateBranchesToTag |
| 76 | AdjustTagParents |
| 77 | AdjustBranchParents |
| 78 | |
| 79 | # Consider a rerun of the pass 2 paranoia checks. |
| 80 | } |
| 81 | |
| 82 | log write 1 filtersym "Filtering completed" |
| @@ -194,17 +196,16 @@ | |
| 196 | # file level tags which are actually converted as branches |
| 197 | # (project level), and put them into the correct table. |
| 198 | |
| 199 | set branch [project::sym branch] |
| 200 | |
| 201 | foreach {id fid lod sid rev} [state run { |
| 202 | SELECT T.tid, T.fid, T.lod, T.sid, T.rev |
| 203 | FROM tag T, symbol S |
| 204 | WHERE T.sid = S.sid |
| 205 | AND S.type = $branch |
| 206 | }] { |
| 207 | state run { |
| 208 | DELETE FROM tag WHERE tid = $id ; |
| 209 | INSERT INTO branch (bid, fid, lod, sid, root, first, bra) |
| 210 | VALUES ($id, $fid, $lod, $sid, $rev, NULL, ''); |
| 211 | } |
| @@ -219,25 +220,80 @@ | |
| 220 | # file level branches which are actually converted as tags |
| 221 | # (project level), and put them into the correct table. |
| 222 | |
| 223 | set tag [project::sym tag] |
| 224 | |
| 225 | foreach {id fid lod sid root first bra} [state run { |
| 226 | SELECT B.bid, B.fid, B.lod, B.sid, B.root, B.first, B.bra |
| 227 | FROM branch B, symbol S |
| 228 | WHERE B.sid = S.sid |
| 229 | AND S.type = $tag |
| 230 | }] { |
| 231 | state run { |
| 232 | DELETE FROM branch WHERE bid = $id ; |
| 233 | INSERT INTO tag (tid, fid, lod, sid, rev) |
| 234 | VALUES ($id, $fid, $lod, $sid, $root); |
| 235 | } |
| 236 | } |
| 237 | return |
| 238 | } |
| 239 | |
| 240 | # Adjust the parents of symbols to their preferred parents. |
| 241 | |
| 242 | # If a file level ymbol has a preferred parent that is different |
| 243 | # than its current parent, and if the preferred parent is an |
| 244 | # allowed parent of the symbol in this file, then we graft the |
| 245 | # aSymbol onto its preferred parent. |
| 246 | |
| 247 | proc AdjustTagParents {} { |
| 248 | log write 3 filtersym "Adjust tag parents" |
| 249 | |
| 250 | # Find the tags whose current parent (lod) is not the prefered |
| 251 | # parent, the prefered parent is not the trunk, and the |
| 252 | # prefered parent is a possible parent per the tag's file (). |
| 253 | |
| 254 | foreach {id fid lod pid preferedname revnr} [state run { |
| 255 | SELECT T.tid, T.fid, T.lod, P.pid, S.name, R.rev |
| 256 | FROM tag T, preferedparent P, symbol S, revision R |
| 257 | WHERE T.sid = P.sid |
| 258 | AND T.lod != P.pid |
| 259 | AND P.pid = S.sid |
| 260 | AND S.name != ':trunk:' |
| 261 | AND T.rev = R.rid |
| 262 | AND P.pid IN (SELECT B.sid FROM branch B WHERE B.root = R.rid) |
| 263 | }] { |
| 264 | # The names for use in the log output are retrieved |
| 265 | # separately, to keep the join selecting the adjustable |
| 266 | # tags small, not burdened with the dereferencing of links |
| 267 | # to name. |
| 268 | |
| 269 | set tagname [lindex [state run { |
| 270 | SELECT S.name FROM tag T, symbol S WHERE T.sid = S.sid AND T.tid = $id |
| 271 | }] 0] |
| 272 | set oldname [lindex [state run { |
| 273 | SELECT L.name FROM symbol L WHERE L.sid = $lod |
| 274 | }] 0] |
| 275 | struct::list assign [state run { |
| 276 | SELECT F.name, P.name |
| 277 | FROM file F, project P |
| 278 | WHERE F.fid = $fid AND F.pid = P.pid |
| 279 | }] fname prname |
| 280 | |
| 281 | # Do the grafting. |
| 282 | |
| 283 | log write 3 filtersym "$prname : Grafting tag '$tagname' on $fname/$revnr from '$oldname' onto '$preferedname'" |
| 284 | state run { |
| 285 | UPDATE tag SET lod = $pid WHERE tid = $id ; |
| 286 | } |
| 287 | } |
| 288 | return |
| 289 | } |
| 290 | |
| 291 | proc AdjustBranchParents {} { |
| 292 | log write 3 filtersym "Adjust branch parents" |
| 293 | return |
| 294 | } |
| 295 | |
| 296 | # # ## ### ##### ######## ############# |
| 297 | ## Configuration |
| 298 | |
| 299 | pragma -hasinstances no ; # singleton |
| 300 |