Check-in [7208c7ac4d]
Not logged in
Overview

SHA1 Hash:7208c7ac4d1562657ecad27e7bc3e6e81405d460
Date: 2008-01-28 23:57:27
User: mjanssen
Comment: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

Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified tools/cvs2fossil/lib/c2f_file.tcl from [f9acec5443] to [ce592fc078].

@@ -264,11 +264,11 @@
 	# revmap  = dict (path -> rid)
 
 	array set idmap [$repository importfiles $filemap]
 
 	# Wipe workspace clean of the imported files.
-	foreach x [glob -directory $ws r*] { file delete $x }
+	foreach x [glob -directory $ws r*] { ::file delete $x }
 
 	foreach {path rid} $revmap {
 	    set uuid $idmap($path)
 	    state run {
 		INSERT INTO revuuid (rid,  uuid)
@@ -337,11 +337,11 @@
 	foreach {from to} $zarcs { $zp arc insert $from $to }
 
 	# Phase III: Traverse the graphs, expand the file, and
 	#            generate import instructions.
 
-	set archive [file join [$myproject fullpath] $mypath]
+	set archive [::file join [$myproject fullpath] $mypath]
 	set ac      [open $archive r]
 	fconfigure $ac -translation binary
 
 	# First traverse the expansion graph, this gives us the
 	# revisions in the order we have to expand them, which we do.

Modified tools/cvs2fossil/lib/c2f_fossil.tcl from [01daf9fb8c] to [6b47975f7e].

@@ -30,15 +30,15 @@
     ## Public API
 
     constructor {} {
 	set myrepository [fileutil::tempfile cvs2fossil_repo_]
 	set myworkspace  [fileutil::tempfile cvs2fossil_wspc_]
-	file delete $myworkspace
-	file mkdir  $myworkspace
-
-	Do new $myrepository
-	$self InWorkspace ; Do open $myrepository
+	::file delete $myworkspace
+	::file mkdir  $myworkspace
+
+	Do new [::file nativename $myrepository]
+	$self InWorkspace ; Do open [::file nativename $myrepository]
 	$self RestorePwd
 	return
     }
 
     # # ## ### ##### ######## #############
@@ -94,12 +94,12 @@
 	log write 3 fossil Done.
 	return [array get id]
     }
 
     method finalize {destination} {
-	file rename -force $myrepository $destination
-	file delete -force $myworkspace
+	::file rename -force $myrepository $destination
+	::file delete -force $myworkspace
 	$self destroy
 	return
     }
 
     # # ## ### ##### ######## #############

Modified tools/cvs2fossil/lib/c2f_patopsort.tcl from [bd89b94e5f] to [24672c709e].

@@ -117,11 +117,11 @@
 
     proc SaveTimestamps {graph at cset} {
 	set cid [$cset id]
 
 	set date [GetTime [lindex [$graph node get $cset timerange] 1] \
-		      [struct::set contain $mysymchangesets $cset] \
+		      [struct::set contains $mysymchangesets $cset] \
 		     message]
 
 	log write 4 atopsort "Changeset @ [format $myatfmt $at]: [format $mycsfmt [$cset str]]$message"
 
 	state run {

Modified tools/cvs2fossil/lib/c2f_pcollar.tcl from [b8d8d74143] to [49b5ac0453].

@@ -96,11 +96,11 @@
 	# Pass manager interface. Executed to perform the
 	# functionality of the pass.
 
 	set rbase [repository base?]
 	foreach project [repository projects] {
-	    set base [file join $rbase [$project base]]
+	    set base [::file join $rbase [$project base]]
 	    log write 1 collar "Scan $base"
 
 	    set traverse [fileutil::traverse %AUTO% $base \
 			      -prefilter [myproc FilterAtticSubdir $base]]
 	    set n 0
@@ -112,13 +112,14 @@
 		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 {
-		    [file exists      $base/$usr] &&
-		    [file isdirectory $base/$usr]
+		    [lsearch [glob -tail -types f -directory $base *] $usr] != -1 &&
+		    [lsearch [glob -tail -types d -directory $base *] $usr] != -1
 		} {
 		    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"
@@ -218,11 +219,13 @@
 
     proc IsSuperceded {base rcs usr isattic} {
 	::variable myignore
 
 	if {!$isattic}                   {return 0}
-	if {![file exists $base/$usr,v]} {return 0}
+
+	# use glob to account for case insensitive file systems
+	if {[lsearch [glob -tail -directory $base *] $usr,v] == -1} {return 0}
 
 	# We have a regular archive and an Attic archive refering to
 	# the same user visible file. Ignore the file in the Attic.
 	#
 	# By default this is a problem causing an abort after the pass

Modified tools/cvs2fossil/lib/c2f_pcollrev.tcl from [8de6139917] to [1a71981488].

@@ -316,18 +316,18 @@
 	# Pass manager interface. Executed to perform the
 	# functionality of the pass.
 
 	set rbase [repository base?]
 	foreach project [repository projects] {
-	    set base [file join $rbase [$project base]]
+	    set base [::file join $rbase [$project base]]
 	    log write 1 collrev "Processing $base"
 
 	    foreach file [$project files] {
 		set path [$file path]
 		log write 2 collrev "Parsing $path"
 		if {[catch {
-		    parser process [file join $base $path] $file
+		    parser process [::file join $base $path] $file
 		} msg]} {
 		    global errorCode
 		    if {$errorCode eq "vc::rcs::parser"} {
 			trouble fatal "$path is not a valid RCS archive ($msg)"
 		    } else {

Modified tools/cvs2fossil/lib/c2f_state.tcl from [6d7e829406] to [b7329274e1].

@@ -42,19 +42,20 @@
 
 	# In the second case we have to be able to create the file,
 	# and check that. This is done by opening it, sqlite will then
 	# try to create it, and may fail.
 
-	if {[file exists $path]} {
+	if {[::file exists $path]} {
 	    if {![fileutil::test $path frw msg {cvs2fossil state}]} {
 		trouble fatal $msg
 		return
 	    }
 	}
 
 	if {[catch {
 	    sqlite3 ${type}::TEMP $path
+	    ${type}::TEMP eval {PRAGMA synchronous=OFF;}
 	} res]} {
 	    trouble fatal $res
 	    return
 	}
 
@@ -80,20 +81,21 @@
 	if {$mystate ne ""} return
 
 	set mypath  [fileutil::tempfile cvs2fossil_state_]
 	set mystate ${type}::STATE
 	sqlite3 $mystate $mypath
+        $mystate eval {PRAGMA synchronous=OFF;}
 
 	log write 2 state "using $mypath"
 	return
     }
 
     typemethod release {} {
 	log write 2 state release
 	${type}::STATE close
 	if {$mypath eq ""} return
-	file delete $mypath
+	::file delete $mypath
 	return
     }
 
     # Declare a table needed for the storing of persistent state, and
     # its structure. A possibly previously existing definition is

Modified tools/cvs2fossil/lib/dot.tcl from [d011b07fae] to [a07b3e3a20].

@@ -58,11 +58,11 @@
 
     typemethod layout {format g name file} {
 	set f [fileutil::tempfile c2fdot_]
 	$type write $g $name $f
 	exec dot -T $format -o $file $f
-	file delete $f
+	::file delete $f
 	return
     }
 
     # # ## ### ##### ######## #############
     ## Internal, state

Modified tools/cvs2fossil/lib/misc.tcl from [98d22d5109] to [470a71c4d1].

@@ -81,11 +81,11 @@
 
     # Delete item from list by name
 
     proc striptrailingslash {path} {
 	# split and rejoin gets rid of a traling / character.
-	return [eval [linsert [file split $path] 0 file join]]
+	return [eval [linsert [file split $path] 0 ::file join]]
     }
 
     # # ## ### ##### ######## #############
 }