-
Notifications
You must be signed in to change notification settings - Fork 7
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
Remove diff files #176
Conversation
mergin/merginproject.py
Outdated
"size": diff_size, | ||
"mtime": datetime.fromtimestamp(os.path.getmtime(diff_file), tzlocal()), | ||
} | ||
if diff_size > 0: |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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().
The clean in |
Fixes #47 |
In
MerginProject
methodget_push_changes()
check for zero size diff files and removes them.In
MerginClient
methodpush_project()
clean any existing diff files when the method ends.Fixes #47