Skip to content

Commit 8bc6f44

Browse files
varmar05wonder-sk
authored andcommitted
after push use geodiff to sync local basefiles to avoid issues with tmp files
1 parent 96f1d52 commit 8bc6f44

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

mergin/client.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,19 @@ def apply_push_changes(self, changes):
416416
move_file(self.fpath_meta(item["path"]), basefile)
417417
elif k == 'removed':
418418
os.remove(basefile)
419-
else:
419+
elif k == 'added':
420420
shutil.copy(self.fpath(path), basefile)
421+
elif k == 'updated':
422+
# better to apply diff to previous basefile to avoid issues with geodiff tmp files
423+
changeset = self.fpath_meta(item['diff']['path'])
424+
patchedfile = self.apply_diffs(basefile, [changeset])
425+
if patchedfile:
426+
move_file(patchedfile, basefile)
427+
else:
428+
# in case of local sync issues it is safier to remove basefile, next time it will be downloaded from server
429+
os.remove(basefile)
430+
else:
431+
pass
421432

422433
def backup_file(self, file):
423434
"""

0 commit comments

Comments
 (0)