Merged
Conversation
wonder-sk
reviewed
Jun 28, 2023
mergin/merginproject.py
Outdated
| "size": diff_size, | ||
| "mtime": datetime.fromtimestamp(os.path.getmtime(diff_file), tzlocal()), | ||
| } | ||
| if diff_size > 0: |
Contributor
There was a problem hiding this comment.
"if diff_size > 0" is not necessary, because the self.geodiff.has_changes(diff_file) check above is equivalent of that
mergin/client.py
Outdated
| return # there is nothing to push (or we only deleted some files) | ||
| push_project_wait(job) | ||
| push_project_finalize(job) | ||
| self.clean_temp_files(directory) |
Contributor
There was a problem hiding this comment.
it would be better to clean temp files in the push_project_finalize() call instead of here...
mergin/client.py
Outdated
| mergin_dir = Path(directory) / ".mergin" | ||
| if mergin_dir.exists(): | ||
| for file in mergin_dir.glob("*-diff-*"): | ||
| file.unlink() |
Contributor
There was a problem hiding this comment.
Rather than doing this kind of bulk erase, I would prefer that after the call to get_push_changes(), we figure out list of all temporary diff files (using changes["updated"] entries that have "diff" key - as created in get_push_changes().
Contributor
Author
|
The clean in |
Contributor
Author
|
Fixes #47 |
wonder-sk
approved these changes
Jul 17, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In
MerginProjectmethodget_push_changes()check for zero size diff files and removes them.In
MerginClientmethodpush_project()clean any existing diff files when the method ends.Fixes #47