Skip to content

Remove diff files #176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 17, 2023
Merged

Remove diff files #176

merged 9 commits into from
Jul 17, 2023

Conversation

JanCaha
Copy link
Contributor

@JanCaha JanCaha commented Jun 28, 2023

In MerginProject method get_push_changes() check for zero size diff files and removes them.

In MerginClient method push_project() clean any existing diff files when the method ends.

Fixes #47

@JanCaha JanCaha requested a review from wonder-sk June 28, 2023 09:11
"size": diff_size,
"mtime": datetime.fromtimestamp(os.path.getmtime(diff_file), tzlocal()),
}
if diff_size > 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"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
@@ -758,6 +759,7 @@ def push_project(self, directory):
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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().

@JanCaha
Copy link
Contributor Author

JanCaha commented Jun 28, 2023

The clean in push_project_finalize() should also happen in cases when errors are raised, right? So that the diff files removed in any case.

@JanCaha
Copy link
Contributor Author

JanCaha commented Jul 13, 2023

Fixes #47

@wonder-sk wonder-sk merged commit d441cf2 into master Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clean up of temp files after sync
2 participants