summaryrefslogtreecommitdiffstats
path: root/Tools/scripts
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-11-04 17:35:43 (GMT)
committerGuido van Rossum <guido@python.org>1997-11-04 17:35:43 (GMT)
commit79b2038aa40a7532e7aa3dc9c3bfbc3fd1228630 (patch)
treee70f43d87f2c6b1e2905c8ac01abf624b9d93326 /Tools/scripts
parent19f44560f2387fd0f7e7f6b459510428216b6f79 (diff)
downloadcpython-79b2038aa40a7532e7aa3dc9c3bfbc3fd1228630.zip
cpython-79b2038aa40a7532e7aa3dc9c3bfbc3fd1228630.tar.gz
cpython-79b2038aa40a7532e7aa3dc9c3bfbc3fd1228630.tar.bz2
When checking for equality, open the slave file in text mode so it
will compare equal even if the master file uses only \n to terminate lines (this is by far the most common situation). Also, check for the case where the master file is missing, and print the time difference in seconds when the slave file appears newer than the master (for debugging).
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-xTools/scripts/treesync.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Tools/scripts/treesync.py b/Tools/scripts/treesync.py
index f039385..26c3cd5 100755
--- a/Tools/scripts/treesync.py
+++ b/Tools/scripts/treesync.py
@@ -108,7 +108,7 @@ def process(slave, master):
def compare(slave, master):
try:
- sf = open(slave, 'rb')
+ sf = open(slave, 'r')
except IOError:
sf = None
try:
@@ -117,11 +117,14 @@ def compare(slave, master):
mf = None
if not sf:
if not mf:
- print "Not updating missing master", master
+ print "Neither master nor slave exists", master
return
print "Creating missing slave", slave
copy(master, slave, answer=create_files)
return
+ if not mf:
+ print "Not updating missing master", master
+ return
if sf and mf:
if identical(sf, mf):
return
@@ -136,6 +139,7 @@ def compare(slave, master):
copy(master, slave, answer=write_slave)
return
# Slave is newer -- copy slave to master
+ print "Slave is", sft-mft, "seconds newer than master"
# But first check what to do about CRLF
mf.seek(0)
fun = funnychars(mf)