From f8bdfa01f1e71524ce97b5f10ff6ab4bce0fa470 Mon Sep 17 00:00:00 2001 From: meejah Date: Mon, 26 Oct 2015 08:55:50 -0600 Subject: [PATCH] WIP fixes for delete --- src/allmydata/frontends/magic_folder.py | 5 ++++- src/allmydata/test/test_magic_folder.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index 2121356a..3006ce67 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -320,7 +320,10 @@ class Uploader(QueueMixin): last_downloaded_uri = self._db.get_last_downloaded_uri(relpath_u) current_version = self._db.get_local_file_version(relpath_u) - if current_version is None: + if not self._db.is_new_file(pathinfo, relpath_u): + self._log("ignoring {}".format(relpath_u)) + return + elif current_version is None: new_version = 0 else: new_version = current_version + 1 diff --git a/src/allmydata/test/test_magic_folder.py b/src/allmydata/test/test_magic_folder.py index 6fa33380..bd7cfbb5 100644 --- a/src/allmydata/test/test_magic_folder.py +++ b/src/allmydata/test/test_magic_folder.py @@ -364,6 +364,7 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual 1 ) + print("BOB DELETE") # now bob deletes it (bob should upload, alice download) bob_proc = self.bob_magicfolder.uploader.set_hook('processed') alice_proc = self.alice_magicfolder.downloader.set_hook('processed') @@ -383,6 +384,7 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual yield self._check_version_in_dmd(self.alice_magicfolder, u"blam", 1) yield self._check_version_in_local_db(self.alice_magicfolder, u"blam", 1) + print("ALICE RESTORE") # now alice restores it (alice should upload, bob download) alice_proc = self.alice_magicfolder.uploader.set_hook('processed') bob_proc = self.bob_magicfolder.downloader.set_hook('processed') -- 2.45.2