blob: d8cb004b2f3f7e2b37be3fd056f6a540182ed6f6 [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):
Tim Peterse6ddc8b2004-07-18 05:56:09 +000024
25 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 = []):
Tim Peterse6ddc8b2004-07-18 05:56:09 +000030 "open an RCSProxy client based on a list of options returned by getopt"
31 import RCSProxy
32 host = HOST
33 port = PORT
34 verbose = VERBOSE
35 local = LOCAL
36 directory = None
37 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
53 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)
61 if not directory:
62 try:
63 directory = open(os.path.join("CVS", "Repository")).readline()
64 except IOError:
65 pass
66 else:
67 if directory[-1] == '\n':
68 directory = directory[:-1]
69 if directory:
70 x.cd(directory)
71 return x