1"""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""" 8 9import string 10import os 11 12# These defaults don't belong here -- they should be taken from the 13# environment or from a hidden file in the current directory 14 15HOST = 'voorn.cwi.nl' 16PORT = 4127 17VERBOSE = 1 18LOCAL = 0 19 20import client 21 22 23class RCSProxyClient(client.SecureClient): 24 25 def __init__(self, address, verbose = client.VERBOSE): 26 client.SecureClient.__init__(self, address, verbose) 27 28 29def 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 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 72