File: ChangeRoot.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 (63 lines) | stat: -rwxr-xr-x 1,315 bytes parent folder | download | duplicates (3)
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
62
63
#!CVSGUI1.0 --selection --name "Change Root"

global numChanged
set numChanged 0
global changeTo

# PUT THE NEW VALUE HERE ! (ex: set changeTo ":pserver:alexgui@stratadev.strata3d.com:/cvspub/cvsgui")
set changeTo ""

if {[string compare $changeTo ""] == 0} {
	cvserr "You need to open this macro source file and edit it manually to set new cvsroot\n"
	return
}

proc changeRoot {dirName} {
	set oldDir [pwd]
	cd $dirName

	set fileid [open Root w]
	global changeTo
	puts $fileid $changeTo
	close $fileid
	
	global numChanged
	incr numChanged
	
	cd $oldDir
}

proc iterate {dirName} {
	set oldDir [pwd]
	cd $dirName
	cvsout "Entering $dirName\n"

	set dirList [glob -nocomplain *]
	set dirSize [llength $dirList]
	for {set j 0} {$j < $dirSize} {incr j} {
		set fileName [lindex $dirList $j]
		if {[file isdirectory $fileName]} {
			if {[string compare cvs [string tolower $fileName]] == 0} {
				changeRoot $fileName
			} else {
				iterate $fileName
			}
		}
	}
	cd $oldDir
}

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

for {set i 0} {$i < $selSize} {incr i} {
	set filename [lindex $selList $i]
	cvsbrowser info $filename fileInfo

	# check it is a folder
	if {[string compare $fileInfo(kind) "folder"] == 0} {
		iterate $filename
	}
}
cvsout "Done !\n"
cvsout "$numChanged file(s) changed !\n"