|
|
@ -192,27 +192,24 @@ class ChangeDetectionStore:
|
|
|
|
tags.sort()
|
|
|
|
tags.sort()
|
|
|
|
return tags
|
|
|
|
return tags
|
|
|
|
|
|
|
|
|
|
|
|
def unlink_history_file(self, path):
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
unlink(path)
|
|
|
|
|
|
|
|
except (FileNotFoundError, IOError):
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Delete a single watch by UUID
|
|
|
|
# Delete a single watch by UUID
|
|
|
|
def delete(self, uuid):
|
|
|
|
def delete(self, uuid):
|
|
|
|
|
|
|
|
import pathlib
|
|
|
|
|
|
|
|
import shutil
|
|
|
|
|
|
|
|
|
|
|
|
with self.lock:
|
|
|
|
with self.lock:
|
|
|
|
if uuid == 'all':
|
|
|
|
if uuid == 'all':
|
|
|
|
self.__data['watching'] = {}
|
|
|
|
self.__data['watching'] = {}
|
|
|
|
|
|
|
|
|
|
|
|
# GitHub #30 also delete history records
|
|
|
|
# GitHub #30 also delete history records
|
|
|
|
for uuid in self.data['watching']:
|
|
|
|
for uuid in self.data['watching']:
|
|
|
|
for path in self.data['watching'][uuid].history.values():
|
|
|
|
path = pathlib.Path(os.path.join(self.datastore_path, uuid))
|
|
|
|
self.unlink_history_file(path)
|
|
|
|
shutil.rmtree(path)
|
|
|
|
|
|
|
|
self.needs_write_urgent = True
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
for path in self.data['watching'][uuid].history.values():
|
|
|
|
path = pathlib.Path(os.path.join(self.datastore_path, uuid))
|
|
|
|
self.unlink_history_file(path)
|
|
|
|
shutil.rmtree(path)
|
|
|
|
|
|
|
|
|
|
|
|
del self.data['watching'][uuid]
|
|
|
|
del self.data['watching'][uuid]
|
|
|
|
|
|
|
|
|
|
|
|
self.needs_write_urgent = True
|
|
|
|
self.needs_write_urgent = True
|
|
|
|