File: Cleanup.tcl

package info (click to toggle)
gcvs 1.0final-12
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 12,248 kB
  • ctags: 10,631
  • sloc: ansic: 71,709; cpp: 39,780; sh: 18,434; makefile: 1,915; yacc: 1,299; tcl: 1,283; perl: 910; lex: 249; csh: 185; lisp: 7
file content (61 lines) | stat: -rwxr-xr-x 1,510 bytes parent folder | download | duplicates (4)
1
2
3
4
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!CVSGUI1.0 --selection --name "Remove non-CVS files"

global numFound
set numFound 0

proc iterate {dirName} {
	cvsentries $dirName browsit

	set selList [browsit get]
	set selSize [llength $selList]
	set toRecurse {}
	set printFlag 1

	for {set j 0} {$j < $selSize} {incr j} {
		set file [lindex $selList $j]
		browsit info $file fileInfo2

		if {[string compare $fileInfo2(kind) "file"] == 0 || [string compare $fileInfo2(kind) "folder"] == 0} {
			if {$fileInfo2(ignored) == 1 } {
				file delete -force $file
                global numFound
				incr numFound
			} elseif {$fileInfo2(unknown) == 1} {
                if {$printFlag == 1} {
	                cvsout "In $dirName :\n"
	                set printFlag 0
                }
                cvserr "    $fileInfo2(name)\n"
				trash $file
				global numFound
				incr numFound
			}
		}

		if {[string compare $fileInfo2(kind) "folder"] == 0 && $fileInfo2(missing) == 0 && $fileInfo2(unknown) == 0} {
			lappend toRecurse $file
		}
	}

	set selRecurse [llength $toRecurse]
	for {set j 0} {$j < $selRecurse} {incr j} {
		set file [lindex $toRecurse $j]
		iterate $file
	}
}

set selList [cvsbrowser get]
set selSize [llength $selList]

cvsout "Removing non-CVS files...\n"
for {set i 0} {$i < $selSize} {incr i} {
	set file [lindex $selList $i]
	cvsbrowser info $file fileInfo

	if {[string compare $fileInfo(kind) "folder"] == 0 && $fileInfo(missing) == 0 && $fileInfo(unknown) == 0} {
		iterate $file
	}
}

cvsout "Items(s) removed: $numFound \n"