Fossil

Check-in [be2f99e6]
Login

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

Overview
Comment:Merge with aku's branch.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: be2f99e6a4959f10c57fd2e198080b60da565897
User & Date: drh 2008-02-13 14:44:50
Context
2008-02-13
15:04
Add the TH1 code to the source tree and makefile. But do not yet make any calls to TH1. check-in: 4ee9e31a user: drh tags: trunk
14:44
Merge with aku's branch. check-in: be2f99e6 user: drh tags: trunk
12:39
Update homepage with links to competing projects. check-in: 852dbbb6 user: drh tags: trunk
04:57
Tuned the handling of the vendor branch in case we have multiple different symbols representing it. The import pass now effectively merges these symbols into a single line of development. check-in: 6d5de5f1 user: aku tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to cvs2fossil.txt.

5
6
7
8
9
10
11































*	Not yet able to handle the specification of multiple projects
	for one CVS repository. I.e. I can, for example, import all of
	tcllib, or a single subproject of tcllib, like tklib, but not
	multiple sub-projects in one go.

*	We have to look into the pass 'InitCsets' and hunt for the
	cause of the large amount of memory it is gobbling up.






































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
*	Not yet able to handle the specification of multiple projects
	for one CVS repository. I.e. I can, for example, import all of
	tcllib, or a single subproject of tcllib, like tklib, but not
	multiple sub-projects in one go.

*	We have to look into the pass 'InitCsets' and hunt for the
	cause of the large amount of memory it is gobbling up.

*	Look at the dependencies on external packages and consider
	which of them can be moved into the importer, either as a
	simple utility command, or wholesale.

	struct::list
		assign, map, reverse, filter

		Very few and self-contained commands.

	struct::set
		size, empty, contains, add, include, exclude,
		intersect, subsetof

		Most of the core commands.

	fileutil
		cat, appendToFile, writeFile,
		tempfile, stripPath, test

	fileutil::traverse
		In toto

	struct::graph
		In toto

	snit
		In toto

	sqlite3
		In tota

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

138
139
140
141
142
143
144


145
146
147
148
149
150
151

    method finalize {destination} {
	Do rebuild [::file nativename $myrepository]

	::file rename -force $myrepository $destination
	::file delete -force $myworkspace
	$self destroy


	return
    }

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

    typemethod setlocation {path} {







>
>







138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153

    method finalize {destination} {
	Do rebuild [::file nativename $myrepository]

	::file rename -force $myrepository $destination
	::file delete -force $myworkspace
	$self destroy

	log write 2 fossil {destination $destination}
	return
    }

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

    typemethod setlocation {path} {

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

39
40
41
42
43
44
45

46
47
48
49
50
51
52
..
68
69
70
71
72
73
74

75
76
77
78
79
80
81
...
126
127
128
129
130
131
132





133
134
135
136
137
138
139
    # # ## ### ##### ######## #############
    ## Public API, Options.

    # --help, --help-passes, -h
    # --version
    # -p, --pass, --passes
    # --ignore-conflicting-attics

    # --project
    # -v, --verbose
    # -q, --quiet
    # --state (conversion status, ala config.cache)
    # --trunk-only
    # --exclude, --force-tag, --force-branch
    # --batch
................................................................................
		--help                      { PrintHelp    ; exit 0 }
		--help-passes               { pass help    ; exit 0 }
		--version                   { PrintVersion ; exit 0 }
		-p                          -
		--pass                      -
		--passes                    { pass select [Value arguments] }
		--ignore-conflicting-attics { collar ignore_conflicting_attics }

		--project                   { repository add [Value arguments] }
		-v                          -
		--verbose                   { log verbose }
		-q                          -
		--quiet                     { log quiet }
		--state                     { state usedb [Value arguments] }
		--trunk-only                { repository trunkonly! }
................................................................................
	trouble info ""
	trouble info "                               Passes are specified by name."
	trouble info ""
	trouble info "    --ignore-conflicting-attics"
	trouble info "                               Prevent abort when conflicting archives"
	trouble info "                               were found in both regular and Attic."
	trouble info ""





	trouble info "    --state PATH               Save state to the specified file, and"
	trouble info "                               load state of previous runs from it too."
	trouble info ""
	trouble info "    --exclude ?PROJECT:?SYMBOL Exclude the named symbol from all or"
	trouble info "                               just the specified project. Both project"
	trouble info "                               and symbol names are glob patterns."
	trouble info ""







>







 







>







 







>
>
>
>
>







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
..
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
...
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
    # # ## ### ##### ######## #############
    ## Public API, Options.

    # --help, --help-passes, -h
    # --version
    # -p, --pass, --passes
    # --ignore-conflicting-attics
    # --convert-dotfiles
    # --project
    # -v, --verbose
    # -q, --quiet
    # --state (conversion status, ala config.cache)
    # --trunk-only
    # --exclude, --force-tag, --force-branch
    # --batch
................................................................................
		--help                      { PrintHelp    ; exit 0 }
		--help-passes               { pass help    ; exit 0 }
		--version                   { PrintVersion ; exit 0 }
		-p                          -
		--pass                      -
		--passes                    { pass select [Value arguments] }
		--ignore-conflicting-attics { collar ignore_conflicting_attics }
		--convert-dotfiles          { collar accept_and_convert_dotfiles }
		--project                   { repository add [Value arguments] }
		-v                          -
		--verbose                   { log verbose }
		-q                          -
		--quiet                     { log quiet }
		--state                     { state usedb [Value arguments] }
		--trunk-only                { repository trunkonly! }
................................................................................
	trouble info ""
	trouble info "                               Passes are specified by name."
	trouble info ""
	trouble info "    --ignore-conflicting-attics"
	trouble info "                               Prevent abort when conflicting archives"
	trouble info "                               were found in both regular and Attic."
	trouble info ""
	trouble info "    --convert-dotfiles"
	trouble info "                               Prevent abort when dot-files were found,"
	trouble info "                               causing their conversion to nondot-form"
	trouble info "                               instead."
	trouble info ""
	trouble info "    --state PATH               Save state to the specified file, and"
	trouble info "                               load state of previous runs from it too."
	trouble info ""
	trouble info "    --exclude ?PROJECT:?SYMBOL Exclude the named symbol from all or"
	trouble info "                               just the specified project. Both project"
	trouble info "                               and symbol names are glob patterns."
	trouble info ""

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

141
142
143
144
145
146
147

148
149

150

151
152
153
154













155

156
157
158
159
160
161
162
	lappend    mytime $pass $seconds
	ShowTime          $pass $seconds
	return
    }

    proc ShowTimes {} {
	::variable mytime

	foreach {pass seconds} $mytime {
	    ShowTime $pass $seconds

	}

	return
    }

    proc ShowTime {pass seconds} {













	log write 0 pass "[format %8d $seconds] sec/$pass"

	return
    }

    proc Ok? {code label ov {emptyok 1}} {
	upvar 1 $ov ok
	::variable mydesc
	if {$emptyok && ($code eq "")} return







>


>

>




>
>
>
>
>
>
>
>
>
>
>
>
>
|
>







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
	lappend    mytime $pass $seconds
	ShowTime          $pass $seconds
	return
    }

    proc ShowTimes {} {
	::variable mytime
	set total 0
	foreach {pass seconds} $mytime {
	    ShowTime $pass $seconds
	    incr total $seconds
	}
	ShowTime Total $total
	return
    }

    proc ShowTime {pass seconds} {
	if {$seconds > 3600} {
	    set hr  [expr {$seconds / 3600}]
	    set min [expr {$seconds % 3600}]
	    set sec [expr {$min % 60}]
	    set min [expr {$min / 60}]

	    log write 0 pass "[format %8d $seconds] sec/$pass ([nsp $hr hour] [nsp $min minute] [nsp $sec second])"
	} elseif {$seconds > 60} {
	    set min [expr {$seconds / 60}]
	    set sec [expr {$seconds % 60}]

	    log write 0 pass "[format %8d $seconds] sec/$pass ([nsp $min minute] [nsp $sec second])"
	} else {
	    log write 0 pass "[format %8d $seconds] sec/$pass"
	}
	return
    }

    proc Ok? {code label ov {emptyok 1}} {
	upvar 1 $ov ok
	::variable mydesc
	if {$emptyok && ($code eq "")} return

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

109
110
111
112
113
114
115
116
117

118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
...
156
157
158
159
160
161
162





163
164
165
166
167






168
169
170
171
172
173
174
...
184
185
186
187
188
189
190
191



192
193


194
195
196
197
198
199
200
...
235
236
237
238
239
240
241






























































242
243
244
245
246
247
248

	    $traverse foreach path {
		set rcs [fileutil::stripPath $base $path]
		if {[IsCVSAdmin    $rcs]}  continue
		if {![IsRCSArchive $path]} continue

		set usr [UserPath $rcs isattic]
		if {[IsSuperceded $base $rcs $usr $isattic]} continue


		# XXX Checkme: not sure if this will still fail in the case where a directory does conflict with a file XXX
		if {
		    [fileexists_cs $base/$usr] &&
		    [fileisdir_cs  $base/$usr]
		} {
		    trouble fatal "Directory name conflicts with filename."
		    trouble fatal "Please remove or rename one of the following:"
		    trouble fatal "    $base/$usr"
		    trouble fatal "    $base/$rcs"
		    continue
		}

		log write 4 collar "Found   $rcs"
		$project addfile $rcs $usr [file executable $rcs]

		incr n
		if {[log verbosity?] < 4} {
		    log progress 0 collar $n {}
................................................................................
	return
    }

    typemethod ignore_conflicting_attics {} {
	set myignore 1
	return
    }






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

    typevariable myignore 0







    proc FilterAtticSubdir {base path} {
	# This command is used by the traverser to prevent it from
	# scanning into subdirectories of an Attic. We get away with
	# checking the immediate parent directory of the current path
	# as our rejection means that deeper path do not occur.

................................................................................
	if {![string match *,v $path]}     {return 0}
	if {[fileutil::test $path fr msg]} {return 1}
	trouble warn $msg
	return 0
    }

    proc IsCVSAdmin {rcs} {
	if {![string match CVSROOT/* $rcs]} {return 0}



	log write 4 collar "Ignored $rcs, administrative archive"
	return 1


    }

    proc UserPath {rcs iav} {
	upvar 1 $iav isattic

	# Derive the user-visible path from the rcs path. Meaning:
	# Chop off the ",v" suffix, and remove a possible "Attic".
................................................................................
	if {$myignore} {
	    log write 2 collar "Ignored $rcs, superceded archive"
	} else {
	    trouble warn       "Ignored $rcs, superceded archive"
	}
	return 1
    }































































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

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







<

>
|
<
<
<
<
<
<
<
<
<
<







 







>
>
>
>
>




|
>
>
>
>
>
>







 







|
>
>
>
|
|
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







109
110
111
112
113
114
115

116
117
118










119
120
121
122
123
124
125
...
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
...
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
...
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316

	    $traverse foreach path {
		set rcs [fileutil::stripPath $base $path]
		if {[IsCVSAdmin    $rcs]}  continue
		if {![IsRCSArchive $path]} continue

		set usr [UserPath $rcs isattic]


		if {[CheckForAndReportPathConflicts $base $rcs $usr $isattic]} continue
		if {[HandleDotFile                  $base $rcs usr  $isattic]} continue











		log write 4 collar "Found   $rcs"
		$project addfile $rcs $usr [file executable $rcs]

		incr n
		if {[log verbosity?] < 4} {
		    log progress 0 collar $n {}
................................................................................
	return
    }

    typemethod ignore_conflicting_attics {} {
	set myignore 1
	return
    }

    typemethod accept_and_convert_dotfiles {} {
	set myconvertdot 1
	return
    }

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

    typevariable myignore     0 ; # Flag. When set Attic files
				  # superceded by regular files
				  # ignored.
    typevariable myconvertdot 0 ; # Flag. When set dotfiles do not
				  # cause rejection, but their names
				  # are converted to a dotless form
				  # ('dot-' prefix instead of '.').

    proc FilterAtticSubdir {base path} {
	# This command is used by the traverser to prevent it from
	# scanning into subdirectories of an Attic. We get away with
	# checking the immediate parent directory of the current path
	# as our rejection means that deeper path do not occur.

................................................................................
	if {![string match *,v $path]}     {return 0}
	if {[fileutil::test $path fr msg]} {return 1}
	trouble warn $msg
	return 0
    }

    proc IsCVSAdmin {rcs} {
	if {
	    [string match {CVSROOT/*}              $rcs] ||
	    [string match {.cvsignore*} [file tail $rcs]]
	} {
	    log write 4 collar "Ignored $rcs, administrative archive"
	    return 1
	}
	return 0
    }

    proc UserPath {rcs iav} {
	upvar 1 $iav isattic

	# Derive the user-visible path from the rcs path. Meaning:
	# Chop off the ",v" suffix, and remove a possible "Attic".
................................................................................
	if {$myignore} {
	    log write 2 collar "Ignored $rcs, superceded archive"
	} else {
	    trouble warn       "Ignored $rcs, superceded archive"
	}
	return 1
    }

    # In the future we should move the activity below into the fossil
    # backend, as the exact set of paths requiring translation, and
    # how to translate them, depends entirely on the limitations
    # imposed by the destination repository.

    proc HandleDotFile {base rcs usrvar isattic} {
	::variable myconvertdot
	upvar 1 $usrvar usr

	set dedot [DeDot $usr]
	if {$dedot eq $usr} { return 0 }

	# Ok, we now have established that the path has to be
	# translated. Which as already happened as part of the check
	# above. Left is to report the action, and to check if the new
	# path collides with existing files and directories.

	if {!$myconvertdot} {
	    trouble warn       "Ignored $rcs, is a dot-file"
	    return 1
	}

	log write 2 collar "Convert $rcs, is a dot-file"
	set usr $dedot

	return [CheckForAndReportPathConflicts $base $rcs $usr $isattic]
    }

    proc DeDot {path} {
	set res {}
	foreach segment [file split $path] {
	    lappend res [expr {
			       [string match {.*} $segment]
			       ? "dot-[string range $segment 1 end]"
			       : $segment
			   }]
	}
	return [eval [linsert $res 0 file join]]
	#8.5: return [file join {*}$res]
    }

    proc CheckForAndReportPathConflicts {base rcs usr isattic {intro {}}} {
	if {[IsSuperceded $base $rcs $usr $isattic]} { return 1 }

	# XXX Checkme: not sure if this will still fail in the case
	# where a directory does conflict with a file XXX
	if {
	    [fileexists_cs $base/$usr] &&
	    [fileisdir_cs  $base/$usr]
	} {
	    if {$intro ne {}} {
		trouble fatal $intro
	    }
	    trouble fatal "Directory name conflicts with filename."
	    trouble fatal "Please remove or rename one of the following:"
	    trouble fatal "    $base/$usr"
	    trouble fatal "    $base/$rcs"
	    return 1
	}
	return 0
    }

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

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

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

101
102
103
104
105
106
107






108
109
110
111
112
113
114
115
	    }

	    $rstate destroy

	    # At last copy the temporary repository file to its final
	    # destination and release the associated memory.







	    $fossil finalize [$project base].fsl
	}

	# This does not live beyond the pass. We use the state for the
	# data despite its transient nature to keep the memory
	# requirements down.
	#state discard revuuid
	return







>
>
>
>
>
>
|







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
	    }

	    $rstate destroy

	    # At last copy the temporary repository file to its final
	    # destination and release the associated memory.

	    set destination [$project base]
	    if {$destination eq ""} {
		set destination [file tail [repository base?]]
	    }
	    append destination .fsl

	    $fossil finalize $destination
	}

	# This does not live beyond the pass. We use the state for the
	# data despite its transient nature to keep the memory
	# requirements down.
	#state discard revuuid
	return

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

495
496
497
498
499
500
501
502
503
504
505






506
507
508
509
510
511











512
513
514
515
516
517
518
	# If the LOD is however not yet known, then the current
	# changeset can be either of
	# (a) root of a vendor branch,
	# (b) root of the trunk LOD, or
	# (c) the first changeset in a new LOD which was spawned from
	#     an existing LOD.

	if {$isdefault || ($lodname eq ":trunk:")} {
	    # For both (a) and (b) we have to create a new workspace
	    # for the lod, and it doesn't inherit from anything.







	    # Note that case (b) may never occur. See the variable
	    # 'lastdefaultontrunk' in the caller (method pushto). This
	    # flag can the generation of the workspace for the :trunk:
	    # LOD as well, making it inherit the state of the last
	    # trunk-changeset on the vendor-branch.












	    return [$rstate new $lodname]
	}

	# Case (c). We find the parent LOD of our LOD and let the new
	# workspace inherit from the parent's workspace.

	set plodname [[[$project getsymbol $lodname] parent] name]







<
|
|

>
>
>
>
>
>
|
|
|
|
|

>
>
>
>
>
>
>
>
>
>
>







495
496
497
498
499
500
501

502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
	# If the LOD is however not yet known, then the current
	# changeset can be either of
	# (a) root of a vendor branch,
	# (b) root of the trunk LOD, or
	# (c) the first changeset in a new LOD which was spawned from
	#     an existing LOD.


	# For both (a) and (b) we have to create a new workspace for
	# the lod, and it doesn't inherit from anything.

	# One exception for (a). If we already have a :vendor: branch
	# then multiple symbols were used for the vendor branch by
	# different files. In that case the 'new' branch is made an
	# alias of the :vendor:, effectively merging the symbols
	# together.

	# Note that case (b) may never occur. See the variable
	# 'lastdefaultontrunk' in the caller (method pushto). This
	# flag can the generation of the workspace for the :trunk: LOD
	# as well, making it inherit the state of the last
	# trunk-changeset on the vendor-branch.

	if {$isdefault} {
	    if {![$rstate has ":vendor:"]} {
		# Create the vendor branch if not present already.
		$rstate new :vendor:
	    }
	    # Merge the new symbol to the vendor branch
	    $rstate dup $lodname <-- :vendor:
	    return [$rstate get $lodname]
	}

	if {$lodname eq ":trunk:"} {
	    return [$rstate new $lodname]
	}

	# Case (c). We find the parent LOD of our LOD and let the new
	# workspace inherit from the parent's workspace.

	set plodname [[[$project getsymbol $lodname] parent] name]

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

66
67
68
69
70
71
72






73
74
75
76
77
78
79
	return $wss
    }

    method get {lod} { return $mystate($lod) }
    method has {lod} { return [info exists mystate($lod)] }

    method names {} { return [array names mystate] }







    # # ## ### ##### ######## #############
    ## State

    variable mystate -array {} ; # Map from lines of development
				 # (identified by name) to their
				 # workspace state.







>
>
>
>
>
>







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
	return $wss
    }

    method get {lod} { return $mystate($lod) }
    method has {lod} { return [info exists mystate($lod)] }

    method names {} { return [array names mystate] }

    method dup {dst _from_ src} {
	log write 8 ristate {Duplicate workspace state for LOD "$dst" from "$src"}
	set mystate($dst) $mystate($src)
	return
    }

    # # ## ### ##### ######## #############
    ## State

    variable mystate -array {} ; # Map from lines of development
				 # (identified by name) to their
				 # workspace state.