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

Overview
Comment:Moved the new case-sensitive file checking code into the misc package with descriptive command names, to recapture clarity of code at the calling places.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:edc46651c7f9ad0ad3cbd1273ae519e65359536d
User & Date: aku 2008-01-29 04:05:10
Context
2008-01-30
03:10
Fixed the names for the case-sensitive file operations. check-in: ed13b28b user: aku tags: trunk
2008-01-29
04:05
Moved the new case-sensitive file checking code into the misc package with descriptive command names, to recapture clarity of code at the calling places. check-in: edc46651 user: aku tags: trunk
01:11
Error message on "commit" or "user default" if the user does not exist. check-in: e2a42f7a user: drh tags: trunk
Changes

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

20
21
22
23
24
25
26

27
28
29
30
31
32
33
...
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
...
216
217
218
219
220
221
222
223
224
225
226

227
228
229
230
231
232
233
...
254
255
256
257
258
259
260

261
262
263
264
265
266
267
268
269

package require Tcl 8.4                             ; # Required runtime.
package require snit                                ; # OO system.
package require fileutil::traverse                  ; # Directory traversal.
package require fileutil                            ; # File & path utilities.
package require vc::tools::trouble                  ; # Error reporting.
package require vc::tools::log                      ; # User feedback.

package require vc::fossil::import::cvs::pass       ; # Pass management.
package require vc::fossil::import::cvs::repository ; # Repository management.
package require vc::fossil::import::cvs::state      ; # State storage

# # ## ### ##### ######## ############# #####################
## Register the pass with the management

................................................................................
		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 {
		    [lsearch [glob -nocomplain -tail -types f -directory $base *] $usr] != -1 &&
		    [lsearch [glob -nocomplain -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"
		    continue
		}
................................................................................

	return $f
    }

    proc IsSuperceded {base rcs usr isattic} {
	::variable myignore

	if {!$isattic}                   {return 0}

	# use glob to account for case insensitive file systems 
	if {[lsearch [glob -nocomplain -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
	# has completed. The user can however force us to ignore it.
	# In that case the warning is still printed, but will not
................................................................................
namespace eval ::vc::fossil::import::cvs::pass {
    namespace export collar
    namespace eval collar {
	namespace import ::vc::fossil::import::cvs::repository
	namespace import ::vc::fossil::import::cvs::state
	namespace import ::vc::tools::trouble
	namespace import ::vc::tools::log

	log register collar
    }
}

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

package provide vc::fossil::import::cvs::pass::collar 1.0
return







>







 







|
|







 







|
<
<
<
>







 







>









20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
...
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
...
217
218
219
220
221
222
223
224



225
226
227
228
229
230
231
232
...
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269

package require Tcl 8.4                             ; # Required runtime.
package require snit                                ; # OO system.
package require fileutil::traverse                  ; # Directory traversal.
package require fileutil                            ; # File & path utilities.
package require vc::tools::trouble                  ; # Error reporting.
package require vc::tools::log                      ; # User feedback.
package require vc::tools::misc                     ; # Local file utilities.
package require vc::fossil::import::cvs::pass       ; # Pass management.
package require vc::fossil::import::cvs::repository ; # Repository management.
package require vc::fossil::import::cvs::state      ; # State storage

# # ## ### ##### ######## ############# #####################
## Register the pass with the management

................................................................................
		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_ci $base/$usr] &&
		    [fileisdir_ci  $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
		}
................................................................................

	return $f
    }

    proc IsSuperceded {base rcs usr isattic} {
	::variable myignore

	if {!$isattic}                     {return 0}



	if {![fileexists_ci $base/$usr,v]} {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
	# has completed. The user can however force us to ignore it.
	# In that case the warning is still printed, but will not
................................................................................
namespace eval ::vc::fossil::import::cvs::pass {
    namespace export collar
    namespace eval collar {
	namespace import ::vc::fossil::import::cvs::repository
	namespace import ::vc::fossil::import::cvs::state
	namespace import ::vc::tools::trouble
	namespace import ::vc::tools::log
	namespace import ::vc::tools::misc::file*
	log register collar
    }
}

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

package provide vc::fossil::import::cvs::pass::collar 1.0
return

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

81
82
83
84
85
86
87
88











































89
90
91
92
93

94
95
96
97
98
99
100

    # 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]]
    }












































    # # ## ### ##### ######## #############
}

namespace eval ::vc::tools::misc {
    namespace export sp nsp max min max2 min2 ldelete striptrailingslash

}

# -----------------------------------------------------------------------------
# Ready

package provide vc::tools::misc 1.0
return








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




|
>







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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
136
137
138
139
140
141
142
143
144

    # 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]]
    }

    # The windows filesystem is storing file-names case-sensitive, but
    # matching is case-insensitive. That is a problem as without
    # precaution the two files Attic/X,v and x,v may be mistakenly
    # identified as the same file. A similar thing can happen for
    # files and directories. To prevent such mistakes we need commands
    # which do case-sensitive file matching even on systems which do
    # not perform this natively. These are below.

    if {$tcl_platform(platform) eq "windows"} {
	# We use glob to get the list of files (with proper case in
	# the names) to perform our own, case-sensitive matching. WE
	# use 8.5 features where possible, for clarity.

	if {[package vsatisfies [package present Tcl] 8.5]} {
	    proc fileexists_ci {path} {
		set dir  [::file dirname $path]
		set file [::file tail    $path]
		return [expr {$file in [glob -nocomplain -tail -directory $dir *]}]
	    }

	    proc fileisdir_ci {path} {
		set dir  [::file dirname $path]
		set file [::file tail    $path]
		return [expr {$file in [glob -nocomplain -types d -tail -directory $dir *]}]
	    }
	} else {
	    proc fileexists_ci {path} {
		set dir  [::file dirname $path]
		set file [::file tail    $path]
		return [expr {[lsearch [glob -nocomplain -tail -directory $dir *] $file] >= 0}]
	    }

	    proc fileisdir_ci {path} {
		set dir  [::file dirname $path]
		set file [::file tail    $path]
		return [expr {[lsearch [glob -nocomplain -types d -tail -directory $dir *] $file] >= 0}]
	    }
	}
    } else {
	proc fileexists_ci {path} { return [file exists      $path] }
	proc fileisdir_ci  {path} { return [file isdirectory $path] }
    }

    # # ## ### ##### ######## #############
}

namespace eval ::vc::tools::misc {
    namespace export sp nsp max min max2 min2 ldelete
    namespace export striptrailingslash fileexists_ci fileisdir_ci
}

# -----------------------------------------------------------------------------
# Ready

package provide vc::tools::misc 1.0
return