summaryrefslogtreecommitdiffstats
path: root/subcmds/sync.py
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r--subcmds/sync.py20
1 files changed, 5 insertions, 15 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py
index c99b06ca..3211cbb1 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -767,13 +767,9 @@ later is required to fix a server side protocol bug.
767 set(new_copyfile_paths)) 767 set(new_copyfile_paths))
768 768
769 for need_remove_file in need_remove_files: 769 for need_remove_file in need_remove_files:
770 try: 770 # Try to remove the updated copyfile or linkfile.
771 platform_utils.remove(need_remove_file) 771 # So, if the file is not exist, nothing need to do.
772 except OSError as e: 772 platform_utils.remove(need_remove_file, missing_ok=True)
773 if e.errno == errno.ENOENT:
774 # Try to remove the updated copyfile or linkfile.
775 # So, if the file is not exist, nothing need to do.
776 pass
777 773
778 # Create copy-link-files.json, save dest path of "copyfile" and "linkfile". 774 # Create copy-link-files.json, save dest path of "copyfile" and "linkfile".
779 with open(copylinkfile_path, 'w', encoding='utf-8') as fp: 775 with open(copylinkfile_path, 'w', encoding='utf-8') as fp:
@@ -1171,10 +1167,7 @@ class _FetchTimes(object):
1171 with open(self._path) as f: 1167 with open(self._path) as f:
1172 self._times = json.load(f) 1168 self._times = json.load(f)
1173 except (IOError, ValueError): 1169 except (IOError, ValueError):
1174 try: 1170 platform_utils.remove(self._path, missing_ok=True)
1175 platform_utils.remove(self._path)
1176 except OSError:
1177 pass
1178 self._times = {} 1171 self._times = {}
1179 1172
1180 def Save(self): 1173 def Save(self):
@@ -1192,10 +1185,7 @@ class _FetchTimes(object):
1192 with open(self._path, 'w') as f: 1185 with open(self._path, 'w') as f:
1193 json.dump(self._times, f, indent=2) 1186 json.dump(self._times, f, indent=2)
1194 except (IOError, TypeError): 1187 except (IOError, TypeError):
1195 try: 1188 platform_utils.remove(self._path, missing_ok=True)
1196 platform_utils.remove(self._path)
1197 except OSError:
1198 pass
1199 1189
1200# This is a replacement for xmlrpc.client.Transport using urllib2 1190# This is a replacement for xmlrpc.client.Transport using urllib2
1201# and supporting persistent-http[s]. It cannot change hosts from 1191# and supporting persistent-http[s]. It cannot change hosts from