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 | |
| 12 | def 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 Rossum | 8bcd301 | 1995-04-28 14:31:36 +0000 | [diff] [blame] | 17 | verbose = VERBOSE |
Guido van Rossum | 177df7d | 1995-04-28 19:23:13 +0000 | [diff] [blame^] | 18 | directory = None |
Guido van Rossum | 8bcd301 | 1995-04-28 14:31:36 +0000 | [diff] [blame] | 19 | 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 Rossum | 177df7d | 1995-04-28 19:23:13 +0000 | [diff] [blame^] | 37 | 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 Rossum | 8bcd301 | 1995-04-28 14:31:36 +0000 | [diff] [blame] | 45 | if directory: |
| 46 | x.cd(directory) |
| 47 | return x |