Subversion Repositories Koakuma

Rev

Rev 13 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 nishi 1
# $Id: vcs_cvs.tcl 27 2024-10-02 08:24:48Z nishi $
6 nishi 2
lappend components "CVS" "CVS Integration" "1.00" "VCS"
3 nishi 3
 
4
proc CVS_info {} {
5
	regexp {[0-9]+\.[0-9]+\.[0-9]+} "[exec cvs --version]" version
6
	tputs	"<table border=\"0\">"
7
	tputs	"	<tr>"
8
	tputs	"		<th>"
9
	tputs	"			Version"
10
	tputs	"		</th>"
11
	tputs	"		<td>"
12
	tputs	"			$version"
13
	tputs	"		</td>"
14
	tputs	"	</tr>"
15
	tputs	"</table>"
16
}
13 nishi 17
 
18
proc CVS_repository {url ws} {
19
	set result [URL_parse "$url"]
20
	set path "[regsub {@[^@]+$} "[Get_KV $result "path"]" ""]"
21
	regexp {^.+@([^@]+)$} "[Get_KV $result "path"]" -> reponame
22
 
23
	if { "[Get_KV $result "scheme"]" == "pserver" } {
24
		if { [file exists "$ws"] } {
25
			set old "[pwd]"
26
			cd "$ws"
27
			if { [catch {exec cvs -d ":pserver:[Get_KV $result "userpass"]@[Get_KV $result "host"]:$path" up >@stdout 2>@1}] } {
28
				cd "$old"
29
				return 1
30
			}
31
			cd "$old"
32
		} else {
33
			if { [catch {exec cvs -d ":pserver:[Get_KV $result "userpass"]@[Get_KV $result "host"]:$path" co -d "$ws" "$reponame" >@stdout 2>@1}] } {
34
				return 1
35
			}
36
		}
37
		return 0
38
	} elseif { "[Get_KV $result "scheme"]" == "file" } {
39
		if { [file exists "$ws"] } {
40
			set old "[pwd]"
41
			cd "$ws"
42
			if { [catch {exec cvs -d "$path" up >@stdout 2>@1}] } {
43
				cd "$old"
44
				return 1
45
			}
46
			cd "$old"
47
		} else {
48
			if { [catch {exec cvs -d "$path" co -d "$ws" "$reponame" >@stdout 2>@1}] } {
49
				return 1
50
			}
51
		}
52
		return 0
53
	} else {
54
		return 1
55
	}
56
	return 0
57
}