From 123bc2593b3ab9e8ce41390a88769406594c456a Mon Sep 17 00:00:00 2001 From: Radek Pasiok Date: Wed, 14 Apr 2021 12:24:35 +0200 Subject: [PATCH] Handle exception when copying files and src/dest paths are the same in apply_pull_changes. --- mergin/merginproject.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mergin/merginproject.py b/mergin/merginproject.py index f7000aed..8ec60364 100644 --- a/mergin/merginproject.py +++ b/mergin/merginproject.py @@ -463,7 +463,10 @@ def apply_pull_changes(self, changes, temp_dir): if self.is_versioned_file(path): os.remove(basefile) else: - shutil.copy(src, dest) + try: + shutil.copy(src, dest) + except shutil.SameFileError: + self.log.info(f"Skip copying - paths are identical: {src} and {dest}") if self.is_versioned_file(path): shutil.copy(src, basefile)