diff.py: add binary support
This commit is contained in:
parent
f979aa993d
commit
d93404353e
1 changed files with 12 additions and 8 deletions
|
@ -42,11 +42,15 @@ type = "installe"
|
|||
+++
|
||||
""")
|
||||
for filename in FILES:
|
||||
print(f'- mise à jour du fichier {filename} :\n')
|
||||
try:
|
||||
with open(join(OLD_DIR, filename[1:]), 'r') as ori:
|
||||
ori_content = ori.readlines()
|
||||
with open(join(NEW_DIR, filename[1:]), 'r') as new:
|
||||
new_content = new.readlines()
|
||||
print(f'- mise à jour du fichier {filename} :\n')
|
||||
except UnicodeDecodeError:
|
||||
print('fichier binaire')
|
||||
else:
|
||||
print('```diff')
|
||||
for line in unified_diff(ori_content, new_content, fromfile=filename, tofile=filename):
|
||||
print(line.rstrip())
|
||||
|
|
Loading…
Reference in a new issue