summaryrefslogtreecommitdiffstats
path: root/Demo/pdist
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-04-28 17:56:32 (GMT)
committerGuido van Rossum <guido@python.org>1995-04-28 17:56:32 (GMT)
commit330e88408298d1c7809ad36e6d7edc16395fcf08 (patch)
tree1da20283ea5d89f5911a267b942e67edd3797813 /Demo/pdist
parentbafc14da6899ae89f03d89e5cc5edbc24de17f2f (diff)
downloadcpython-330e88408298d1c7809ad36e6d7edc16395fcf08.zip
cpython-330e88408298d1c7809ad36e6d7edc16395fcf08.tar.gz
cpython-330e88408298d1c7809ad36e6d7edc16395fcf08.tar.bz2
add diff command; add remove() function
Diffstat (limited to 'Demo/pdist')
-rwxr-xr-xDemo/pdist/rcvs.py44
1 files changed, 40 insertions, 4 deletions
diff --git a/Demo/pdist/rcvs.py b/Demo/pdist/rcvs.py
index 5eead4d..4620256 100755
--- a/Demo/pdist/rcvs.py
+++ b/Demo/pdist/rcvs.py
@@ -88,10 +88,7 @@ class MyFile(File):
print "%s: conflict resolution not yet implemented" % \
self.file
elif code == 'D':
- try:
- os.unlink(self.file)
- except os.error:
- pass
+ remove(self.file)
self.eseen = 0
elif code == 'r':
self.eseen = 0
@@ -115,6 +112,26 @@ class MyFile(File):
print "%s: conflict resolution not yet implemented" % \
self.file
+ def diff(self, opts = []):
+ import tempfile
+ flags = ''
+ for o, a in opts:
+ flags = flags + ' ' + o + a
+ flags = flags[1:]
+ fn = self.file
+ data = self.proxy.get(fn)
+ tfn = tempfile.mktemp()
+ try:
+ tf = open(tfn, 'w')
+ tf.write(data)
+ tf.close()
+ print 'diff %s -r%s %s' % (flags, self.rrev, fn)
+ sts = os.system('diff %s %s %s' % (flags, tfn, fn))
+ if sts:
+ print '='*70
+ finally:
+ remove(tfn)
+
def commitcheck(self):
return self.action() != 'C'
@@ -207,6 +224,7 @@ class rcvs(CommandFrameWork):
else:
self.cvs.entries[file].update()
self.cvs.putentries()
+ do_up = do_update
def do_commit(self, opts, files):
"""commit [file] ..."""
@@ -222,6 +240,24 @@ class rcvs(CommandFrameWork):
for file in files:
self.cvs.entries[file].commit(message)
self.cvs.putentries()
+ do_com = do_commit
+
+ def do_diff(self, opts, files):
+ """diff [difflags] [file] ..."""
+ if self.cvs.checkfiles(files):
+ return 1
+ for file in files:
+ self.cvs.entries[file].diff(opts)
+ do_dif = do_diff
+ flags_diff = 'cbitwcefhnlrsD:S:'
+
+
+
+def remove(fn):
+ try:
+ os.unlink(fn)
+ except os.error:
+ pass
def main():