From: Daira Hopwood <daira@jacaranda.org>
Date: Wed, 23 Sep 2015 14:05:08 +0000 (+0100)
Subject: Ignore files with ignorable names.
X-Git-Url: https://git.rkrishnan.org/%5B/frontends//%22news.html/%22?a=commitdiff_plain;h=e1e79dd0e26a338a86c399d304d88d7b941c95e6;p=tahoe-lafs%2Ftahoe-lafs.git

Ignore files with ignorable names.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
---

diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py
index 10b56d8a..d48990c8 100644
--- a/src/allmydata/frontends/magic_folder.py
+++ b/src/allmydata/frontends/magic_folder.py
@@ -140,7 +140,7 @@ class QueueMixin(HookMixin):
 
     def _append_to_deque(self, relpath_u):
         print "_append_to_deque(%r)" % (relpath_u,)
-        if relpath_u in self._pending:
+        if relpath_u in self._pending or magicpath.should_ignore_file(relpath_u):
             return
         self._deque.append(relpath_u)
         self._pending.add(relpath_u)
@@ -250,6 +250,9 @@ class Uploader(QueueMixin):
             d.addCallback(lambda ign, child=child:
                           ("%s/%s" % (reldir_u, child) if reldir_u else child))
             def _add_pending(relpath_u):
+                if magicpath.should_ignore_file(relpath_u):
+                    return None
+
                 self._pending.add(relpath_u)
                 return relpath_u
             d.addCallback(_add_pending)
@@ -267,6 +270,8 @@ class Uploader(QueueMixin):
         return defer.succeed(None)
 
     def _process(self, relpath_u):
+        if relpath_u is None:
+            return
         precondition(isinstance(relpath_u, unicode), relpath_u)
 
         d = defer.succeed(None)
@@ -407,6 +412,8 @@ class Downloader(QueueMixin):
         We check the remote metadata version against our magic-folder db version number;
         latest version wins.
         """
+        if magicpath.should_ignore_file(relpath_u):
+            return False
         v = self._db.get_local_file_version(relpath_u)
         return (v is None or v < remote_version)