Fossil SCM

Changes to cvs2fossil to import tcllib CVS into fossil on Win32 * using [::file] instead of [file] in snit methods to get the core file command * taking care of files that only differ in case in the Attic and the repo on case insensitive FS * passing platform specific

mjanssen 2008-01-28 23:57 trunk
Commit 7208c7ac4d1562657ecad27e7bc3e6e81405d460
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -264,11 +264,11 @@
264264
# revmap = dict (path -> rid)
265265
266266
array set idmap [$repository importfiles $filemap]
267267
268268
# Wipe workspace clean of the imported files.
269
- foreach x [glob -directory $ws r*] { file delete $x }
269
+ foreach x [glob -directory $ws r*] { ::file delete $x }
270270
271271
foreach {path rid} $revmap {
272272
set uuid $idmap($path)
273273
state run {
274274
INSERT INTO revuuid (rid, uuid)
@@ -337,11 +337,11 @@
337337
foreach {from to} $zarcs { $zp arc insert $from $to }
338338
339339
# Phase III: Traverse the graphs, expand the file, and
340340
# generate import instructions.
341341
342
- set archive [file join [$myproject fullpath] $mypath]
342
+ set archive [::file join [$myproject fullpath] $mypath]
343343
set ac [open $archive r]
344344
fconfigure $ac -translation binary
345345
346346
# First traverse the expansion graph, this gives us the
347347
# revisions in the order we have to expand them, which we do.
348348
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -264,11 +264,11 @@
264 # revmap = dict (path -> rid)
265
266 array set idmap [$repository importfiles $filemap]
267
268 # Wipe workspace clean of the imported files.
269 foreach x [glob -directory $ws r*] { file delete $x }
270
271 foreach {path rid} $revmap {
272 set uuid $idmap($path)
273 state run {
274 INSERT INTO revuuid (rid, uuid)
@@ -337,11 +337,11 @@
337 foreach {from to} $zarcs { $zp arc insert $from $to }
338
339 # Phase III: Traverse the graphs, expand the file, and
340 # generate import instructions.
341
342 set archive [file join [$myproject fullpath] $mypath]
343 set ac [open $archive r]
344 fconfigure $ac -translation binary
345
346 # First traverse the expansion graph, this gives us the
347 # revisions in the order we have to expand them, which we do.
348
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -264,11 +264,11 @@
264 # revmap = dict (path -> rid)
265
266 array set idmap [$repository importfiles $filemap]
267
268 # Wipe workspace clean of the imported files.
269 foreach x [glob -directory $ws r*] { ::file delete $x }
270
271 foreach {path rid} $revmap {
272 set uuid $idmap($path)
273 state run {
274 INSERT INTO revuuid (rid, uuid)
@@ -337,11 +337,11 @@
337 foreach {from to} $zarcs { $zp arc insert $from $to }
338
339 # Phase III: Traverse the graphs, expand the file, and
340 # generate import instructions.
341
342 set archive [::file join [$myproject fullpath] $mypath]
343 set ac [open $archive r]
344 fconfigure $ac -translation binary
345
346 # First traverse the expansion graph, this gives us the
347 # revisions in the order we have to expand them, which we do.
348
--- tools/cvs2fossil/lib/c2f_fossil.tcl
+++ tools/cvs2fossil/lib/c2f_fossil.tcl
@@ -30,15 +30,15 @@
3030
## Public API
3131
3232
constructor {} {
3333
set myrepository [fileutil::tempfile cvs2fossil_repo_]
3434
set myworkspace [fileutil::tempfile cvs2fossil_wspc_]
35
- file delete $myworkspace
36
- file mkdir $myworkspace
35
+ ::file delete $myworkspace
36
+ ::file mkdir $myworkspace
3737
38
- Do new $myrepository
39
- $self InWorkspace ; Do open $myrepository
38
+ Do new [::file nativename $myrepository]
39
+ $self InWorkspace ; Do open [::file nativename $myrepository]
4040
$self RestorePwd
4141
return
4242
}
4343
4444
# # ## ### ##### ######## #############
@@ -94,12 +94,12 @@
9494
log write 3 fossil Done.
9595
return [array get id]
9696
}
9797
9898
method finalize {destination} {
99
- file rename -force $myrepository $destination
100
- file delete -force $myworkspace
99
+ ::file rename -force $myrepository $destination
100
+ ::file delete -force $myworkspace
101101
$self destroy
102102
return
103103
}
104104
105105
# # ## ### ##### ######## #############
106106
--- tools/cvs2fossil/lib/c2f_fossil.tcl
+++ tools/cvs2fossil/lib/c2f_fossil.tcl
@@ -30,15 +30,15 @@
30 ## Public API
31
32 constructor {} {
33 set myrepository [fileutil::tempfile cvs2fossil_repo_]
34 set myworkspace [fileutil::tempfile cvs2fossil_wspc_]
35 file delete $myworkspace
36 file mkdir $myworkspace
37
38 Do new $myrepository
39 $self InWorkspace ; Do open $myrepository
40 $self RestorePwd
41 return
42 }
43
44 # # ## ### ##### ######## #############
@@ -94,12 +94,12 @@
94 log write 3 fossil Done.
95 return [array get id]
96 }
97
98 method finalize {destination} {
99 file rename -force $myrepository $destination
100 file delete -force $myworkspace
101 $self destroy
102 return
103 }
104
105 # # ## ### ##### ######## #############
106
--- tools/cvs2fossil/lib/c2f_fossil.tcl
+++ tools/cvs2fossil/lib/c2f_fossil.tcl
@@ -30,15 +30,15 @@
30 ## Public API
31
32 constructor {} {
33 set myrepository [fileutil::tempfile cvs2fossil_repo_]
34 set myworkspace [fileutil::tempfile cvs2fossil_wspc_]
35 ::file delete $myworkspace
36 ::file mkdir $myworkspace
37
38 Do new [::file nativename $myrepository]
39 $self InWorkspace ; Do open [::file nativename $myrepository]
40 $self RestorePwd
41 return
42 }
43
44 # # ## ### ##### ######## #############
@@ -94,12 +94,12 @@
94 log write 3 fossil Done.
95 return [array get id]
96 }
97
98 method finalize {destination} {
99 ::file rename -force $myrepository $destination
100 ::file delete -force $myworkspace
101 $self destroy
102 return
103 }
104
105 # # ## ### ##### ######## #############
106
--- tools/cvs2fossil/lib/c2f_patopsort.tcl
+++ tools/cvs2fossil/lib/c2f_patopsort.tcl
@@ -117,11 +117,11 @@
117117
118118
proc SaveTimestamps {graph at cset} {
119119
set cid [$cset id]
120120
121121
set date [GetTime [lindex [$graph node get $cset timerange] 1] \
122
- [struct::set contain $mysymchangesets $cset] \
122
+ [struct::set contains $mysymchangesets $cset] \
123123
message]
124124
125125
log write 4 atopsort "Changeset @ [format $myatfmt $at]: [format $mycsfmt [$cset str]]$message"
126126
127127
state run {
128128
--- tools/cvs2fossil/lib/c2f_patopsort.tcl
+++ tools/cvs2fossil/lib/c2f_patopsort.tcl
@@ -117,11 +117,11 @@
117
118 proc SaveTimestamps {graph at cset} {
119 set cid [$cset id]
120
121 set date [GetTime [lindex [$graph node get $cset timerange] 1] \
122 [struct::set contain $mysymchangesets $cset] \
123 message]
124
125 log write 4 atopsort "Changeset @ [format $myatfmt $at]: [format $mycsfmt [$cset str]]$message"
126
127 state run {
128
--- tools/cvs2fossil/lib/c2f_patopsort.tcl
+++ tools/cvs2fossil/lib/c2f_patopsort.tcl
@@ -117,11 +117,11 @@
117
118 proc SaveTimestamps {graph at cset} {
119 set cid [$cset id]
120
121 set date [GetTime [lindex [$graph node get $cset timerange] 1] \
122 [struct::set contains $mysymchangesets $cset] \
123 message]
124
125 log write 4 atopsort "Changeset @ [format $myatfmt $at]: [format $mycsfmt [$cset str]]$message"
126
127 state run {
128
--- tools/cvs2fossil/lib/c2f_pcollar.tcl
+++ tools/cvs2fossil/lib/c2f_pcollar.tcl
@@ -96,11 +96,11 @@
9696
# Pass manager interface. Executed to perform the
9797
# functionality of the pass.
9898
9999
set rbase [repository base?]
100100
foreach project [repository projects] {
101
- set base [file join $rbase [$project base]]
101
+ set base [::file join $rbase [$project base]]
102102
log write 1 collar "Scan $base"
103103
104104
set traverse [fileutil::traverse %AUTO% $base \
105105
-prefilter [myproc FilterAtticSubdir $base]]
106106
set n 0
@@ -112,13 +112,14 @@
112112
if {![IsRCSArchive $path]} continue
113113
114114
set usr [UserPath $rcs isattic]
115115
if {[IsSuperceded $base $rcs $usr $isattic]} continue
116116
117
+ # XXX Checkme: not sure if this will still fail in the case where a directory does conflict with a file XXX
117118
if {
118
- [file exists $base/$usr] &&
119
- [file isdirectory $base/$usr]
119
+ [lsearch [glob -tail -types f -directory $base *] $usr] != -1 &&
120
+ [lsearch [glob -tail -types d -directory $base *] $usr] != -1
120121
} {
121122
trouble fatal "Directory name conflicts with filename."
122123
trouble fatal "Please remove or rename one of the following:"
123124
trouble fatal " $base/$usr"
124125
trouble fatal " $base/$rcs"
@@ -218,11 +219,13 @@
218219
219220
proc IsSuperceded {base rcs usr isattic} {
220221
::variable myignore
221222
222223
if {!$isattic} {return 0}
223
- if {![file exists $base/$usr,v]} {return 0}
224
+
225
+ # use glob to account for case insensitive file systems
226
+ if {[lsearch [glob -tail -directory $base *] $usr,v] == -1} {return 0}
224227
225228
# We have a regular archive and an Attic archive refering to
226229
# the same user visible file. Ignore the file in the Attic.
227230
#
228231
# By default this is a problem causing an abort after the pass
229232
--- tools/cvs2fossil/lib/c2f_pcollar.tcl
+++ tools/cvs2fossil/lib/c2f_pcollar.tcl
@@ -96,11 +96,11 @@
96 # Pass manager interface. Executed to perform the
97 # functionality of the pass.
98
99 set rbase [repository base?]
100 foreach project [repository projects] {
101 set base [file join $rbase [$project base]]
102 log write 1 collar "Scan $base"
103
104 set traverse [fileutil::traverse %AUTO% $base \
105 -prefilter [myproc FilterAtticSubdir $base]]
106 set n 0
@@ -112,13 +112,14 @@
112 if {![IsRCSArchive $path]} continue
113
114 set usr [UserPath $rcs isattic]
115 if {[IsSuperceded $base $rcs $usr $isattic]} continue
116
 
117 if {
118 [file exists $base/$usr] &&
119 [file isdirectory $base/$usr]
120 } {
121 trouble fatal "Directory name conflicts with filename."
122 trouble fatal "Please remove or rename one of the following:"
123 trouble fatal " $base/$usr"
124 trouble fatal " $base/$rcs"
@@ -218,11 +219,13 @@
218
219 proc IsSuperceded {base rcs usr isattic} {
220 ::variable myignore
221
222 if {!$isattic} {return 0}
223 if {![file exists $base/$usr,v]} {return 0}
 
 
224
225 # We have a regular archive and an Attic archive refering to
226 # the same user visible file. Ignore the file in the Attic.
227 #
228 # By default this is a problem causing an abort after the pass
229
--- tools/cvs2fossil/lib/c2f_pcollar.tcl
+++ tools/cvs2fossil/lib/c2f_pcollar.tcl
@@ -96,11 +96,11 @@
96 # Pass manager interface. Executed to perform the
97 # functionality of the pass.
98
99 set rbase [repository base?]
100 foreach project [repository projects] {
101 set base [::file join $rbase [$project base]]
102 log write 1 collar "Scan $base"
103
104 set traverse [fileutil::traverse %AUTO% $base \
105 -prefilter [myproc FilterAtticSubdir $base]]
106 set n 0
@@ -112,13 +112,14 @@
112 if {![IsRCSArchive $path]} continue
113
114 set usr [UserPath $rcs isattic]
115 if {[IsSuperceded $base $rcs $usr $isattic]} continue
116
117 # XXX Checkme: not sure if this will still fail in the case where a directory does conflict with a file XXX
118 if {
119 [lsearch [glob -tail -types f -directory $base *] $usr] != -1 &&
120 [lsearch [glob -tail -types d -directory $base *] $usr] != -1
121 } {
122 trouble fatal "Directory name conflicts with filename."
123 trouble fatal "Please remove or rename one of the following:"
124 trouble fatal " $base/$usr"
125 trouble fatal " $base/$rcs"
@@ -218,11 +219,13 @@
219
220 proc IsSuperceded {base rcs usr isattic} {
221 ::variable myignore
222
223 if {!$isattic} {return 0}
224
225 # use glob to account for case insensitive file systems
226 if {[lsearch [glob -tail -directory $base *] $usr,v] == -1} {return 0}
227
228 # We have a regular archive and an Attic archive refering to
229 # the same user visible file. Ignore the file in the Attic.
230 #
231 # By default this is a problem causing an abort after the pass
232
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -316,18 +316,18 @@
316316
# Pass manager interface. Executed to perform the
317317
# functionality of the pass.
318318
319319
set rbase [repository base?]
320320
foreach project [repository projects] {
321
- set base [file join $rbase [$project base]]
321
+ set base [::file join $rbase [$project base]]
322322
log write 1 collrev "Processing $base"
323323
324324
foreach file [$project files] {
325325
set path [$file path]
326326
log write 2 collrev "Parsing $path"
327327
if {[catch {
328
- parser process [file join $base $path] $file
328
+ parser process [::file join $base $path] $file
329329
} msg]} {
330330
global errorCode
331331
if {$errorCode eq "vc::rcs::parser"} {
332332
trouble fatal "$path is not a valid RCS archive ($msg)"
333333
} else {
334334
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -316,18 +316,18 @@
316 # Pass manager interface. Executed to perform the
317 # functionality of the pass.
318
319 set rbase [repository base?]
320 foreach project [repository projects] {
321 set base [file join $rbase [$project base]]
322 log write 1 collrev "Processing $base"
323
324 foreach file [$project files] {
325 set path [$file path]
326 log write 2 collrev "Parsing $path"
327 if {[catch {
328 parser process [file join $base $path] $file
329 } msg]} {
330 global errorCode
331 if {$errorCode eq "vc::rcs::parser"} {
332 trouble fatal "$path is not a valid RCS archive ($msg)"
333 } else {
334
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -316,18 +316,18 @@
316 # Pass manager interface. Executed to perform the
317 # functionality of the pass.
318
319 set rbase [repository base?]
320 foreach project [repository projects] {
321 set base [::file join $rbase [$project base]]
322 log write 1 collrev "Processing $base"
323
324 foreach file [$project files] {
325 set path [$file path]
326 log write 2 collrev "Parsing $path"
327 if {[catch {
328 parser process [::file join $base $path] $file
329 } msg]} {
330 global errorCode
331 if {$errorCode eq "vc::rcs::parser"} {
332 trouble fatal "$path is not a valid RCS archive ($msg)"
333 } else {
334
--- tools/cvs2fossil/lib/c2f_state.tcl
+++ tools/cvs2fossil/lib/c2f_state.tcl
@@ -42,19 +42,20 @@
4242
4343
# In the second case we have to be able to create the file,
4444
# and check that. This is done by opening it, sqlite will then
4545
# try to create it, and may fail.
4646
47
- if {[file exists $path]} {
47
+ if {[::file exists $path]} {
4848
if {![fileutil::test $path frw msg {cvs2fossil state}]} {
4949
trouble fatal $msg
5050
return
5151
}
5252
}
5353
5454
if {[catch {
5555
sqlite3 ${type}::TEMP $path
56
+ ${type}::TEMP eval {PRAGMA synchronous=OFF;}
5657
} res]} {
5758
trouble fatal $res
5859
return
5960
}
6061
@@ -80,20 +81,21 @@
8081
if {$mystate ne ""} return
8182
8283
set mypath [fileutil::tempfile cvs2fossil_state_]
8384
set mystate ${type}::STATE
8485
sqlite3 $mystate $mypath
86
+ $mystate eval {PRAGMA synchronous=OFF;}
8587
8688
log write 2 state "using $mypath"
8789
return
8890
}
8991
9092
typemethod release {} {
9193
log write 2 state release
9294
${type}::STATE close
9395
if {$mypath eq ""} return
94
- file delete $mypath
96
+ ::file delete $mypath
9597
return
9698
}
9799
98100
# Declare a table needed for the storing of persistent state, and
99101
# its structure. A possibly previously existing definition is
100102
--- tools/cvs2fossil/lib/c2f_state.tcl
+++ tools/cvs2fossil/lib/c2f_state.tcl
@@ -42,19 +42,20 @@
42
43 # In the second case we have to be able to create the file,
44 # and check that. This is done by opening it, sqlite will then
45 # try to create it, and may fail.
46
47 if {[file exists $path]} {
48 if {![fileutil::test $path frw msg {cvs2fossil state}]} {
49 trouble fatal $msg
50 return
51 }
52 }
53
54 if {[catch {
55 sqlite3 ${type}::TEMP $path
 
56 } res]} {
57 trouble fatal $res
58 return
59 }
60
@@ -80,20 +81,21 @@
80 if {$mystate ne ""} return
81
82 set mypath [fileutil::tempfile cvs2fossil_state_]
83 set mystate ${type}::STATE
84 sqlite3 $mystate $mypath
 
85
86 log write 2 state "using $mypath"
87 return
88 }
89
90 typemethod release {} {
91 log write 2 state release
92 ${type}::STATE close
93 if {$mypath eq ""} return
94 file delete $mypath
95 return
96 }
97
98 # Declare a table needed for the storing of persistent state, and
99 # its structure. A possibly previously existing definition is
100
--- tools/cvs2fossil/lib/c2f_state.tcl
+++ tools/cvs2fossil/lib/c2f_state.tcl
@@ -42,19 +42,20 @@
42
43 # In the second case we have to be able to create the file,
44 # and check that. This is done by opening it, sqlite will then
45 # try to create it, and may fail.
46
47 if {[::file exists $path]} {
48 if {![fileutil::test $path frw msg {cvs2fossil state}]} {
49 trouble fatal $msg
50 return
51 }
52 }
53
54 if {[catch {
55 sqlite3 ${type}::TEMP $path
56 ${type}::TEMP eval {PRAGMA synchronous=OFF;}
57 } res]} {
58 trouble fatal $res
59 return
60 }
61
@@ -80,20 +81,21 @@
81 if {$mystate ne ""} return
82
83 set mypath [fileutil::tempfile cvs2fossil_state_]
84 set mystate ${type}::STATE
85 sqlite3 $mystate $mypath
86 $mystate eval {PRAGMA synchronous=OFF;}
87
88 log write 2 state "using $mypath"
89 return
90 }
91
92 typemethod release {} {
93 log write 2 state release
94 ${type}::STATE close
95 if {$mypath eq ""} return
96 ::file delete $mypath
97 return
98 }
99
100 # Declare a table needed for the storing of persistent state, and
101 # its structure. A possibly previously existing definition is
102
--- tools/cvs2fossil/lib/dot.tcl
+++ tools/cvs2fossil/lib/dot.tcl
@@ -58,11 +58,11 @@
5858
5959
typemethod layout {format g name file} {
6060
set f [fileutil::tempfile c2fdot_]
6161
$type write $g $name $f
6262
exec dot -T $format -o $file $f
63
- file delete $f
63
+ ::file delete $f
6464
return
6565
}
6666
6767
# # ## ### ##### ######## #############
6868
## Internal, state
6969
--- tools/cvs2fossil/lib/dot.tcl
+++ tools/cvs2fossil/lib/dot.tcl
@@ -58,11 +58,11 @@
58
59 typemethod layout {format g name file} {
60 set f [fileutil::tempfile c2fdot_]
61 $type write $g $name $f
62 exec dot -T $format -o $file $f
63 file delete $f
64 return
65 }
66
67 # # ## ### ##### ######## #############
68 ## Internal, state
69
--- tools/cvs2fossil/lib/dot.tcl
+++ tools/cvs2fossil/lib/dot.tcl
@@ -58,11 +58,11 @@
58
59 typemethod layout {format g name file} {
60 set f [fileutil::tempfile c2fdot_]
61 $type write $g $name $f
62 exec dot -T $format -o $file $f
63 ::file delete $f
64 return
65 }
66
67 # # ## ### ##### ######## #############
68 ## Internal, state
69
--- tools/cvs2fossil/lib/misc.tcl
+++ tools/cvs2fossil/lib/misc.tcl
@@ -81,11 +81,11 @@
8181
8282
# Delete item from list by name
8383
8484
proc striptrailingslash {path} {
8585
# split and rejoin gets rid of a traling / character.
86
- return [eval [linsert [file split $path] 0 file join]]
86
+ return [eval [linsert [file split $path] 0 ::file join]]
8787
}
8888
8989
# # ## ### ##### ######## #############
9090
}
9191
9292
--- tools/cvs2fossil/lib/misc.tcl
+++ tools/cvs2fossil/lib/misc.tcl
@@ -81,11 +81,11 @@
81
82 # Delete item from list by name
83
84 proc striptrailingslash {path} {
85 # split and rejoin gets rid of a traling / character.
86 return [eval [linsert [file split $path] 0 file join]]
87 }
88
89 # # ## ### ##### ######## #############
90 }
91
92
--- tools/cvs2fossil/lib/misc.tcl
+++ tools/cvs2fossil/lib/misc.tcl
@@ -81,11 +81,11 @@
81
82 # Delete item from list by name
83
84 proc striptrailingslash {path} {
85 # split and rejoin gets rid of a traling / character.
86 return [eval [linsert [file split $path] 0 ::file join]]
87 }
88
89 # # ## ### ##### ######## #############
90 }
91
92

Keyboard Shortcuts

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