Fossil SCM

Changesets: Added accessor for to retrieve number of changesets known, and dropped the "trunk root -> NTDB root" dependency, is problematic.

aku 2007-11-25 07:39 trunk
Commit 96167b2a48d198c844f636d17a45472303c13230
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -407,36 +407,47 @@
407407
typemethod loadcounter {} {
408408
# Initialize the counter from the state
409409
set mycounter [state one { SELECT MAX(cid) FROM changeset }]
410410
return
411411
}
412
+
413
+ typemethod num {} { return $mycounter }
412414
413415
proc PullInternalSuccessorRevisions {dv revisions} {
414416
upvar 1 $dv dependencies
415417
set theset ('[join $revisions {','}]')
416418
419
+ # See PullSuccessorRevisions below for the main explanation of
420
+ # the various cases. This piece is special in that it
421
+ # restricts the successors we look for to the same set of
422
+ # revisions we start from. Sensible as we are looking for
423
+ # changeset internal dependencies.
424
+
417425
foreach {rid child} [state run "
418
- -- Primary children
426
+ -- (1) Primary child
419427
SELECT R.rid, R.child
420428
FROM revision R
421
- WHERE R.rid IN $theset
422
- AND R.child IS NOT NULL
423
- AND R.child IN $theset
424
- UNION
425
- -- Transition NTDB to trunk
426
- SELECT R.rid, R.dbchild
427
- FROM revision R
428
- WHERE R.rid IN $theset
429
- AND R.dbchild IS NOT NULL
430
- AND R.dbchild IN $theset
431
- UNION
432
- -- Secondary (branch) children
429
+ WHERE R.rid IN $theset -- Restrict to revisions of interest
430
+ AND R.child IS NOT NULL -- Has primary child
431
+ AND R.child IN $theset -- Which is also of interest
432
+ UNION
433
+ -- (2) Secondary (branch) children
433434
SELECT R.rid, B.brid
434435
FROM revision R, revisionbranchchildren B
435
- WHERE R.rid IN $theset
436
- AND R.rid = B.rid
437
- AND B.brid IN $theset
436
+ WHERE R.rid IN $theset -- Restrict to revisions of interest
437
+ AND R.rid = B.rid -- Select subset of branch children
438
+ AND B.brid IN $theset -- Which is also of interest
439
+ UNION
440
+ -- (4) Child of trunk root successor of last NTDB on trunk.
441
+ SELECT R.rid, RA.child
442
+ FROM revision R, revision RA
443
+ WHERE R.rid IN $theset -- Restrict to revisions of interest
444
+ AND R.isdefault -- Restrict to NTDB
445
+ AND R.dbchild IS NOT NULL -- and last NTDB belonging to trunk
446
+ AND RA.rid = R.dbchild -- Go directly to trunk root
447
+ AND RA.child IS NOT NULL -- Has primary child.
448
+ AND RA.child IN $theset -- Which is also of interest
438449
"] {
439450
# Consider moving this to the integrity module.
440451
if {$rid == $child} {
441452
trouble internal "Revision $rid depends on itself."
442453
}
@@ -458,18 +469,17 @@
458469
# (2) S can be a secondary, i.e. branch, child of R. Here the
459470
# link is made through the helper table
460471
# REVISIONBRANCHCHILDREN. R.rid -> RBC.rid, RBC.brid =
461472
# S(.rid)
462473
#
463
- # (3) If R is the trunk root of its file and S is the root of
464
- # the NTDB of the same file, then S is a successor of
465
- # R. There is no direct link between the two in the
466
- # database. An indirect link can be made through the FILE
467
- # they belong too, and their combination of attributes to
468
- # identify them. We check R for trunk rootness and then
469
- # select for the NTDB root, crossing the table with
470
- # itself.
474
+ # (3) Originally this use case defined the root of a detached
475
+ # NTDB as the successor of the trunk root. This leads to a
476
+ # bad tangle later on. With a detached NTDB the original
477
+ # trunk root revision was removed as irrelevant, allowing
478
+ # the nominal root to be later in time than the NTDB
479
+ # root. Now setting this dependency will be backward in
480
+ # time. REMOVED.
471481
#
472482
# (4) If R is the last of the NTDB revisions which belong to
473483
# the trunk, then the primary child of the trunk root (the
474484
# '1.2' revision) is a successor, if it exists.
475485
@@ -484,20 +494,10 @@
484494
SELECT R.rid, B.brid
485495
FROM revision R, revisionbranchchildren B
486496
WHERE R.rid IN $theset -- Restrict to revisions of interest
487497
AND R.rid = B.rid -- Select subset of branch children
488498
UNION
489
- -- (3) NTDB root successor of Trunk root
490
- SELECT R.rid, RX.rid
491
- FROM revision R, revision RX
492
- WHERE R.rid IN $theset -- Restrict to revisions of interest
493
- AND R.parent IS NULL -- Restrict to root
494
- AND NOT R.isdefault -- on the trunk
495
- AND R.fid = RX.fid -- Select all revision in the same file
496
- AND RX.parent IS NULL -- Restrict to root
497
- AND RX.isdefault -- on the NTDB
498
- UNION
499499
-- (4) Child of trunk root successor of last NTDB on trunk.
500500
SELECT R.rid, RA.child
501501
FROM revision R, revision RA
502502
WHERE R.rid IN $theset -- Restrict to revisions of interest
503503
AND R.isdefault -- Restrict to NTDB
@@ -527,11 +527,12 @@
527527
# child of P. It not necessary to distinguish the two
528528
# cases, in contrast to the code retrieving the successor
529529
# information.
530530
#
531531
# (2) The complement of successor case (3). The trunk root is
532
- # a predecessor of a NTDB root.
532
+ # a predecessor of a NTDB root. REMOVED. See
533
+ # PullSuccessorRevisions for the explanation.
533534
#
534535
# (3) The complement of successor case (4). The last NTDB
535536
# revision belonging to the trunk is a predecessor of the
536537
# primary child of the trunk root (The '1.2' revision).
537538
@@ -540,20 +541,10 @@
540541
SELECT R.rid, R.parent
541542
FROM revision R
542543
WHERE R.rid IN $theset -- Restrict to revisions of interest
543544
AND R.parent IS NOT NULL -- Has primary parent
544545
UNION
545
- -- (2) Trunk root predecessor of NTDB root.
546
- SELECT R.rid, RX.rid
547
- FROM revision R, revision RX
548
- WHERE R.rid IN $theset -- Restrict to revisions of interest
549
- AND R.parent IS NULL -- which are root
550
- AND R.isdefault -- on NTDB
551
- AND R.fid = RX.fid -- Select all revision in the same file
552
- AND RX.parent IS NULL -- which are root
553
- AND NOT RX.isdefault -- on the trunk
554
- UNION
555546
-- (3) Last NTDB on trunk is predecessor of child of trunk root
556547
SELECT R.rid, RA.dbparent
557548
FROM revision R, revision RA
558549
WHERE R.rid IN $theset -- Restrict to revisions of interest
559550
AND NOT R.isdefault -- not on NTDB
560551
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -407,36 +407,47 @@
407 typemethod loadcounter {} {
408 # Initialize the counter from the state
409 set mycounter [state one { SELECT MAX(cid) FROM changeset }]
410 return
411 }
 
 
412
413 proc PullInternalSuccessorRevisions {dv revisions} {
414 upvar 1 $dv dependencies
415 set theset ('[join $revisions {','}]')
416
 
 
 
 
 
 
417 foreach {rid child} [state run "
418 -- Primary children
419 SELECT R.rid, R.child
420 FROM revision R
421 WHERE R.rid IN $theset
422 AND R.child IS NOT NULL
423 AND R.child IN $theset
424 UNION
425 -- Transition NTDB to trunk
426 SELECT R.rid, R.dbchild
427 FROM revision R
428 WHERE R.rid IN $theset
429 AND R.dbchild IS NOT NULL
430 AND R.dbchild IN $theset
431 UNION
432 -- Secondary (branch) children
433 SELECT R.rid, B.brid
434 FROM revision R, revisionbranchchildren B
435 WHERE R.rid IN $theset
436 AND R.rid = B.rid
437 AND B.brid IN $theset
 
 
 
 
 
 
 
 
 
 
438 "] {
439 # Consider moving this to the integrity module.
440 if {$rid == $child} {
441 trouble internal "Revision $rid depends on itself."
442 }
@@ -458,18 +469,17 @@
458 # (2) S can be a secondary, i.e. branch, child of R. Here the
459 # link is made through the helper table
460 # REVISIONBRANCHCHILDREN. R.rid -> RBC.rid, RBC.brid =
461 # S(.rid)
462 #
463 # (3) If R is the trunk root of its file and S is the root of
464 # the NTDB of the same file, then S is a successor of
465 # R. There is no direct link between the two in the
466 # database. An indirect link can be made through the FILE
467 # they belong too, and their combination of attributes to
468 # identify them. We check R for trunk rootness and then
469 # select for the NTDB root, crossing the table with
470 # itself.
471 #
472 # (4) If R is the last of the NTDB revisions which belong to
473 # the trunk, then the primary child of the trunk root (the
474 # '1.2' revision) is a successor, if it exists.
475
@@ -484,20 +494,10 @@
484 SELECT R.rid, B.brid
485 FROM revision R, revisionbranchchildren B
486 WHERE R.rid IN $theset -- Restrict to revisions of interest
487 AND R.rid = B.rid -- Select subset of branch children
488 UNION
489 -- (3) NTDB root successor of Trunk root
490 SELECT R.rid, RX.rid
491 FROM revision R, revision RX
492 WHERE R.rid IN $theset -- Restrict to revisions of interest
493 AND R.parent IS NULL -- Restrict to root
494 AND NOT R.isdefault -- on the trunk
495 AND R.fid = RX.fid -- Select all revision in the same file
496 AND RX.parent IS NULL -- Restrict to root
497 AND RX.isdefault -- on the NTDB
498 UNION
499 -- (4) Child of trunk root successor of last NTDB on trunk.
500 SELECT R.rid, RA.child
501 FROM revision R, revision RA
502 WHERE R.rid IN $theset -- Restrict to revisions of interest
503 AND R.isdefault -- Restrict to NTDB
@@ -527,11 +527,12 @@
527 # child of P. It not necessary to distinguish the two
528 # cases, in contrast to the code retrieving the successor
529 # information.
530 #
531 # (2) The complement of successor case (3). The trunk root is
532 # a predecessor of a NTDB root.
 
533 #
534 # (3) The complement of successor case (4). The last NTDB
535 # revision belonging to the trunk is a predecessor of the
536 # primary child of the trunk root (The '1.2' revision).
537
@@ -540,20 +541,10 @@
540 SELECT R.rid, R.parent
541 FROM revision R
542 WHERE R.rid IN $theset -- Restrict to revisions of interest
543 AND R.parent IS NOT NULL -- Has primary parent
544 UNION
545 -- (2) Trunk root predecessor of NTDB root.
546 SELECT R.rid, RX.rid
547 FROM revision R, revision RX
548 WHERE R.rid IN $theset -- Restrict to revisions of interest
549 AND R.parent IS NULL -- which are root
550 AND R.isdefault -- on NTDB
551 AND R.fid = RX.fid -- Select all revision in the same file
552 AND RX.parent IS NULL -- which are root
553 AND NOT RX.isdefault -- on the trunk
554 UNION
555 -- (3) Last NTDB on trunk is predecessor of child of trunk root
556 SELECT R.rid, RA.dbparent
557 FROM revision R, revision RA
558 WHERE R.rid IN $theset -- Restrict to revisions of interest
559 AND NOT R.isdefault -- not on NTDB
560
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -407,36 +407,47 @@
407 typemethod loadcounter {} {
408 # Initialize the counter from the state
409 set mycounter [state one { SELECT MAX(cid) FROM changeset }]
410 return
411 }
412
413 typemethod num {} { return $mycounter }
414
415 proc PullInternalSuccessorRevisions {dv revisions} {
416 upvar 1 $dv dependencies
417 set theset ('[join $revisions {','}]')
418
419 # See PullSuccessorRevisions below for the main explanation of
420 # the various cases. This piece is special in that it
421 # restricts the successors we look for to the same set of
422 # revisions we start from. Sensible as we are looking for
423 # changeset internal dependencies.
424
425 foreach {rid child} [state run "
426 -- (1) Primary child
427 SELECT R.rid, R.child
428 FROM revision R
429 WHERE R.rid IN $theset -- Restrict to revisions of interest
430 AND R.child IS NOT NULL -- Has primary child
431 AND R.child IN $theset -- Which is also of interest
432 UNION
433 -- (2) Secondary (branch) children
 
 
 
 
 
 
 
434 SELECT R.rid, B.brid
435 FROM revision R, revisionbranchchildren B
436 WHERE R.rid IN $theset -- Restrict to revisions of interest
437 AND R.rid = B.rid -- Select subset of branch children
438 AND B.brid IN $theset -- Which is also of interest
439 UNION
440 -- (4) Child of trunk root successor of last NTDB on trunk.
441 SELECT R.rid, RA.child
442 FROM revision R, revision RA
443 WHERE R.rid IN $theset -- Restrict to revisions of interest
444 AND R.isdefault -- Restrict to NTDB
445 AND R.dbchild IS NOT NULL -- and last NTDB belonging to trunk
446 AND RA.rid = R.dbchild -- Go directly to trunk root
447 AND RA.child IS NOT NULL -- Has primary child.
448 AND RA.child IN $theset -- Which is also of interest
449 "] {
450 # Consider moving this to the integrity module.
451 if {$rid == $child} {
452 trouble internal "Revision $rid depends on itself."
453 }
@@ -458,18 +469,17 @@
469 # (2) S can be a secondary, i.e. branch, child of R. Here the
470 # link is made through the helper table
471 # REVISIONBRANCHCHILDREN. R.rid -> RBC.rid, RBC.brid =
472 # S(.rid)
473 #
474 # (3) Originally this use case defined the root of a detached
475 # NTDB as the successor of the trunk root. This leads to a
476 # bad tangle later on. With a detached NTDB the original
477 # trunk root revision was removed as irrelevant, allowing
478 # the nominal root to be later in time than the NTDB
479 # root. Now setting this dependency will be backward in
480 # time. REMOVED.
 
481 #
482 # (4) If R is the last of the NTDB revisions which belong to
483 # the trunk, then the primary child of the trunk root (the
484 # '1.2' revision) is a successor, if it exists.
485
@@ -484,20 +494,10 @@
494 SELECT R.rid, B.brid
495 FROM revision R, revisionbranchchildren B
496 WHERE R.rid IN $theset -- Restrict to revisions of interest
497 AND R.rid = B.rid -- Select subset of branch children
498 UNION
 
 
 
 
 
 
 
 
 
 
499 -- (4) Child of trunk root successor of last NTDB on trunk.
500 SELECT R.rid, RA.child
501 FROM revision R, revision RA
502 WHERE R.rid IN $theset -- Restrict to revisions of interest
503 AND R.isdefault -- Restrict to NTDB
@@ -527,11 +527,12 @@
527 # child of P. It not necessary to distinguish the two
528 # cases, in contrast to the code retrieving the successor
529 # information.
530 #
531 # (2) The complement of successor case (3). The trunk root is
532 # a predecessor of a NTDB root. REMOVED. See
533 # PullSuccessorRevisions for the explanation.
534 #
535 # (3) The complement of successor case (4). The last NTDB
536 # revision belonging to the trunk is a predecessor of the
537 # primary child of the trunk root (The '1.2' revision).
538
@@ -540,20 +541,10 @@
541 SELECT R.rid, R.parent
542 FROM revision R
543 WHERE R.rid IN $theset -- Restrict to revisions of interest
544 AND R.parent IS NOT NULL -- Has primary parent
545 UNION
 
 
 
 
 
 
 
 
 
 
546 -- (3) Last NTDB on trunk is predecessor of child of trunk root
547 SELECT R.rid, RA.dbparent
548 FROM revision R, revision RA
549 WHERE R.rid IN $theset -- Restrict to revisions of interest
550 AND NOT R.isdefault -- not on NTDB
551

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button