From 435b30c7aaaae5d09af53ab46d35e6fbf16c8258 Mon Sep 17 00:00:00 2001 From: meejah Date: Thu, 29 Mar 2018 09:25:48 -0600 Subject: [PATCH] use local last_uploaded_uri, last class of conflict from spec --- src/allmydata/frontends/magic_folder.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index f553ec436..fa5ac1ef3 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -1315,7 +1315,6 @@ class Downloader(QueueMixin, WriteFileMixin): def do_update_db(written_abspath_u): filecap = item.file_node.get_uri() - self._log("updating last_uploaded_uri to {}".format(last_uploaded_uri)) if not item.file_node.get_size(): filecap = None # ^ is an empty file last_downloaded_uri = filecap @@ -1369,8 +1368,8 @@ class Downloader(QueueMixin, WriteFileMixin): # for this file, which is the URI under which the file was last # uploaded. - self._log("HI0") if db_entry: + dmd_last_uploaded_uri = db_entry.last_uploaded_uri # * 2c. If any of the following are true, then classify as a conflict: @@ -1383,7 +1382,6 @@ class Downloader(QueueMixin, WriteFileMixin): # current statinfo; if current_statinfo.exists: - self._log("HI1") if (db_entry.mtime_ns != current_statinfo.mtime_ns or \ db_entry.ctime_ns != current_statinfo.ctime_ns or \ db_entry.size != current_statinfo.size): @@ -1402,13 +1400,12 @@ class Downloader(QueueMixin, WriteFileMixin): elif dmd_last_downloaded_uri is None: is_conflict = True self._log("conflict because no last_downloaded_uri") - elif last_uploaded_uri is None: - # is_conflict = True - self._log("no last_uploaded_uri; not a conflict") - elif dmd_last_downloaded_uri != last_uploaded_uri: + elif dmd_last_uploaded_uri is None: + is_conflict = True + self._log("conflict because no last_uploaded_uri") + elif dmd_last_downloaded_uri != dmd_last_uploaded_uri: is_conflict = True self._log("conflict because last_downloaded_uri != last_uploaded_uri") - self._log(" ({} != {})".format(dmd_last_downloaded_uri, last_uploaded_uri)) if item.relpath_u.endswith(u"/"): if item.metadata.get('deleted', False):