Guido van Rossum | 8bcd301 | 1995-04-28 14:31:36 +0000 | [diff] [blame] | 1 | "Customize this file to change the default client etc." |
| 2 | |
| 3 | import string |
| 4 | |
Guido van Rossum | 177df7d | 1995-04-28 19:23:13 +0000 | [diff] [blame] | 5 | # 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 Rossum | 8bcd301 | 1995-04-28 14:31:36 +0000 | [diff] [blame] | 8 | HOST = 'voorn.cwi.nl' |
| 9 | PORT = 4127 |
Guido van Rossum | 8bcd301 | 1995-04-28 14:31:36 +0000 | [diff] [blame] | 10 | VERBOSE = 1 |
| 11 | |
Guido van Rossum | 72974f3 | 1995-06-23 21:59:12 +0000 | [diff] [blame^] | 12 | |
| 13 | import client |
| 14 | |
| 15 | |
| 16 | class RCSProxyClient(client.SecureClient): |
| 17 | |
| 18 | def __init__(self, address, verbose = client.VERBOSE): |
| 19 | client.SecureClient.__init__(self, address, verbose) |
| 20 | |
| 21 | |
Guido van Rossum | 8bcd301 | 1995-04-28 14:31:36 +0000 | [diff] [blame] | 22 | def 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 Rossum | 8bcd301 | 1995-04-28 14:31:36 +0000 | [diff] [blame] | 27 | verbose = VERBOSE |
Guido van Rossum | 177df7d | 1995-04-28 19:23:13 +0000 | [diff] [blame] | 28 | directory = None |
Guido van Rossum | 8bcd301 | 1995-04-28 14:31:36 +0000 | [diff] [blame] | 29 | 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 Rossum | 72974f3 | 1995-06-23 21:59:12 +0000 | [diff] [blame^] | 46 | # XXX For local operation, instantiate RCSProxy.RCSProxyLocal() here |
| 47 | x = RCSProxyClient(address, verbose) |
Guido van Rossum | 177df7d | 1995-04-28 19:23:13 +0000 | [diff] [blame] | 48 | 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 Rossum | 8bcd301 | 1995-04-28 14:31:36 +0000 | [diff] [blame] | 56 | if directory: |
| 57 | x.cd(directory) |
| 58 | return x |