Diff
Not logged in

Differences From:

File tools/cvs2fossil/lib/c2f_pcollar.tcl part of check-in [70b0aa899a] - Found easier way to access the typevariables of singletons when writing the rcs parser. Now moved the other singletons to the same construction. by aku on 2007-10-06 22:13:25. [view]

To:

File tools/cvs2fossil/lib/c2f_pcollar.tcl part of check-in [a10f654ac7] - Added more checks to pass I looking for possible file/directory conflicts in the repository, and modified traverser to report on and ignore sub directories of Attic's. by aku on 2007-10-10 05:36:27. [view]

@@ -84,9 +84,10 @@
 	foreach project [repository projects] {
 	    set base [file join $rbase [$project base]]
 	    log write 1 collar "Scan $base"
 
-	    set traverse [fileutil::traverse %AUTO% $base]
+	    set traverse [fileutil::traverse %AUTO% $base \
+			      -prefilter [myproc FilterAtticSubdir $base]]
 	    set n 0
 	    set r {}
 
 	    $traverse foreach path {
@@ -95,8 +96,19 @@
 		if {![IsRCSArchive $path]} continue
 
 		set usr [UserPath $rcs isattic]
 		if {[IsSuperceded $base $rcs $usr $isattic]} continue
+
+		if {
+		    [file exists      $base/$usr] &&
+		    [file isdirectory $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 add $rcs $usr
 
@@ -124,8 +136,22 @@
     # # ## ### ##### ######## #############
     ## 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 {[file tail [file dirname $path]] eq "Attic"} {
+	    set ad [fileutil::stripPath $base $path]
+	    log write 1 collar "Directory $ad found in Attic, ignoring."
+	    return 0
+	}
+	return 1
+    }
 
     proc IsRCSArchive {path} {
 	if {![string match *,v $path]}     {return 0}
 	if {[fileutil::test $path fr msg]} {return 1}