Fossil

Check-in [0af7a3c8]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Easier name for self-referential changesets, loopcheck. Made conditional on option --loopcheck, default off, and avoided if the general checks on changesets report trouble. Reinstated the loop check in the cycle breaker core in simpler form, reusing the new command in the changeset class.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0af7a3c8acfdfce52ff74a7949db128303c3c3da
User & Date: aku 2007-11-30 06:57:19
Context
2007-11-30
15:20
Fixed typo of keyword. check-in: 3db03be6 user: aku tags: trunk
06:57
Easier name for self-referential changesets, loopcheck. Made conditional on option --loopcheck, default off, and avoided if the general checks on changesets report trouble. Reinstated the loop check in the cycle breaker core in simpler form, reusing the new command in the changeset class. check-in: 0af7a3c8 user: aku tags: trunk
06:50
Moved the integrity checks for split fragments into separate command. Reworked breaking of internal dependencies to contrain the length of the pending list. That part of the system is still a memory hog, especially for large changesets. Added notes about this and the successor retrieval being a bottleneck. check-in: c14e8f84 user: aku tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tools/cvs2fossil/lib/c2f_cyclebreaker.tcl.

22
23
24
25
26
27
28

29
30
31
32
33
34
35
...
195
196
197
198
199
200
201




202
203
204
205
206
207
208
...
414
415
416
417
418
419
420




421
422
423
424
425
426
427
...
537
538
539
540
541
542
543

544
545
546
547
548
549
550
package require struct::list                              ; # Higher order list operations.
package require vc::tools::dot                            ; # User feedback. DOT export.
package require vc::tools::log                            ; # User feedback.
package require vc::tools::trouble                        ; # Error reporting.
package require vc::tools::misc                           ; # Text formatting.
package require vc::fossil::import::cvs::project::rev     ; # Project level changesets
package require vc::fossil::import::cvs::project::revlink ; # Cycle links.


# # ## ### ##### ######## ############# #####################
##

snit::type ::vc::fossil::import::cvs::cyclebreaker {
    # # ## ### ##### ######## #############
    ## Public API
................................................................................

	foreach cset $changesets {
	    foreach succ [$cset successors] {
		# Changesets may have dependencies outside of the
		# chosen set. These are ignored
		if {![$dg node exists $succ]} continue
		$dg arc insert $cset $succ




	    }
	}

	if {$log} {
	    log write 3 cyclebreaker "Has [nsp [llength [$dg arcs]] dependency dependencies]"
	}

................................................................................

	foreach cset $replacements {
	    foreach succ [$cset successors] {
		# The new changesets may have dependencies outside of
		# the chosen set. These are ignored
		if {![$dg node exists $succ]} continue
		$dg arc insert $cset $succ




	    }
	}
	foreach cset $pre {
	    foreach succ [$cset successors] {
		# Note that the arc may already exist in the graph. If
		# so ignore it. The new changesets may have
		# dependencies outside of the chosen set. These are
................................................................................
    # # ## ### ##### ######## #############
}

namespace eval ::vc::fossil::import::cvs {
    namespace export cyclebreaker
    namespace eval cyclebreaker {
	namespace eval project {

	    namespace import ::vc::fossil::import::cvs::project::rev
	    namespace import ::vc::fossil::import::cvs::project::revlink
	}
	namespace import ::vc::tools::misc::*
	namespace import ::vc::tools::log
	namespace import ::vc::tools::trouble
	namespace import ::vc::tools::dot







>







 







>
>
>
>







 







>
>
>
>







 







>







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
...
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
...
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
...
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
package require struct::list                              ; # Higher order list operations.
package require vc::tools::dot                            ; # User feedback. DOT export.
package require vc::tools::log                            ; # User feedback.
package require vc::tools::trouble                        ; # Error reporting.
package require vc::tools::misc                           ; # Text formatting.
package require vc::fossil::import::cvs::project::rev     ; # Project level changesets
package require vc::fossil::import::cvs::project::revlink ; # Cycle links.
package require vc::fossil::import::cvs::integrity        ; # State integrity checks.

# # ## ### ##### ######## ############# #####################
##

snit::type ::vc::fossil::import::cvs::cyclebreaker {
    # # ## ### ##### ######## #############
    ## Public API
................................................................................

	foreach cset $changesets {
	    foreach succ [$cset successors] {
		# Changesets may have dependencies outside of the
		# chosen set. These are ignored
		if {![$dg node exists $succ]} continue
		$dg arc insert $cset $succ
		if {$succ eq $cset} {
		    $cset loopcheck
		    trouble fatal "[$cset str] depends on itself"
		}
	    }
	}

	if {$log} {
	    log write 3 cyclebreaker "Has [nsp [llength [$dg arcs]] dependency dependencies]"
	}

................................................................................

	foreach cset $replacements {
	    foreach succ [$cset successors] {
		# The new changesets may have dependencies outside of
		# the chosen set. These are ignored
		if {![$dg node exists $succ]} continue
		$dg arc insert $cset $succ
		if {$succ eq $cset} {
		    $cset loopcheck
		    trouble fatal "[$cset str] depends on itself"
		}
	    }
	}
	foreach cset $pre {
	    foreach succ [$cset successors] {
		# Note that the arc may already exist in the graph. If
		# so ignore it. The new changesets may have
		# dependencies outside of the chosen set. These are
................................................................................
    # # ## ### ##### ######## #############
}

namespace eval ::vc::fossil::import::cvs {
    namespace export cyclebreaker
    namespace eval cyclebreaker {
	namespace eval project {
	    namespace import ::vc::fossil::import::cvs::integrity
	    namespace import ::vc::fossil::import::cvs::project::rev
	    namespace import ::vc::fossil::import::cvs::project::revlink
	}
	namespace import ::vc::tools::misc::*
	namespace import ::vc::tools::log
	namespace import ::vc::tools::trouble
	namespace import ::vc::tools::dot

Changes to tools/cvs2fossil/lib/c2f_integrity.tcl.

56
57
58
59
60
61
62
63







64
65
66
67
68
69
70
...
734
735
736
737
738
739
740
741



742
743
744
745
746
747
748
749
750
751
752
...
864
865
866
867
868
869
870







871
872
873
874
875
876
877
    typemethod changesets {csets} {
	log write 4 integrity {Check database consistency}

	set n 0
	RevisionChangesets
	TagChangesets
	BranchChangesets
	Selfreferentiality $csets







	return
    }

    # # ## ### ##### ######## #############
    ## Internal methods

    proc AllButMeta {} {
................................................................................
				 WHERE VV.cid = UU.cid
				 AND   UU.fcount < VV.rcount)
		AND    T.tid = C.type
	    }
	return
    }

    proc Selfreferentiality {csets} {



	log write 4 integrity {Checking changesets for self-references}

	foreach cset $csets {
	    if {[$cset selfreferential]} {
		trouble fatal "[$cset str] depends on itself"
	    }
	}
	return
    }

    proc ___UnusedChangesetChecks___ {} {
................................................................................
	    set ok 0
	    set b "<$cstype $csid>"
	    trouble fatal "$fname <$revnr> [string map [list @ $b] $label]"
	}
	log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok    " : "Failed"}] ... $header}
	return
    }








    # # ## ### ##### ######## #############
    ## Configuration

    pragma -hasinstances   no ; # singleton
    pragma -hastypeinfo    no ; # no introspection
    pragma -hastypedestroy no ; # immortal







|
>
>
>
>
>
>
>







 







|
>
>
>



|







 







>
>
>
>
>
>
>







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
...
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
...
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
    typemethod changesets {csets} {
	log write 4 integrity {Check database consistency}

	set n 0
	RevisionChangesets
	TagChangesets
	BranchChangesets
	trouble abort? ; # Avoid expensive check if anything found before

	LoopCheck $csets
	return
    }

    typemethof loopcheckon {} {
	set myloopcheck 1
	return
    }

    # # ## ### ##### ######## #############
    ## Internal methods

    proc AllButMeta {} {
................................................................................
				 WHERE VV.cid = UU.cid
				 AND   UU.fcount < VV.rcount)
		AND    T.tid = C.type
	    }
	return
    }

    proc LoopCheck {csets} {
	variable ::myloopcheck
	if {!$myloopcheck} return

	log write 4 integrity {Checking changesets for self-references}

	foreach cset $csets {
	    if {[$cset loopcheck]} {
		trouble fatal "[$cset str] depends on itself"
	    }
	}
	return
    }

    proc ___UnusedChangesetChecks___ {} {
................................................................................
	    set ok 0
	    set b "<$cstype $csid>"
	    trouble fatal "$fname <$revnr> [string map [list @ $b] $label]"
	}
	log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok    " : "Failed"}] ... $header}
	return
    }

    # # ## ### ##### ######## #############

    typevariable myloopcheck 0 ; # Boolean flag. Controls whether
				 # 'integrity changesets' looks for
				 # changesets with loops or not.
				 # Default is to not look for them.

    # # ## ### ##### ######## #############
    ## Configuration

    pragma -hasinstances   no ; # singleton
    pragma -hastypeinfo    no ; # no introspection
    pragma -hastypedestroy no ; # immortal

Changes to tools/cvs2fossil/lib/c2f_option.tcl.

23
24
25
26
27
28
29

30
31
32
33
34
35
36
..
44
45
46
47
48
49
50

51
52
53
54
55
56
57
..
78
79
80
81
82
83
84

85
86
87
88
89
90
91
...
144
145
146
147
148
149
150


151
152
153
154
155
156
157
...
221
222
223
224
225
226
227

228
229
230
231
232
233
234
235
236
237
238
239
240
package require vc::tools::trouble                    ; # Error reporting.
package require vc::tools::log                        ; # User feedback.
package require vc::tools::misc                       ; # Misc. path reformatting.
package require vc::fossil::import::cvs::pass         ; # Pass management
package require vc::fossil::import::cvs::pass::collar ; # Pass I.
package require vc::fossil::import::cvs::repository   ; # Repository management
package require vc::fossil::import::cvs::state        ; # State storage

package require vc::fossil::import::cvs::project::sym ; # Project level symbols
package require vc::fossil::import::cvs::cyclebreaker ; # Breaking dependency cycles.

# # ## ### ##### ######## ############# #####################
##

snit::type ::vc::fossil::import::cvs::option {
................................................................................
    # --project
    # -v, --verbose
    # -q, --quiet
    # --state (conversion status, ala config.cache)
    # --trunk-only
    # --exclude, --force-tag, --force-branch
    # --batch


    # -o, --output
    # --dry-run
    # --symbol-transform RE:XX

    # # ## ### ##### ######## #############
    ## Public API, Methods
................................................................................
		--trunk-only                { repository trunkonly! }
		--exclude                   { project::sym exclude     [Value arguments] }
		--force-tag                 { project::sym forcetag    [Value arguments] }
		--force-branch              { project::sym forcebranch [Value arguments] }
		--batch                     { log noprogress }
		--dots                      { cyclebreaker dotsto [Value arguments] }
		--watch                     { cyclebreaker watch  [Value arguments] }

		default {
		    Usage $badoption$option\n$gethelp
		}
	    }
	}

	if {[llength $arguments] > 1} Usage
................................................................................
	trouble info "                               branch. Both project and symbol names"
	trouble info "                               are glob patterns."
	trouble info ""
	trouble info "    --dots PATH                Write the changeset graphs before, after,"
	trouble info "                               and during breaking the of cycles to the"
	trouble info "                               direcotry PATH, using GraphViz's dot format"
	trouble info ""



	# --project, --cache
	# ...
	return
    }

    proc PrintVersion {} {
................................................................................
    namespace eval option {
	namespace import ::vc::tools::misc::striptrailingslash
	namespace import ::vc::fossil::import::cvs::pass
	namespace import ::vc::fossil::import::cvs::pass::collar
	namespace import ::vc::fossil::import::cvs::cyclebreaker
	namespace import ::vc::fossil::import::cvs::repository
	namespace import ::vc::fossil::import::cvs::state

	namespace eval project {
	    namespace import ::vc::fossil::import::cvs::project::sym
	}
	namespace import ::vc::tools::trouble
	namespace import ::vc::tools::log
    }
}

# # ## ### ##### ######## ############# #####################
## Ready

package provide vc::fossil::import::cvs::option 1.0
return







>







 







>







 







>







 







>
>







 







>













23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
..
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
..
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
...
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
...
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
package require vc::tools::trouble                    ; # Error reporting.
package require vc::tools::log                        ; # User feedback.
package require vc::tools::misc                       ; # Misc. path reformatting.
package require vc::fossil::import::cvs::pass         ; # Pass management
package require vc::fossil::import::cvs::pass::collar ; # Pass I.
package require vc::fossil::import::cvs::repository   ; # Repository management
package require vc::fossil::import::cvs::state        ; # State storage
package require vc::fossil::import::cvs::integrity    ; # State integrity checks.
package require vc::fossil::import::cvs::project::sym ; # Project level symbols
package require vc::fossil::import::cvs::cyclebreaker ; # Breaking dependency cycles.

# # ## ### ##### ######## ############# #####################
##

snit::type ::vc::fossil::import::cvs::option {
................................................................................
    # --project
    # -v, --verbose
    # -q, --quiet
    # --state (conversion status, ala config.cache)
    # --trunk-only
    # --exclude, --force-tag, --force-branch
    # --batch
    # --loopcheck

    # -o, --output
    # --dry-run
    # --symbol-transform RE:XX

    # # ## ### ##### ######## #############
    ## Public API, Methods
................................................................................
		--trunk-only                { repository trunkonly! }
		--exclude                   { project::sym exclude     [Value arguments] }
		--force-tag                 { project::sym forcetag    [Value arguments] }
		--force-branch              { project::sym forcebranch [Value arguments] }
		--batch                     { log noprogress }
		--dots                      { cyclebreaker dotsto [Value arguments] }
		--watch                     { cyclebreaker watch  [Value arguments] }
		--loopcheck                 { integrity loopcheckon }
		default {
		    Usage $badoption$option\n$gethelp
		}
	    }
	}

	if {[llength $arguments] > 1} Usage
................................................................................
	trouble info "                               branch. Both project and symbol names"
	trouble info "                               are glob patterns."
	trouble info ""
	trouble info "    --dots PATH                Write the changeset graphs before, after,"
	trouble info "                               and during breaking the of cycles to the"
	trouble info "                               direcotry PATH, using GraphViz's dot format"
	trouble info ""
	trouble info "    --loopcheck                Activate the expensive search for change-"
	trouble info "                               with loops, i.e. depending on themselves."

	# --project, --cache
	# ...
	return
    }

    proc PrintVersion {} {
................................................................................
    namespace eval option {
	namespace import ::vc::tools::misc::striptrailingslash
	namespace import ::vc::fossil::import::cvs::pass
	namespace import ::vc::fossil::import::cvs::pass::collar
	namespace import ::vc::fossil::import::cvs::cyclebreaker
	namespace import ::vc::fossil::import::cvs::repository
	namespace import ::vc::fossil::import::cvs::state
	namespace import ::vc::fossil::import::cvs::integrity
	namespace eval project {
	    namespace import ::vc::fossil::import::cvs::project::sym
	}
	namespace import ::vc::tools::trouble
	namespace import ::vc::tools::log
    }
}

# # ## ### ##### ######## ############# #####################
## Ready

package provide vc::fossil::import::cvs::option 1.0
return

Changes to tools/cvs2fossil/lib/c2f_prev.tcl.

361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
...
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
	    log write 8 csets {MAP- item <$key> $self = [$self str]}
	}
	set pos          [lsearch -exact $mychangesets $self]
	set mychangesets [lreplace $mychangesets $pos $pos]
	return
    }

    method selfreferential {} {
	log write 7 csets {Checking [$self str] /[llength $myitems]}

	if {![struct::set contains [$self successors] $self]} {
	    return 0
	}
	if {[log verbosity?] < 8} { return 1 }

................................................................................
	    log write 8 csets {MAKE: [lsort $fragmentitems]}

	    set fragment [$type %AUTO% $project $cstype $cssrc \
			      [Untag $fragmentitems $cstype]]
	    lappend newcsets $fragment
	    $fragment persist

	    if {[$fragment selfreferential]} {
		trouble fatal "[$fragment str] depends on itself"
	    }
	}

	trouble abort?
	return $newcsets
    }







|







 







|







361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
...
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
	    log write 8 csets {MAP- item <$key> $self = [$self str]}
	}
	set pos          [lsearch -exact $mychangesets $self]
	set mychangesets [lreplace $mychangesets $pos $pos]
	return
    }

    method loopcheck {} {
	log write 7 csets {Checking [$self str] /[llength $myitems]}

	if {![struct::set contains [$self successors] $self]} {
	    return 0
	}
	if {[log verbosity?] < 8} { return 1 }

................................................................................
	    log write 8 csets {MAKE: [lsort $fragmentitems]}

	    set fragment [$type %AUTO% $project $cstype $cssrc \
			      [Untag $fragmentitems $cstype]]
	    lappend newcsets $fragment
	    $fragment persist

	    if {[$fragment loopcheck]} {
		trouble fatal "[$fragment str] depends on itself"
	    }
	}

	trouble abort?
	return $newcsets
    }