]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
daira's fix instead of deleted_files, and .backup not .tmp
authormeejah <meejah@meejah.ca>
Mon, 26 Oct 2015 14:05:19 +0000 (08:05 -0600)
committermeejah <meejah@meejah.ca>
Mon, 26 Oct 2015 14:13:33 +0000 (08:13 -0600)
src/allmydata/frontends/magic_folder.py
src/allmydata/magicfolderdb.py

index 8816ccb53a6e98231599d42a111754c077be9621..2121356ab103d728d84cfc34b0f03dfe56bc3290 100644 (file)
@@ -64,8 +64,6 @@ class MagicFolder(service.MultiService):
 
         self.uploader = Uploader(client, local_path_u, db, upload_dircap, pending_delay, clock)
         self.downloader = Downloader(client, local_path_u, db, collective_dircap, clock)
-        # FIXME FIXME FIXME horrible, just trying it out
-        self.downloader._deleted_files = self.uploader._deleted_files
 
     def startService(self):
         # TODO: why is this being called more than once?
@@ -207,14 +205,6 @@ class Uploader(QueueMixin):
         self._notifier.watch(self._local_filepath, mask=self.mask, callbacks=[self._notify],
                              recursive=True)
 
-        # we keep a list of files we've "recently" deleted, as we'll
-        # get inotify events for these, but we want to ignore
-        # them. (e.g. if we just decided we need to delete a file
-        # locally, we don't want to immediately upload a new "deleted"
-        # version of it)
-        self._deleted_files = []
-
-
     def start_monitoring(self):
         self._log("start_monitoring")
         d = defer.succeed(None)
@@ -688,8 +678,7 @@ class Downloader(QueueMixin, WriteFileMixin):
     def _unlink_deleted_file(self, abspath_u, result):
         try:
             self._log('unlinking: %s' % (abspath_u,))
-            self._deleted_files.append(abspath_u)
-            shutil.move(abspath_u, abspath_u + '.tmp')
+            shutil.move(abspath_u, abspath_u + '.backup')
         except IOError:
             self._log("Already gone: '%s'" % (abspath_u,))
         return abspath_u
index ba338138f99307a6abab389c321fa39c0571e6d7..0c76a7b012a6cbc3ffd38c32d93032010599bf4b 100644 (file)
@@ -135,4 +135,6 @@ class MagicFolderDB(object):
         row = self.cursor.fetchone()
         if not row:
             return True
+        if not pathinfo.exists and row[0] is None:
+            return False
         return (pathinfo.size, pathinfo.mtime, pathinfo.ctime) != row