295 messages.remove(message) |
295 messages.remove(message) |
296 messages.insert(0, message) |
296 messages.insert(0, message) |
297 del messages[noMessages:] |
297 del messages[noMessages:] |
298 |
298 |
299 with contextlib.suppress(TypeError, OSError): |
299 with contextlib.suppress(TypeError, OSError): |
300 jsonString = json.dumps(messages, indent=2) |
300 jsonString = json.dumps(messages, indent=2) + "\n" |
301 with open( |
301 with open( |
302 os.path.join(projectMgmtDir, VersionControl.commitHistoryData), |
302 os.path.join(projectMgmtDir, VersionControl.commitHistoryData), |
303 "w", |
303 "w", |
304 ) as f: |
304 ) as f: |
305 f.write(jsonString) |
305 f.write(jsonString) |
329 lockFile = QLockFile( |
329 lockFile = QLockFile( |
330 os.path.join(projectMgmtDir, VersionControl.commitHistoryLock) |
330 os.path.join(projectMgmtDir, VersionControl.commitHistoryLock) |
331 ) |
331 ) |
332 if lockFile.lock(): |
332 if lockFile.lock(): |
333 with contextlib.suppress(TypeError, OSError): |
333 with contextlib.suppress(TypeError, OSError): |
334 jsonString = json.dumps([], indent=2) |
334 jsonString = json.dumps([], indent=2) + "\n" |
335 with open( |
335 with open( |
336 os.path.join(projectMgmtDir, VersionControl.commitHistoryData), |
336 os.path.join(projectMgmtDir, VersionControl.commitHistoryData), |
337 "w", |
337 "w", |
338 ) as f: |
338 ) as f: |
339 f.write(jsonString) |
339 f.write(jsonString) |