blob: 8dfef7f20850f249839b5707b8e40b017263fe29 [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
12def openrcsclient(opts = []):
13 "open an RCSProxy client based on a list of options returned by getopt"
14 import RCSProxy
15 host = HOST
16 port = PORT
Guido van Rossum8bcd3011995-04-28 14:31:36 +000017 verbose = VERBOSE
Guido van Rossum177df7d1995-04-28 19:23:13 +000018 directory = None
Guido van Rossum8bcd3011995-04-28 14:31:36 +000019 for o, a in opts:
20 if o == '-h':
21 host = a
22 if ':' in host:
23 i = string.find(host, ':')
24 host, p = host[:i], host[i+1:]
25 if p:
26 port = string.atoi(p)
27 if o == '-p':
28 port = string.atoi(a)
29 if o == '-d':
30 directory = a
31 if o == '-v':
32 verbose = verbose + 1
33 if o == '-q':
34 verbose = 0
35 address = (host, port)
36 x = RCSProxy.RCSProxyClient(address, verbose)
Guido van Rossum177df7d1995-04-28 19:23:13 +000037 if not directory:
38 try:
39 directory = open("CVS/Repository").readline()
40 except IOError:
41 pass
42 else:
43 if directory[-1] == '\n':
44 directory = directory[:-1]
Guido van Rossum8bcd3011995-04-28 14:31:36 +000045 if directory:
46 x.cd(directory)
47 return x