blob: eb09bce027ed03734e394a651e4226f48e3f2512 [file] [log] [blame]
Guido van Rossum8bcd3011995-04-28 14:31:36 +00001"Customize this file to change the default client etc."
2
3import string
4
Guido van Rossum177df7d1995-04-28 19:23:13 +00005# These defaults don't belong here -- they should be taken from the
6# environment or from a hidden file in the current directory
7
Guido van Rossum8bcd3011995-04-28 14:31:36 +00008HOST = 'voorn.cwi.nl'
9PORT = 4127
Guido van Rossum8bcd3011995-04-28 14:31:36 +000010VERBOSE = 1
11
Guido van Rossum72974f31995-06-23 21:59:12 +000012
13import client
14
15
16class RCSProxyClient(client.SecureClient):
17
18 def __init__(self, address, verbose = client.VERBOSE):
19 client.SecureClient.__init__(self, address, verbose)
20
21
Guido van Rossum8bcd3011995-04-28 14:31:36 +000022def openrcsclient(opts = []):
23 "open an RCSProxy client based on a list of options returned by getopt"
24 import RCSProxy
25 host = HOST
26 port = PORT
Guido van Rossum8bcd3011995-04-28 14:31:36 +000027 verbose = VERBOSE
Guido van Rossum177df7d1995-04-28 19:23:13 +000028 directory = None
Guido van Rossum8bcd3011995-04-28 14:31:36 +000029 for o, a in opts:
30 if o == '-h':
31 host = a
32 if ':' in host:
33 i = string.find(host, ':')
34 host, p = host[:i], host[i+1:]
35 if p:
36 port = string.atoi(p)
37 if o == '-p':
38 port = string.atoi(a)
39 if o == '-d':
40 directory = a
41 if o == '-v':
42 verbose = verbose + 1
43 if o == '-q':
44 verbose = 0
45 address = (host, port)
Guido van Rossum72974f31995-06-23 21:59:12 +000046 # XXX For local operation, instantiate RCSProxy.RCSProxyLocal() here
47 x = RCSProxyClient(address, verbose)
Guido van Rossum177df7d1995-04-28 19:23:13 +000048 if not directory:
49 try:
50 directory = open("CVS/Repository").readline()
51 except IOError:
52 pass
53 else:
54 if directory[-1] == '\n':
55 directory = directory[:-1]
Guido van Rossum8bcd3011995-04-28 14:31:36 +000056 if directory:
57 x.cd(directory)
58 return x