patching: fix datetimes in generated patches

This commit is contained in:
Fabio Valentini 2023-02-13 23:18:23 +01:00
parent 8cb17e350b
commit a15e90542d
No known key found for this signature in database
GPG key ID: 5AC5F572E5D410AF

View file

@ -173,7 +173,8 @@ def make_patches(
with open(toml_path, "w") as file: with open(toml_path, "w") as file:
file.writelines(toml_after) file.writelines(toml_after)
diff1 = make_diff_from_lines(diff_path, toml_before, mtime_before, toml_after, mtime_before) mtime_after1 = file_mtime_in_iso_format(toml_path)
diff1 = make_diff_from_lines(diff_path, toml_before, mtime_before, toml_after, mtime_after1)
else: else:
toml_after = toml_before toml_after = toml_before
@ -182,11 +183,10 @@ def make_patches(
editor = detect_editor() editor = detect_editor()
subprocess.check_call([editor, toml_path]) subprocess.check_call([editor, toml_path])
mtime_after2 = file_mtime_in_iso_format(toml_path)
with open(toml_path) as file: with open(toml_path) as file:
toml_after2 = file.readlines() toml_after2 = file.readlines()
mtime_after2 = file_mtime_in_iso_format(toml_path)
diff2 = make_diff_from_lines(diff_path, toml_after, mtime_before, toml_after2, mtime_after2) diff2 = make_diff_from_lines(diff_path, toml_after, mtime_before, toml_after2, mtime_after2)
return diff1, diff2 return diff1, diff2