summaryrefslogtreecommitdiffstats
path: root/Demo/pdist/rcsclient.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-04-28 19:23:13 (GMT)
committerGuido van Rossum <guido@python.org>1995-04-28 19:23:13 (GMT)
commit177df7d7c9c0b1f08542fc78f4fb52e72eb83738 (patch)
treecb7bec36462fdf3253fde50aa781dd3cc1d9a3f4 /Demo/pdist/rcsclient.py
parent330e88408298d1c7809ad36e6d7edc16395fcf08 (diff)
downloadcpython-177df7d7c9c0b1f08542fc78f4fb52e72eb83738.zip
cpython-177df7d7c9c0b1f08542fc78f4fb52e72eb83738.tar.gz
cpython-177df7d7c9c0b1f08542fc78f4fb52e72eb83738.tar.bz2
get default directory from CVS/Repository
Diffstat (limited to 'Demo/pdist/rcsclient.py')
-rwxr-xr-xDemo/pdist/rcsclient.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/Demo/pdist/rcsclient.py b/Demo/pdist/rcsclient.py
index 22459a1..8dfef7f 100755
--- a/Demo/pdist/rcsclient.py
+++ b/Demo/pdist/rcsclient.py
@@ -2,9 +2,11 @@
import string
+# These defaults don't belong here -- they should be taken from the
+# environment or from a hidden file in the current directory
+
HOST = 'voorn.cwi.nl'
PORT = 4127
-DIRECTORY = '/ufs/guido/voorn/python-RCS/Demo/pdist'
VERBOSE = 1
def openrcsclient(opts = []):
@@ -12,8 +14,8 @@ def openrcsclient(opts = []):
import RCSProxy
host = HOST
port = PORT
- directory = DIRECTORY
verbose = VERBOSE
+ directory = None
for o, a in opts:
if o == '-h':
host = a
@@ -32,6 +34,14 @@ def openrcsclient(opts = []):
verbose = 0
address = (host, port)
x = RCSProxy.RCSProxyClient(address, verbose)
+ if not directory:
+ try:
+ directory = open("CVS/Repository").readline()
+ except IOError:
+ pass
+ else:
+ if directory[-1] == '\n':
+ directory = directory[:-1]
if directory:
x.cd(directory)
return x