summaryrefslogtreecommitdiffstats
path: root/Demo/pdist/rcsclient.py
blob: 22459a18113a25d6eadd7135e892c8306e63e7af (plain)
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
"Customize this file to change the default client etc."

import string

HOST = 'voorn.cwi.nl'
PORT = 4127
DIRECTORY = '/ufs/guido/voorn/python-RCS/Demo/pdist'
VERBOSE = 1

def openrcsclient(opts = []):
	"open an RCSProxy client based on a list of options returned by getopt"
	import RCSProxy
	host = HOST
	port = PORT
	directory = DIRECTORY
	verbose = VERBOSE
	for o, a in opts:
		if o == '-h':
			host = a
			if ':' in host:
				i = string.find(host, ':')
				host, p = host[:i], host[i+1:]
				if p:
					port = string.atoi(p)
		if o == '-p':
			port = string.atoi(a)
		if o == '-d':
			directory = a
		if o == '-v':
			verbose = verbose + 1
		if o == '-q':
			verbose = 0
	address = (host, port)
	x = RCSProxy.RCSProxyClient(address, verbose)
	if directory:
		x.cd(directory)
	return x