Sur une bonne idée de nico

Idé pour la suite : tester l'extention (pdf, png... = binaire) pour les
jours ou momo modifiera le site install party et qu'on va avoir les diff des
png.

darcs-hash:20060523134507-4ec08-0f55b09aefd2527e127888a1b58a582e54cb040c.gz
This commit is contained in:
chove 2006-05-23 15:45:07 +02:00
parent ef72c4badf
commit 455f077b6a

View file

@ -187,13 +187,13 @@ def calculate_diff(entry, contextlines):
fp.close()
# Is this a binary file? Let's look at the first few
# lines to figure it out:
for line in lines[:5]:
for c in string.rstrip(line):
if c in string.whitespace:
continue
if c < ' ' or c > chr(127):
lines = BINARY_EXPLANATION_LINES[:]
break
#for line in lines[:5]:
# for c in string.rstrip(line):
# if c in string.whitespace:
# continue
# if c < ' ' or c > chr(127):
# lines = BINARY_EXPLANATION_LINES[:]
# break
lines.insert(0, '--- NEW FILE: %s ---\n' % file)
except IOError, e:
lines = ['***** Error reading new file: ',