Fossil SCM

Fix setting of myimported, wrong condition. Fix item assignment when sorting branches. Fix parent/child linkage when setting up branch dependencies. Completed processes on non-trunk default branch revisions. Added skeleton code for the deletion of superfluous revisions.

aku 2007-10-17 03:15 trunk
Commit 177a0cc55c3da003fae4aac6b4800ff73bd08cfa
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -20,10 +20,11 @@
2020
package require snit ; # OO system.
2121
package require struct::set ; # Set operations.
2222
package require vc::fossil::import::cvs::file::rev ; # CVS per file revisions.
2323
package require vc::fossil::import::cvs::file::sym ; # CVS per file symbols.
2424
package require vc::tools::trouble ; # Error reporting.
25
+package require vc::tools::log ; # User feedback
2526
package require vc::tools::misc ; # Text formatting
2627
2728
# # ## ### ##### ######## ############# #####################
2829
##
2930
@@ -175,11 +176,11 @@
175176
# message for the latter, i.e. "Initial revision\n", no
176177
# period. (This fact also helps us when the time comes to
177178
# determine whether this file might have had a default branch
178179
# in the past.)
179180
180
- if {$revnr eq ""} {
181
+ if {$revnr eq "1.1"} {
181182
set myimported [expr {$commitmsg eq "Initial revision\n"}]
182183
}
183184
184185
# Here we also keep track of the order in which the revisions
185186
# were added to the file.
@@ -193,12 +194,17 @@
193194
# looking for a non-trunk default branch, marking its members
194195
# and linking them into the trunk.
195196
196197
DetermineRevisionOperations
197198
DetermineLinesOfDevelopment
199
+ HandleNonTrunkDefaultBranch
200
+ RemoveIrrelevantDeletions
201
+ RemoveInitialBranchDeletions
198202
199
- # list of roots ... first only one, later can become more.
203
+ if {[$myproject trunkonly]} {
204
+ ExcludeNonTrunkInformation
205
+ }
200206
return
201207
}
202208
203209
# # ## ### ##### ######## #############
204210
## State
@@ -246,10 +252,14 @@
246252
# reverse of definition. I.e. a smaller
247253
# number means 'Defined earlier', means
248254
# 'Created later'.
249255
250256
variable mytrunk {} ; # Direct reference to myproject -> trunk.
257
+ variable myroots {} ; # List of roots in the forest of
258
+ # lod's. Object references to revisions and
259
+ # branches. The latter can appear when they
260
+ # are severed from their parent.
251261
252262
# # ## ### ##### ######## #############
253263
## Internal methods
254264
255265
method RecordBranchCommits {branches} {
@@ -364,10 +374,11 @@
364374
# list this child in the parent revision.
365375
366376
if {[$branch haschild]} {
367377
set childrevnr [$branch childrevnr]
368378
set child $myrev($childrevnr)
379
+ $branch setchild $child
369380
370381
$child setparentbranch $branch
371382
$child setparent $rev
372383
$rev addchildonbranch $child
373384
}
@@ -421,10 +432,14 @@
421432
foreach {revnr rev} [array get myrev] {
422433
if {[$rev hasparent]} continue
423434
if {$myroot ne ""} { trouble internal "Multiple root revisions found" }
424435
set myroot $rev
425436
}
437
+
438
+ # In the future we also need a list, as branches can become
439
+ # severed from their parent, making them their own root.
440
+ set myroots [list $myroot]
426441
return
427442
}
428443
429444
proc DetermineRevisionOperations {} {
430445
upvar 1 myrevisions myrevisions
@@ -457,10 +472,259 @@
457472
} else {
458473
upvar 1 self self
459474
return [$self Rev2Branch $revnr]
460475
}
461476
}
477
+
478
+ proc HandleNonTrunkDefaultBranch {} {
479
+ upvar 1 myprincipal myprincipal myroot myroot mybranches mybranches myimported myimported myroots myroots myrev myrev
480
+
481
+ set revlist [NonTrunkDefaultRevisions]
482
+ if {![llength $revlist]} return
483
+
484
+ AdjustNonTrunkDefaultBranch $revlist
485
+ CheckLODs
486
+ return
487
+ }
488
+
489
+ proc NonTrunkDefaultRevisions {} {
490
+ # From cvs2svn the following explanation (with modifications
491
+ # for our algorithm):
492
+
493
+ # Determine whether there are any non-trunk default branch
494
+ # revisions.
495
+
496
+ # If a non-trunk default branch is determined to have existed,
497
+ # return a list of objects for all revisions that were once
498
+ # non-trunk default revisions, in dependency order (i.e. root
499
+ # first).
500
+
501
+ # There are two cases to handle:
502
+
503
+ # One case is simple. The RCS file lists a default branch
504
+ # explicitly in its header, such as '1.1.1'. In this case, we
505
+ # know that every revision on the vendor branch is to be
506
+ # treated as head of trunk at that point in time.
507
+
508
+ # But there's also a degenerate case. The RCS file does not
509
+ # currently have a default branch, yet we can deduce that for
510
+ # some period in the past it probably *did* have one. For
511
+ # example, the file has vendor revisions 1.1.1.1 -> 1.1.1.96,
512
+ # all of which are dated before 1.2, and then it has 1.1.1.97
513
+ # -> 1.1.1.100 dated after 1.2. In this case, we should
514
+ # record 1.1.1.96 as the last vendor revision to have been the
515
+ # head of the default branch.
516
+
517
+ upvar 1 myprincipal myprincipal myroot myroot mybranches mybranches myimported myimported
518
+
519
+ if {$myprincipal ne ""} {
520
+ # There is still a default branch; that means that all
521
+ # revisions on that branch get marked.
522
+
523
+ log write 5 file "Found explicitly marked NTDB"
524
+
525
+ set rnext [$myroot child]
526
+ if {$rnext ne ""} {
527
+ trouble fatal "File with default branch $myprincipal also has revision [$rnext revnr]"
528
+ return
529
+ }
530
+
531
+ set rev [$mybranches($myprincipal) child]
532
+ set res {}
533
+
534
+ while {$rev ne ""} {
535
+ lappend res $rev
536
+ set rev [$rev child]
537
+ }
538
+
539
+ return $res
540
+
541
+ } elseif {$myimported} {
542
+ # No default branch, but the file appears to have been
543
+ # imported. So our educated guess is that all revisions
544
+ # on the '1.1.1' branch with timestamps prior to the
545
+ # timestamp of '1.2' were non-trunk default branch
546
+ # revisions.
547
+
548
+ # This really only processes standard '1.1.1.*'-style
549
+ # vendor revisions. One could conceivably have a file
550
+ # whose default branch is 1.1.3 or whatever, or was that
551
+ # at some point in time, with vendor revisions 1.1.3.1,
552
+ # 1.1.3.2, etc. But with the default branch gone now,
553
+ # we'd have no basis for assuming that the non-standard
554
+ # vendor branch had ever been the default branch anyway.
555
+
556
+ # Note that we rely on comparisons between the timestamps
557
+ # of the revisions on the vendor branch and that of
558
+ # revision 1.2, even though the timestamps might be
559
+ # incorrect due to clock skew. We could do a slightly
560
+ # better job if we used the changeset timestamps, as it is
561
+ # possible that the dependencies that went into
562
+ # determining those timestamps are more accurate. But
563
+ # that would require an extra pass or two.
564
+
565
+ if {![info exists mybranches(1.1.1)]} { return {} }
566
+
567
+ log write 5 file "Deduced existence of NTDB"
568
+
569
+ set rev [$mybranches(1.1.1) child]
570
+ set res {}
571
+ set stop [$myroot child]
572
+
573
+ if {$stop eq ""} {
574
+ # Get everything on the branch
575
+ while {$rev ne ""} {
576
+ lappend res $rev
577
+ set rev [$rev child]
578
+ }
579
+ } else {
580
+ # Collect everything on the branch which seems to have
581
+ # been committed before the first primary child of the
582
+ # root revision.
583
+ set stopdate [$stop date]
584
+ while {$rev ne ""} {
585
+ if {[$rev date] >= $stopdate} break
586
+ lappend res $rev
587
+ set rev [$rev child]
588
+ }
589
+ }
590
+
591
+ return $res
592
+
593
+ } else {
594
+ return {}
595
+ }
596
+ }
597
+
598
+ proc AdjustNonTrunkDefaultBranch {revlist} {
599
+ upvar 1 myroot myroot myimported myimported myroots myroots myrev myrev mybranches mybranches
600
+ set stop [$myroot child] ;# rev '1.2'
601
+
602
+ log write 5 file "Adjusting NTDB containing [nsp [llength $revlist] revision]"
603
+
604
+ # From cvs2svn the following explanation (with modifications
605
+ # for our algorithm):
606
+
607
+ # Adjust the non-trunk default branch revisions found in the
608
+ # 'revlist'.
609
+
610
+ # 'myimported' is a boolean flag indicating whether this file
611
+ # appears to have been imported, which also means that
612
+ # revision 1.1 has a generated log message that need not be
613
+ # preserved. 'revlist' is a list of object references for the
614
+ # revisions that have been determined to be non-trunk default
615
+ # branch revisions.
616
+
617
+ # Note that the first revision on the default branch is
618
+ # handled strangely by CVS. If a file is imported (as opposed
619
+ # to being added), CVS creates a 1.1 revision, then creates a
620
+ # vendor branch 1.1.1 based on 1.1, then creates a 1.1.1.1
621
+ # revision that is identical to the 1.1 revision (i.e., its
622
+ # deltatext is empty). The log message that the user typed
623
+ # when importing is stored with the 1.1.1.1 revision. The 1.1
624
+ # revision always contains a standard, generated log message,
625
+ # 'Initial revision\n'.
626
+
627
+ # When we detect a straightforward import like this, we want
628
+ # to handle it by deleting the 1.1 revision (which doesn't
629
+ # contain any useful information) and making 1.1.1.1 into an
630
+ # independent root in the file's dependency tree. In SVN,
631
+ # 1.1.1.1 will be added directly to the vendor branch with its
632
+ # initial content. Then in a special 'post-commit', the
633
+ # 1.1.1.1 revision is copied back to trunk.
634
+
635
+ # If the user imports again to the same vendor branch, then CVS
636
+ # creates revisions 1.1.1.2, 1.1.1.3, etc. on the vendor branch,
637
+ # *without* counterparts in trunk (even though these revisions
638
+ # effectively play the role of trunk revisions). So after we add
639
+ # such revisions to the vendor branch, we also copy them back to
640
+ # trunk in post-commits.
641
+
642
+ # We mark the revisions found in 'revlist' as default branch
643
+ # revisions. Also, if the root revision has a primary child
644
+ # we set that revision to depend on the last non-trunk default
645
+ # branch revision and possibly adjust its type accordingly.
646
+
647
+ set first [lindex $revlist 0]
648
+
649
+ log write 6 file "<[$first revnr]> [expr {$myimported ? "imported" : "not imported"}], [$first operation], [expr {[$first hastext] ? "has text" : "no text"}]"
650
+
651
+ if {$myimported &&
652
+ [$first revnr] eq "1.1.1.1" &&
653
+ [$first operation] eq "change" &&
654
+ ![$first hastext]} {
655
+
656
+ set rev11 [$first parent] ; # Assert: Should be myroot.
657
+ log write 3 file "Removing irrelevant revision [$rev11 revnr]"
658
+
659
+ # Cut out the old myroot revision.
660
+
661
+ ldelete myroots $rev11 ; # Not a root any longer.
662
+ unset myrev([$rev11 revnr])
663
+
664
+ $first cutfromparent ; # Sever revision from parent revision.
665
+ if {$stop ne ""} {
666
+ $stop cutfromparent
667
+ lappend myroots $stop ; # New root, after vendor branch
668
+ }
669
+
670
+ # Cut out the vendor branch symbol
671
+
672
+ set vendor [$first parentbranch]
673
+ if {$vendor eq ""} { trouble internal "First NTDB revision has no branch" }
674
+ if {[$vendor parent] eq $rev11} {
675
+ unset mybranches([$vendor branchnr])
676
+ $rev11 removebranch $vendor
677
+ $rev11 removechildonbranch $first
678
+ $first cutfromparentbranch
679
+ lappend myroots $first
680
+ }
681
+
682
+ # Change the type of first (typically from Change to Add):
683
+ $first retype add
684
+
685
+ # Move any tags and branches from the old to the new root.
686
+ $rev11 movesymbolsto $first
687
+ }
688
+
689
+ # Mark all the special revisions as such
690
+ foreach rev $revlist {
691
+ log write 3 file "Revision on default branch: [$rev revnr]"
692
+ $rev isondefaultbranch
693
+ }
694
+
695
+ if {$stop ne ""} {
696
+ # Revision 1.2 logically follows the imported revisions,
697
+ # not 1.1. Accordingly, connect it to the last NTDBR and
698
+ # possibly change its type.
699
+
700
+ set last [lindex $revlist end]
701
+ $stop setdefaultbranchparent $last ; # Retypes the revision too.
702
+ $last setdefaultbranchchild $stop
703
+ }
704
+ return
705
+ }
706
+
707
+ proc CheckLODs {} {
708
+ upvar 1 mybranches mybranches mytags mytags
709
+
710
+ foreach {_ branch} [array get mybranches] { $branch checklod }
711
+
712
+ foreach {_ taglist} [array get mytags] {
713
+ foreach tag $taglist { $tag checklod }
714
+ }
715
+ return
716
+ }
717
+
718
+ proc RemoveIrrelevantDeletions {} {
719
+ }
720
+
721
+ proc RemoveInitialBranchDeletions {} {
722
+ }
723
+
724
+ proc ExcludeNonTrunkInformation {} {
725
+ }
462726
463727
# # ## ### ##### ######## #############
464728
## Configuration
465729
466730
pragma -hastypeinfo no ; # no type introspection
@@ -477,13 +741,14 @@
477741
# Import not required, already a child namespace.
478742
# namespace import ::vc::fossil::import::cvs::file::rev
479743
# namespace import ::vc::fossil::import::cvs::file::sym
480744
namespace import ::vc::tools::misc::*
481745
namespace import ::vc::tools::trouble
746
+ namespace import ::vc::tools::log
482747
}
483748
}
484749
485750
# # ## ### ##### ######## ############# #####################
486751
## Ready
487752
488753
package provide vc::fossil::import::cvs::file 1.0
489754
return
490755
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -20,10 +20,11 @@
20 package require snit ; # OO system.
21 package require struct::set ; # Set operations.
22 package require vc::fossil::import::cvs::file::rev ; # CVS per file revisions.
23 package require vc::fossil::import::cvs::file::sym ; # CVS per file symbols.
24 package require vc::tools::trouble ; # Error reporting.
 
25 package require vc::tools::misc ; # Text formatting
26
27 # # ## ### ##### ######## ############# #####################
28 ##
29
@@ -175,11 +176,11 @@
175 # message for the latter, i.e. "Initial revision\n", no
176 # period. (This fact also helps us when the time comes to
177 # determine whether this file might have had a default branch
178 # in the past.)
179
180 if {$revnr eq ""} {
181 set myimported [expr {$commitmsg eq "Initial revision\n"}]
182 }
183
184 # Here we also keep track of the order in which the revisions
185 # were added to the file.
@@ -193,12 +194,17 @@
193 # looking for a non-trunk default branch, marking its members
194 # and linking them into the trunk.
195
196 DetermineRevisionOperations
197 DetermineLinesOfDevelopment
 
 
 
198
199 # list of roots ... first only one, later can become more.
 
 
200 return
201 }
202
203 # # ## ### ##### ######## #############
204 ## State
@@ -246,10 +252,14 @@
246 # reverse of definition. I.e. a smaller
247 # number means 'Defined earlier', means
248 # 'Created later'.
249
250 variable mytrunk {} ; # Direct reference to myproject -> trunk.
 
 
 
 
251
252 # # ## ### ##### ######## #############
253 ## Internal methods
254
255 method RecordBranchCommits {branches} {
@@ -364,10 +374,11 @@
364 # list this child in the parent revision.
365
366 if {[$branch haschild]} {
367 set childrevnr [$branch childrevnr]
368 set child $myrev($childrevnr)
 
369
370 $child setparentbranch $branch
371 $child setparent $rev
372 $rev addchildonbranch $child
373 }
@@ -421,10 +432,14 @@
421 foreach {revnr rev} [array get myrev] {
422 if {[$rev hasparent]} continue
423 if {$myroot ne ""} { trouble internal "Multiple root revisions found" }
424 set myroot $rev
425 }
 
 
 
 
426 return
427 }
428
429 proc DetermineRevisionOperations {} {
430 upvar 1 myrevisions myrevisions
@@ -457,10 +472,259 @@
457 } else {
458 upvar 1 self self
459 return [$self Rev2Branch $revnr]
460 }
461 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
462
463 # # ## ### ##### ######## #############
464 ## Configuration
465
466 pragma -hastypeinfo no ; # no type introspection
@@ -477,13 +741,14 @@
477 # Import not required, already a child namespace.
478 # namespace import ::vc::fossil::import::cvs::file::rev
479 # namespace import ::vc::fossil::import::cvs::file::sym
480 namespace import ::vc::tools::misc::*
481 namespace import ::vc::tools::trouble
 
482 }
483 }
484
485 # # ## ### ##### ######## ############# #####################
486 ## Ready
487
488 package provide vc::fossil::import::cvs::file 1.0
489 return
490
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -20,10 +20,11 @@
20 package require snit ; # OO system.
21 package require struct::set ; # Set operations.
22 package require vc::fossil::import::cvs::file::rev ; # CVS per file revisions.
23 package require vc::fossil::import::cvs::file::sym ; # CVS per file symbols.
24 package require vc::tools::trouble ; # Error reporting.
25 package require vc::tools::log ; # User feedback
26 package require vc::tools::misc ; # Text formatting
27
28 # # ## ### ##### ######## ############# #####################
29 ##
30
@@ -175,11 +176,11 @@
176 # message for the latter, i.e. "Initial revision\n", no
177 # period. (This fact also helps us when the time comes to
178 # determine whether this file might have had a default branch
179 # in the past.)
180
181 if {$revnr eq "1.1"} {
182 set myimported [expr {$commitmsg eq "Initial revision\n"}]
183 }
184
185 # Here we also keep track of the order in which the revisions
186 # were added to the file.
@@ -193,12 +194,17 @@
194 # looking for a non-trunk default branch, marking its members
195 # and linking them into the trunk.
196
197 DetermineRevisionOperations
198 DetermineLinesOfDevelopment
199 HandleNonTrunkDefaultBranch
200 RemoveIrrelevantDeletions
201 RemoveInitialBranchDeletions
202
203 if {[$myproject trunkonly]} {
204 ExcludeNonTrunkInformation
205 }
206 return
207 }
208
209 # # ## ### ##### ######## #############
210 ## State
@@ -246,10 +252,14 @@
252 # reverse of definition. I.e. a smaller
253 # number means 'Defined earlier', means
254 # 'Created later'.
255
256 variable mytrunk {} ; # Direct reference to myproject -> trunk.
257 variable myroots {} ; # List of roots in the forest of
258 # lod's. Object references to revisions and
259 # branches. The latter can appear when they
260 # are severed from their parent.
261
262 # # ## ### ##### ######## #############
263 ## Internal methods
264
265 method RecordBranchCommits {branches} {
@@ -364,10 +374,11 @@
374 # list this child in the parent revision.
375
376 if {[$branch haschild]} {
377 set childrevnr [$branch childrevnr]
378 set child $myrev($childrevnr)
379 $branch setchild $child
380
381 $child setparentbranch $branch
382 $child setparent $rev
383 $rev addchildonbranch $child
384 }
@@ -421,10 +432,14 @@
432 foreach {revnr rev} [array get myrev] {
433 if {[$rev hasparent]} continue
434 if {$myroot ne ""} { trouble internal "Multiple root revisions found" }
435 set myroot $rev
436 }
437
438 # In the future we also need a list, as branches can become
439 # severed from their parent, making them their own root.
440 set myroots [list $myroot]
441 return
442 }
443
444 proc DetermineRevisionOperations {} {
445 upvar 1 myrevisions myrevisions
@@ -457,10 +472,259 @@
472 } else {
473 upvar 1 self self
474 return [$self Rev2Branch $revnr]
475 }
476 }
477
478 proc HandleNonTrunkDefaultBranch {} {
479 upvar 1 myprincipal myprincipal myroot myroot mybranches mybranches myimported myimported myroots myroots myrev myrev
480
481 set revlist [NonTrunkDefaultRevisions]
482 if {![llength $revlist]} return
483
484 AdjustNonTrunkDefaultBranch $revlist
485 CheckLODs
486 return
487 }
488
489 proc NonTrunkDefaultRevisions {} {
490 # From cvs2svn the following explanation (with modifications
491 # for our algorithm):
492
493 # Determine whether there are any non-trunk default branch
494 # revisions.
495
496 # If a non-trunk default branch is determined to have existed,
497 # return a list of objects for all revisions that were once
498 # non-trunk default revisions, in dependency order (i.e. root
499 # first).
500
501 # There are two cases to handle:
502
503 # One case is simple. The RCS file lists a default branch
504 # explicitly in its header, such as '1.1.1'. In this case, we
505 # know that every revision on the vendor branch is to be
506 # treated as head of trunk at that point in time.
507
508 # But there's also a degenerate case. The RCS file does not
509 # currently have a default branch, yet we can deduce that for
510 # some period in the past it probably *did* have one. For
511 # example, the file has vendor revisions 1.1.1.1 -> 1.1.1.96,
512 # all of which are dated before 1.2, and then it has 1.1.1.97
513 # -> 1.1.1.100 dated after 1.2. In this case, we should
514 # record 1.1.1.96 as the last vendor revision to have been the
515 # head of the default branch.
516
517 upvar 1 myprincipal myprincipal myroot myroot mybranches mybranches myimported myimported
518
519 if {$myprincipal ne ""} {
520 # There is still a default branch; that means that all
521 # revisions on that branch get marked.
522
523 log write 5 file "Found explicitly marked NTDB"
524
525 set rnext [$myroot child]
526 if {$rnext ne ""} {
527 trouble fatal "File with default branch $myprincipal also has revision [$rnext revnr]"
528 return
529 }
530
531 set rev [$mybranches($myprincipal) child]
532 set res {}
533
534 while {$rev ne ""} {
535 lappend res $rev
536 set rev [$rev child]
537 }
538
539 return $res
540
541 } elseif {$myimported} {
542 # No default branch, but the file appears to have been
543 # imported. So our educated guess is that all revisions
544 # on the '1.1.1' branch with timestamps prior to the
545 # timestamp of '1.2' were non-trunk default branch
546 # revisions.
547
548 # This really only processes standard '1.1.1.*'-style
549 # vendor revisions. One could conceivably have a file
550 # whose default branch is 1.1.3 or whatever, or was that
551 # at some point in time, with vendor revisions 1.1.3.1,
552 # 1.1.3.2, etc. But with the default branch gone now,
553 # we'd have no basis for assuming that the non-standard
554 # vendor branch had ever been the default branch anyway.
555
556 # Note that we rely on comparisons between the timestamps
557 # of the revisions on the vendor branch and that of
558 # revision 1.2, even though the timestamps might be
559 # incorrect due to clock skew. We could do a slightly
560 # better job if we used the changeset timestamps, as it is
561 # possible that the dependencies that went into
562 # determining those timestamps are more accurate. But
563 # that would require an extra pass or two.
564
565 if {![info exists mybranches(1.1.1)]} { return {} }
566
567 log write 5 file "Deduced existence of NTDB"
568
569 set rev [$mybranches(1.1.1) child]
570 set res {}
571 set stop [$myroot child]
572
573 if {$stop eq ""} {
574 # Get everything on the branch
575 while {$rev ne ""} {
576 lappend res $rev
577 set rev [$rev child]
578 }
579 } else {
580 # Collect everything on the branch which seems to have
581 # been committed before the first primary child of the
582 # root revision.
583 set stopdate [$stop date]
584 while {$rev ne ""} {
585 if {[$rev date] >= $stopdate} break
586 lappend res $rev
587 set rev [$rev child]
588 }
589 }
590
591 return $res
592
593 } else {
594 return {}
595 }
596 }
597
598 proc AdjustNonTrunkDefaultBranch {revlist} {
599 upvar 1 myroot myroot myimported myimported myroots myroots myrev myrev mybranches mybranches
600 set stop [$myroot child] ;# rev '1.2'
601
602 log write 5 file "Adjusting NTDB containing [nsp [llength $revlist] revision]"
603
604 # From cvs2svn the following explanation (with modifications
605 # for our algorithm):
606
607 # Adjust the non-trunk default branch revisions found in the
608 # 'revlist'.
609
610 # 'myimported' is a boolean flag indicating whether this file
611 # appears to have been imported, which also means that
612 # revision 1.1 has a generated log message that need not be
613 # preserved. 'revlist' is a list of object references for the
614 # revisions that have been determined to be non-trunk default
615 # branch revisions.
616
617 # Note that the first revision on the default branch is
618 # handled strangely by CVS. If a file is imported (as opposed
619 # to being added), CVS creates a 1.1 revision, then creates a
620 # vendor branch 1.1.1 based on 1.1, then creates a 1.1.1.1
621 # revision that is identical to the 1.1 revision (i.e., its
622 # deltatext is empty). The log message that the user typed
623 # when importing is stored with the 1.1.1.1 revision. The 1.1
624 # revision always contains a standard, generated log message,
625 # 'Initial revision\n'.
626
627 # When we detect a straightforward import like this, we want
628 # to handle it by deleting the 1.1 revision (which doesn't
629 # contain any useful information) and making 1.1.1.1 into an
630 # independent root in the file's dependency tree. In SVN,
631 # 1.1.1.1 will be added directly to the vendor branch with its
632 # initial content. Then in a special 'post-commit', the
633 # 1.1.1.1 revision is copied back to trunk.
634
635 # If the user imports again to the same vendor branch, then CVS
636 # creates revisions 1.1.1.2, 1.1.1.3, etc. on the vendor branch,
637 # *without* counterparts in trunk (even though these revisions
638 # effectively play the role of trunk revisions). So after we add
639 # such revisions to the vendor branch, we also copy them back to
640 # trunk in post-commits.
641
642 # We mark the revisions found in 'revlist' as default branch
643 # revisions. Also, if the root revision has a primary child
644 # we set that revision to depend on the last non-trunk default
645 # branch revision and possibly adjust its type accordingly.
646
647 set first [lindex $revlist 0]
648
649 log write 6 file "<[$first revnr]> [expr {$myimported ? "imported" : "not imported"}], [$first operation], [expr {[$first hastext] ? "has text" : "no text"}]"
650
651 if {$myimported &&
652 [$first revnr] eq "1.1.1.1" &&
653 [$first operation] eq "change" &&
654 ![$first hastext]} {
655
656 set rev11 [$first parent] ; # Assert: Should be myroot.
657 log write 3 file "Removing irrelevant revision [$rev11 revnr]"
658
659 # Cut out the old myroot revision.
660
661 ldelete myroots $rev11 ; # Not a root any longer.
662 unset myrev([$rev11 revnr])
663
664 $first cutfromparent ; # Sever revision from parent revision.
665 if {$stop ne ""} {
666 $stop cutfromparent
667 lappend myroots $stop ; # New root, after vendor branch
668 }
669
670 # Cut out the vendor branch symbol
671
672 set vendor [$first parentbranch]
673 if {$vendor eq ""} { trouble internal "First NTDB revision has no branch" }
674 if {[$vendor parent] eq $rev11} {
675 unset mybranches([$vendor branchnr])
676 $rev11 removebranch $vendor
677 $rev11 removechildonbranch $first
678 $first cutfromparentbranch
679 lappend myroots $first
680 }
681
682 # Change the type of first (typically from Change to Add):
683 $first retype add
684
685 # Move any tags and branches from the old to the new root.
686 $rev11 movesymbolsto $first
687 }
688
689 # Mark all the special revisions as such
690 foreach rev $revlist {
691 log write 3 file "Revision on default branch: [$rev revnr]"
692 $rev isondefaultbranch
693 }
694
695 if {$stop ne ""} {
696 # Revision 1.2 logically follows the imported revisions,
697 # not 1.1. Accordingly, connect it to the last NTDBR and
698 # possibly change its type.
699
700 set last [lindex $revlist end]
701 $stop setdefaultbranchparent $last ; # Retypes the revision too.
702 $last setdefaultbranchchild $stop
703 }
704 return
705 }
706
707 proc CheckLODs {} {
708 upvar 1 mybranches mybranches mytags mytags
709
710 foreach {_ branch} [array get mybranches] { $branch checklod }
711
712 foreach {_ taglist} [array get mytags] {
713 foreach tag $taglist { $tag checklod }
714 }
715 return
716 }
717
718 proc RemoveIrrelevantDeletions {} {
719 }
720
721 proc RemoveInitialBranchDeletions {} {
722 }
723
724 proc ExcludeNonTrunkInformation {} {
725 }
726
727 # # ## ### ##### ######## #############
728 ## Configuration
729
730 pragma -hastypeinfo no ; # no type introspection
@@ -477,13 +741,14 @@
741 # Import not required, already a child namespace.
742 # namespace import ::vc::fossil::import::cvs::file::rev
743 # namespace import ::vc::fossil::import::cvs::file::sym
744 namespace import ::vc::tools::misc::*
745 namespace import ::vc::tools::trouble
746 namespace import ::vc::tools::log
747 }
748 }
749
750 # # ## ### ##### ######## ############# #####################
751 ## Ready
752
753 package provide vc::fossil::import::cvs::file 1.0
754 return
755
--- tools/cvs2fossil/lib/c2f_frev.tcl
+++ tools/cvs2fossil/lib/c2f_frev.tcl
@@ -15,10 +15,11 @@
1515
# # ## ### ##### ######## ############# #####################
1616
## Requirements
1717
1818
package require Tcl 8.4 ; # Required runtime.
1919
package require snit ; # OO system.
20
+package require vc::tools::misc ; # Text formatting
2021
2122
# # ## ### ##### ######## ############# #####################
2223
##
2324
2425
snit::type ::vc::fossil::import::cvs::file::rev {
@@ -34,18 +35,24 @@
3435
return
3536
}
3637
3738
# Basic pieces ________________________
3839
39
- method hasmeta {} { return [expr {$mymetaid ne ""}] }
40
+ method hasmeta {} { return [expr {$mymetaid ne ""}] }
41
+ method hastext {} {
42
+ struct::list assign $mytext s e
43
+ return [expr {$s <= $e}]
44
+ }
45
+
4046
method setmeta {meta} { set mymetaid $meta ; return }
4147
method settext {text} { set mytext $text ; return }
4248
method setlod {lod} { set mylod $lod ; return }
4349
4450
method revnr {} { return $myrevnr }
4551
method state {} { return $mystate }
4652
method lod {} { return $mylod }
53
+ method date {} { return $mydate }
4754
4855
# Basic parent/child linkage __________
4956
5057
method hasparent {} { return [expr {$myparent ne ""}] }
5158
method haschild {} { return [expr {$mychild ne ""}] }
@@ -53,10 +60,13 @@
5360
method setparent {parent} {
5461
if {$myparent ne ""} { trouble internal "Parent already defined" }
5562
set myparent $parent
5663
return
5764
}
65
+
66
+ method cutfromparent {} { set myparent "" ; return }
67
+ method cutfromchild {} { set mychild "" ; return }
5868
5969
method setchild {child} {
6070
if {$mychild ne ""} { trouble internal "Child already defined" }
6171
set mychild $child
6272
return
@@ -71,25 +81,31 @@
7181
if {$myparentbranch ne ""} { trouble internal "Branch parent already defined" }
7282
set myparentbranch $branch
7383
return
7484
}
7585
86
+ method parentbranch {} { return $myparentbranch }
87
+
7688
method addbranch {branch} {
7789
lappend mybranches $branch
78
- #sorted in ascending order by branch number?
7990
return
8091
}
8192
8293
method addchildonbranch {child} {
8394
lappend mybranchchildren $child
8495
return
8596
}
8697
87
- # Tag linkage _________________________
98
+ method cutfromparentbranch {} { set myparentbranch "" ; return }
99
+
100
+ method removebranch {branch} {
101
+ ldelete mybranches $branch
102
+ return
103
+ }
88104
89
- method addtag {tag} {
90
- lappend mytags $tag
105
+ method removechildonbranch {rev} {
106
+ ldelete mybranchchildren $rev
91107
return
92108
}
93109
94110
method sortbranches {} {
95111
if {![llength $mybranches]} return
@@ -109,16 +125,64 @@
109125
lappend tmp [list $branch [$branch position]]
110126
}
111127
112128
set mybranches {}
113129
foreach item [lsort -index 1 -decreasing $tmp] {
114
- struct::list assign $item -> branch position
130
+ struct::list assign $item branch position
115131
lappend mybranches $branch
116132
}
117133
return
118134
}
119135
136
+ method movebranchesto {rev} {
137
+ set revlod [$rev lod]
138
+ foreach branch $mybranches {
139
+ $rev addbranch $branch
140
+ $branch setparent $rev
141
+ $branch setlod $revlod
142
+ }
143
+ foreach branchrev $mybranchchildren {
144
+ $rev addchildonbranch $branchrev
145
+ $branchrev cutfromparent
146
+ $branchrev setparent $rev
147
+ }
148
+ set mybranches {}
149
+ set mybranchchildren {}
150
+ return
151
+ }
152
+
153
+ # Tag linkage _________________________
154
+
155
+ method addtag {tag} {
156
+ lappend mytags $tag
157
+ return
158
+ }
159
+
160
+ method movetagsto {rev} {
161
+ set revlod [$rev lod]
162
+ foreach tag $mytags {
163
+ $rev addtag $tag
164
+ $tag settagrev $rev
165
+ $tag setlod $revlod
166
+ }
167
+ set mytags {}
168
+ return
169
+ }
170
+
171
+ # general symbol operations ___________
172
+
173
+ method movesymbolsto {rev} {
174
+ # Move the tags and branches attached to this revision to the
175
+ # destination and fix all pointers.
176
+
177
+ $self movetagsto $rev
178
+ $self movebranchesto $rev
179
+ return
180
+ }
181
+
182
+ # Derived stuff _______________________
183
+
120184
method determineoperation {} {
121185
# Look at the state of both this revision and its parent to
122186
# determine the type opf operation which was performed (add,
123187
# modify, delete, none).
124188
#
@@ -129,10 +193,27 @@
129193
set pdead [expr {$myparent eq "" || [$myparent state] eq "dead"}]
130194
131195
set myoperation $myopstate([list $pdead $sdead])
132196
return
133197
}
198
+
199
+ method operation {} { return $myoperation }
200
+ method retype {x} { set myoperation $x ; return }
201
+
202
+ method isondefaultbranch {} { set myisondefaultbranch 1 ; return }
203
+
204
+ method setdefaultbranchchild {rev} { set mydbchild $rev ; return }
205
+ method setdefaultbranchparent {rev} {
206
+ set mydbparent $rev
207
+
208
+ # Retype the revision (may change from 'add' to 'change').
209
+
210
+ set sdead [expr {$myoperation ne "change"}]
211
+ set pdead [expr {[$rev operation] ne "change"}]
212
+ set myoperation $myopstate([list $pdead $sdead])
213
+ return
214
+ }
134215
135216
# # ## ### ##### ######## #############
136217
## Type API
137218
138219
typemethod istrunkrevnr {revnr} {
@@ -234,13 +315,25 @@
234315
235316
variable mytags {} ; # List of tags (objs) associated with this revision.
236317
237318
# More derived data
238319
239
- variable myoperation {} ; # One of 'add', 'change', 'delete', or
240
- # 'nothing'. Derived from our and its
241
- # parent's state.
320
+ variable myoperation {} ; # One of 'add', 'change', 'delete', or
321
+ # 'nothing'. Derived from our and
322
+ # its parent's state.
323
+ variable myisondefaultbranch 0 ; # Boolean flag, set if the
324
+ # revision is on the non-trunk
325
+ # default branch, aka vendor
326
+ # branch.
327
+ variable mydbparent {} ; # Reference to the last revision
328
+ # on the vendor branch if this is
329
+ # the primary child of the
330
+ # regular root.
331
+ variable mydbchild {} ; # Reference to the primary child
332
+ # of the regular root if this is
333
+ # the last revision on the vendor
334
+ # branch.
242335
243336
# dead(self) x dead(parent) -> operation
244337
typevariable myopstate -array {
245338
{0 0} change
246339
{0 1} delete
@@ -261,12 +354,15 @@
261354
# # ## ### ##### ######## #############
262355
}
263356
264357
namespace eval ::vc::fossil::import::cvs::file {
265358
namespace export rev
359
+ namespace eval rev {
360
+ namespace import ::vc::tools::misc::*
361
+ }
266362
}
267363
268364
# # ## ### ##### ######## ############# #####################
269365
## Ready
270366
271367
package provide vc::fossil::import::cvs::file::rev 1.0
272368
return
273369
--- tools/cvs2fossil/lib/c2f_frev.tcl
+++ tools/cvs2fossil/lib/c2f_frev.tcl
@@ -15,10 +15,11 @@
15 # # ## ### ##### ######## ############# #####################
16 ## Requirements
17
18 package require Tcl 8.4 ; # Required runtime.
19 package require snit ; # OO system.
 
20
21 # # ## ### ##### ######## ############# #####################
22 ##
23
24 snit::type ::vc::fossil::import::cvs::file::rev {
@@ -34,18 +35,24 @@
34 return
35 }
36
37 # Basic pieces ________________________
38
39 method hasmeta {} { return [expr {$mymetaid ne ""}] }
 
 
 
 
 
40 method setmeta {meta} { set mymetaid $meta ; return }
41 method settext {text} { set mytext $text ; return }
42 method setlod {lod} { set mylod $lod ; return }
43
44 method revnr {} { return $myrevnr }
45 method state {} { return $mystate }
46 method lod {} { return $mylod }
 
47
48 # Basic parent/child linkage __________
49
50 method hasparent {} { return [expr {$myparent ne ""}] }
51 method haschild {} { return [expr {$mychild ne ""}] }
@@ -53,10 +60,13 @@
53 method setparent {parent} {
54 if {$myparent ne ""} { trouble internal "Parent already defined" }
55 set myparent $parent
56 return
57 }
 
 
 
58
59 method setchild {child} {
60 if {$mychild ne ""} { trouble internal "Child already defined" }
61 set mychild $child
62 return
@@ -71,25 +81,31 @@
71 if {$myparentbranch ne ""} { trouble internal "Branch parent already defined" }
72 set myparentbranch $branch
73 return
74 }
75
 
 
76 method addbranch {branch} {
77 lappend mybranches $branch
78 #sorted in ascending order by branch number?
79 return
80 }
81
82 method addchildonbranch {child} {
83 lappend mybranchchildren $child
84 return
85 }
86
87 # Tag linkage _________________________
 
 
 
 
 
88
89 method addtag {tag} {
90 lappend mytags $tag
91 return
92 }
93
94 method sortbranches {} {
95 if {![llength $mybranches]} return
@@ -109,16 +125,64 @@
109 lappend tmp [list $branch [$branch position]]
110 }
111
112 set mybranches {}
113 foreach item [lsort -index 1 -decreasing $tmp] {
114 struct::list assign $item -> branch position
115 lappend mybranches $branch
116 }
117 return
118 }
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120 method determineoperation {} {
121 # Look at the state of both this revision and its parent to
122 # determine the type opf operation which was performed (add,
123 # modify, delete, none).
124 #
@@ -129,10 +193,27 @@
129 set pdead [expr {$myparent eq "" || [$myparent state] eq "dead"}]
130
131 set myoperation $myopstate([list $pdead $sdead])
132 return
133 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
135 # # ## ### ##### ######## #############
136 ## Type API
137
138 typemethod istrunkrevnr {revnr} {
@@ -234,13 +315,25 @@
234
235 variable mytags {} ; # List of tags (objs) associated with this revision.
236
237 # More derived data
238
239 variable myoperation {} ; # One of 'add', 'change', 'delete', or
240 # 'nothing'. Derived from our and its
241 # parent's state.
 
 
 
 
 
 
 
 
 
 
 
 
242
243 # dead(self) x dead(parent) -> operation
244 typevariable myopstate -array {
245 {0 0} change
246 {0 1} delete
@@ -261,12 +354,15 @@
261 # # ## ### ##### ######## #############
262 }
263
264 namespace eval ::vc::fossil::import::cvs::file {
265 namespace export rev
 
 
 
266 }
267
268 # # ## ### ##### ######## ############# #####################
269 ## Ready
270
271 package provide vc::fossil::import::cvs::file::rev 1.0
272 return
273
--- tools/cvs2fossil/lib/c2f_frev.tcl
+++ tools/cvs2fossil/lib/c2f_frev.tcl
@@ -15,10 +15,11 @@
15 # # ## ### ##### ######## ############# #####################
16 ## Requirements
17
18 package require Tcl 8.4 ; # Required runtime.
19 package require snit ; # OO system.
20 package require vc::tools::misc ; # Text formatting
21
22 # # ## ### ##### ######## ############# #####################
23 ##
24
25 snit::type ::vc::fossil::import::cvs::file::rev {
@@ -34,18 +35,24 @@
35 return
36 }
37
38 # Basic pieces ________________________
39
40 method hasmeta {} { return [expr {$mymetaid ne ""}] }
41 method hastext {} {
42 struct::list assign $mytext s e
43 return [expr {$s <= $e}]
44 }
45
46 method setmeta {meta} { set mymetaid $meta ; return }
47 method settext {text} { set mytext $text ; return }
48 method setlod {lod} { set mylod $lod ; return }
49
50 method revnr {} { return $myrevnr }
51 method state {} { return $mystate }
52 method lod {} { return $mylod }
53 method date {} { return $mydate }
54
55 # Basic parent/child linkage __________
56
57 method hasparent {} { return [expr {$myparent ne ""}] }
58 method haschild {} { return [expr {$mychild ne ""}] }
@@ -53,10 +60,13 @@
60 method setparent {parent} {
61 if {$myparent ne ""} { trouble internal "Parent already defined" }
62 set myparent $parent
63 return
64 }
65
66 method cutfromparent {} { set myparent "" ; return }
67 method cutfromchild {} { set mychild "" ; return }
68
69 method setchild {child} {
70 if {$mychild ne ""} { trouble internal "Child already defined" }
71 set mychild $child
72 return
@@ -71,25 +81,31 @@
81 if {$myparentbranch ne ""} { trouble internal "Branch parent already defined" }
82 set myparentbranch $branch
83 return
84 }
85
86 method parentbranch {} { return $myparentbranch }
87
88 method addbranch {branch} {
89 lappend mybranches $branch
 
90 return
91 }
92
93 method addchildonbranch {child} {
94 lappend mybranchchildren $child
95 return
96 }
97
98 method cutfromparentbranch {} { set myparentbranch "" ; return }
99
100 method removebranch {branch} {
101 ldelete mybranches $branch
102 return
103 }
104
105 method removechildonbranch {rev} {
106 ldelete mybranchchildren $rev
107 return
108 }
109
110 method sortbranches {} {
111 if {![llength $mybranches]} return
@@ -109,16 +125,64 @@
125 lappend tmp [list $branch [$branch position]]
126 }
127
128 set mybranches {}
129 foreach item [lsort -index 1 -decreasing $tmp] {
130 struct::list assign $item branch position
131 lappend mybranches $branch
132 }
133 return
134 }
135
136 method movebranchesto {rev} {
137 set revlod [$rev lod]
138 foreach branch $mybranches {
139 $rev addbranch $branch
140 $branch setparent $rev
141 $branch setlod $revlod
142 }
143 foreach branchrev $mybranchchildren {
144 $rev addchildonbranch $branchrev
145 $branchrev cutfromparent
146 $branchrev setparent $rev
147 }
148 set mybranches {}
149 set mybranchchildren {}
150 return
151 }
152
153 # Tag linkage _________________________
154
155 method addtag {tag} {
156 lappend mytags $tag
157 return
158 }
159
160 method movetagsto {rev} {
161 set revlod [$rev lod]
162 foreach tag $mytags {
163 $rev addtag $tag
164 $tag settagrev $rev
165 $tag setlod $revlod
166 }
167 set mytags {}
168 return
169 }
170
171 # general symbol operations ___________
172
173 method movesymbolsto {rev} {
174 # Move the tags and branches attached to this revision to the
175 # destination and fix all pointers.
176
177 $self movetagsto $rev
178 $self movebranchesto $rev
179 return
180 }
181
182 # Derived stuff _______________________
183
184 method determineoperation {} {
185 # Look at the state of both this revision and its parent to
186 # determine the type opf operation which was performed (add,
187 # modify, delete, none).
188 #
@@ -129,10 +193,27 @@
193 set pdead [expr {$myparent eq "" || [$myparent state] eq "dead"}]
194
195 set myoperation $myopstate([list $pdead $sdead])
196 return
197 }
198
199 method operation {} { return $myoperation }
200 method retype {x} { set myoperation $x ; return }
201
202 method isondefaultbranch {} { set myisondefaultbranch 1 ; return }
203
204 method setdefaultbranchchild {rev} { set mydbchild $rev ; return }
205 method setdefaultbranchparent {rev} {
206 set mydbparent $rev
207
208 # Retype the revision (may change from 'add' to 'change').
209
210 set sdead [expr {$myoperation ne "change"}]
211 set pdead [expr {[$rev operation] ne "change"}]
212 set myoperation $myopstate([list $pdead $sdead])
213 return
214 }
215
216 # # ## ### ##### ######## #############
217 ## Type API
218
219 typemethod istrunkrevnr {revnr} {
@@ -234,13 +315,25 @@
315
316 variable mytags {} ; # List of tags (objs) associated with this revision.
317
318 # More derived data
319
320 variable myoperation {} ; # One of 'add', 'change', 'delete', or
321 # 'nothing'. Derived from our and
322 # its parent's state.
323 variable myisondefaultbranch 0 ; # Boolean flag, set if the
324 # revision is on the non-trunk
325 # default branch, aka vendor
326 # branch.
327 variable mydbparent {} ; # Reference to the last revision
328 # on the vendor branch if this is
329 # the primary child of the
330 # regular root.
331 variable mydbchild {} ; # Reference to the primary child
332 # of the regular root if this is
333 # the last revision on the vendor
334 # branch.
335
336 # dead(self) x dead(parent) -> operation
337 typevariable myopstate -array {
338 {0 0} change
339 {0 1} delete
@@ -261,12 +354,15 @@
354 # # ## ### ##### ######## #############
355 }
356
357 namespace eval ::vc::fossil::import::cvs::file {
358 namespace export rev
359 namespace eval rev {
360 namespace import ::vc::tools::misc::*
361 }
362 }
363
364 # # ## ### ##### ######## ############# #####################
365 ## Ready
366
367 package provide vc::fossil::import::cvs::file::rev 1.0
368 return
369
--- tools/cvs2fossil/lib/c2f_fsym.tcl
+++ tools/cvs2fossil/lib/c2f_fsym.tcl
@@ -53,17 +53,20 @@
5353
return
5454
}
5555
5656
method setposition {n} { set mybranchposition $n ; return }
5757
method setparent {rev} { set mybranchparent $rev ; return }
58
+ method setchild {rev} { set mybranchchild $rev ; return }
5859
5960
method branchnr {} { return $mynr }
6061
method parentrevnr {} { return $mybranchparentrevnr }
6162
method childrevnr {} { return $mybranchchildrevnr }
6263
method haschild {} { return [expr {$mybranchchildrevnr ne ""}] }
64
+ method parent {} { return $mybranchparent }
6365
method child {} { return $mybranchchild }
6466
method position {} { return $mybranchposition }
67
+
6568
6669
# Tag acessor methods.
6770
6871
method tagrevnr {} { return $mynr }
6972
method settagrev {rev} {set mytagrev $rev ; return }
@@ -72,22 +75,26 @@
7275
7376
method lod {} { return $mylod }
7477
7578
method setlod {lod} {
7679
set mylod $lod
80
+ $self checklod
81
+ return
82
+ }
7783
78
- # Consistency check integrated. The symbol's
79
- # line-of-development has to be same as the
80
- # line-of-development of its source.
84
+ method checklod {} {
85
+ # Consistency check. The symbol's line-of-development has to
86
+ # be same as the line-of-development of its source (parent
87
+ # revision of a branch, revision of a tag itself).
8188
8289
switch -exact -- $mytype {
8390
branch { set slod [$mybranchparent lod] }
8491
tag { set slod [$mytagrev lod] }
8592
}
8693
8794
if {$mylod ne $slod} {
88
- trouble fatal "For [$mysymbol name]: LOD conflict with source, '[$mylod name]' vs. '[$slod name]'"
95
+ trouble fatal "For $mytype [$mysymbol name]: LOD conflict with source, '[$mylod name]' vs. '[$slod name]'"
8996
return
9097
}
9198
return
9299
}
93100
@@ -103,11 +110,12 @@
103110
# symbol at the project level.
104111
variable mylod {} ; # Reference to the line-of-development
105112
# object the symbol belongs to. An
106113
# alternative idiom would be to call it the
107114
# branch the symbol is on. This reference
108
- # is to a project-level symbol object.
115
+ # is to a project-level object (symbol or
116
+ # trunk).
109117
110118
## Branch symbols _____________________
111119
112120
variable mybranchparentrevnr {} ; # The number of the parent
113121
# revision, derived from our
114122
--- tools/cvs2fossil/lib/c2f_fsym.tcl
+++ tools/cvs2fossil/lib/c2f_fsym.tcl
@@ -53,17 +53,20 @@
53 return
54 }
55
56 method setposition {n} { set mybranchposition $n ; return }
57 method setparent {rev} { set mybranchparent $rev ; return }
 
58
59 method branchnr {} { return $mynr }
60 method parentrevnr {} { return $mybranchparentrevnr }
61 method childrevnr {} { return $mybranchchildrevnr }
62 method haschild {} { return [expr {$mybranchchildrevnr ne ""}] }
 
63 method child {} { return $mybranchchild }
64 method position {} { return $mybranchposition }
 
65
66 # Tag acessor methods.
67
68 method tagrevnr {} { return $mynr }
69 method settagrev {rev} {set mytagrev $rev ; return }
@@ -72,22 +75,26 @@
72
73 method lod {} { return $mylod }
74
75 method setlod {lod} {
76 set mylod $lod
 
 
 
77
78 # Consistency check integrated. The symbol's
79 # line-of-development has to be same as the
80 # line-of-development of its source.
 
81
82 switch -exact -- $mytype {
83 branch { set slod [$mybranchparent lod] }
84 tag { set slod [$mytagrev lod] }
85 }
86
87 if {$mylod ne $slod} {
88 trouble fatal "For [$mysymbol name]: LOD conflict with source, '[$mylod name]' vs. '[$slod name]'"
89 return
90 }
91 return
92 }
93
@@ -103,11 +110,12 @@
103 # symbol at the project level.
104 variable mylod {} ; # Reference to the line-of-development
105 # object the symbol belongs to. An
106 # alternative idiom would be to call it the
107 # branch the symbol is on. This reference
108 # is to a project-level symbol object.
 
109
110 ## Branch symbols _____________________
111
112 variable mybranchparentrevnr {} ; # The number of the parent
113 # revision, derived from our
114
--- tools/cvs2fossil/lib/c2f_fsym.tcl
+++ tools/cvs2fossil/lib/c2f_fsym.tcl
@@ -53,17 +53,20 @@
53 return
54 }
55
56 method setposition {n} { set mybranchposition $n ; return }
57 method setparent {rev} { set mybranchparent $rev ; return }
58 method setchild {rev} { set mybranchchild $rev ; return }
59
60 method branchnr {} { return $mynr }
61 method parentrevnr {} { return $mybranchparentrevnr }
62 method childrevnr {} { return $mybranchchildrevnr }
63 method haschild {} { return [expr {$mybranchchildrevnr ne ""}] }
64 method parent {} { return $mybranchparent }
65 method child {} { return $mybranchchild }
66 method position {} { return $mybranchposition }
67
68
69 # Tag acessor methods.
70
71 method tagrevnr {} { return $mynr }
72 method settagrev {rev} {set mytagrev $rev ; return }
@@ -72,22 +75,26 @@
75
76 method lod {} { return $mylod }
77
78 method setlod {lod} {
79 set mylod $lod
80 $self checklod
81 return
82 }
83
84 method checklod {} {
85 # Consistency check. The symbol's line-of-development has to
86 # be same as the line-of-development of its source (parent
87 # revision of a branch, revision of a tag itself).
88
89 switch -exact -- $mytype {
90 branch { set slod [$mybranchparent lod] }
91 tag { set slod [$mytagrev lod] }
92 }
93
94 if {$mylod ne $slod} {
95 trouble fatal "For $mytype [$mysymbol name]: LOD conflict with source, '[$mylod name]' vs. '[$slod name]'"
96 return
97 }
98 return
99 }
100
@@ -103,11 +110,12 @@
110 # symbol at the project level.
111 variable mylod {} ; # Reference to the line-of-development
112 # object the symbol belongs to. An
113 # alternative idiom would be to call it the
114 # branch the symbol is on. This reference
115 # is to a project-level object (symbol or
116 # trunk).
117
118 ## Branch symbols _____________________
119
120 variable mybranchparentrevnr {} ; # The number of the parent
121 # revision, derived from our
122

Keyboard Shortcuts

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