blob: 5d88a5798146ee555248d081aec36776dd6ef756 [file] [log] [blame]
Guido van Rossum464f62b1995-06-23 22:41:34 +00001"""Customize this file to change the default client etc.
2
3(In general, it is probably be better to make local operation the
4default and to require something like an RCSSERVER environment
5variable to enable remote operation.)
6
7"""
Guido van Rossum8bcd3011995-04-28 14:31:36 +00008
9import string
Guido van Rossum11bb1741995-10-07 19:26:06 +000010import os
Guido van Rossum8bcd3011995-04-28 14:31:36 +000011
Guido van Rossum177df7d1995-04-28 19:23:13 +000012# These defaults don't belong here -- they should be taken from the
13# environment or from a hidden file in the current directory
14
Guido van Rossum8bcd3011995-04-28 14:31:36 +000015HOST = 'voorn.cwi.nl'
16PORT = 4127
Guido van Rossum8bcd3011995-04-28 14:31:36 +000017VERBOSE = 1
Guido van Rossum464f62b1995-06-23 22:41:34 +000018LOCAL = 0
Guido van Rossum72974f31995-06-23 21:59:12 +000019
20import client
21
22
23class RCSProxyClient(client.SecureClient):
24
Guido van Rossum4117e541998-09-14 16:44:15 +000025 def __init__(self, address, verbose = client.VERBOSE):
26 client.SecureClient.__init__(self, address, verbose)
Guido van Rossum72974f31995-06-23 21:59:12 +000027
28
Guido van Rossum8bcd3011995-04-28 14:31:36 +000029def openrcsclient(opts = []):
30 "open an RCSProxy client based on a list of options returned by getopt"
31 import RCSProxy
32 host = HOST
33 port = PORT
Guido van Rossum8bcd3011995-04-28 14:31:36 +000034 verbose = VERBOSE
Guido van Rossum464f62b1995-06-23 22:41:34 +000035 local = LOCAL
Guido van Rossum177df7d1995-04-28 19:23:13 +000036 directory = None
Guido van Rossum8bcd3011995-04-28 14:31:36 +000037 for o, a in opts:
38 if o == '-h':
39 host = a
40 if ':' in host:
41 i = string.find(host, ':')
42 host, p = host[:i], host[i+1:]
43 if p:
44 port = string.atoi(p)
45 if o == '-p':
46 port = string.atoi(a)
47 if o == '-d':
48 directory = a
49 if o == '-v':
50 verbose = verbose + 1
51 if o == '-q':
52 verbose = 0
Guido van Rossum464f62b1995-06-23 22:41:34 +000053 if o == '-L':
54 local = 1
55 if local:
56 import RCSProxy
57 x = RCSProxy.RCSProxyLocal()
58 else:
59 address = (host, port)
60 x = RCSProxyClient(address, verbose)
Guido van Rossum177df7d1995-04-28 19:23:13 +000061 if not directory:
62 try:
Guido van Rossum11bb1741995-10-07 19:26:06 +000063 directory = open(os.path.join("CVS", "Repository")).readline()
Guido van Rossum177df7d1995-04-28 19:23:13 +000064 except IOError:
65 pass
66 else:
67 if directory[-1] == '\n':
68 directory = directory[:-1]
Guido van Rossum8bcd3011995-04-28 14:31:36 +000069 if directory:
70 x.cd(directory)
71 return x