return self._upload_dirnode.add_file(name, u, overwrite=True)
def _add_dir(name):
+ print "MEOWMEOW!"
self._notifier.watch(to_filepath(path), mask=self.mask, callbacks=[self._notify], recursive=True)
u = Data("", self._convergence)
name += "@_"
"(this is normal for temporary objects)" % (path,))
self._stats_provider.count('magic_folder.objects_disappeared', 1)
- # XXX todo: check if file exists in magic folder db
- # ...
+ d2 = defer.Succeed(None)
if not self._db.check_file_db_exists(path):
- return None
+ pass
else:
- u = Data("", self._convergence)
- d2 = defer.Succeed(None)
def get_metadata(d):
- return self._parent.get_metadata_for(name)
+ self._parent.get_metadata_for(name)
d2.addCallback(get_metadata)
def set_deleted(metadata):
metadata['version'] += 1
metadata['deleted'] = True
- return self._parent.add_file(name, u, overwrite=True, metadata=metadata)
+ emptyUploadable = Data("", self._convergence)
+ self._parent.add_file(name, emptyUploadable, overwrite=True, metadata=metadata)
d2.addCallback(set_deleted)
- return d2
+ d2.addCallback(lambda x: Exception("file does not exist"))
+ return d2
elif os.path.islink(path):
raise Exception("symlink not being processed")
if os.path.isdir(path):
def _log(self, msg):
self._client.log("drop-upload: " + msg)
+ print "_log %s" % (msg,)
#open("events", "ab+").write(msg)
d.addCallback(self._create_magicfolder)
def _check_move_empty_tree(res):
+ print "MEOW 0"
self.mkdir_nonascii(empty_tree_dir)
d2 = defer.Deferred()
self.magicfolder.set_processed_callback(d2.callback, ignore_count=0)
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.files_uploaded'), 0))
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_queued'), 0))
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.directories_created'), 1))
-
+
def _check_move_small_tree(res):
+ print "MEOW 1"
self.mkdir_nonascii(small_tree_dir)
fileutil.write(abspath_expanduser_unicode(u"what", base=small_tree_dir), "say when")
d2 = defer.Deferred()
self.magicfolder.set_processed_callback(d2.callback, ignore_count=1)
os.rename(small_tree_dir, new_small_tree_dir)
self.notify(to_filepath(new_small_tree_dir), self.inotify.IN_MOVED_TO)
+ print "end of MEOW 1"
return d2
d.addCallback(_check_move_small_tree)
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_succeeded'), 3))
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.directories_created'), 2))
def _check_moved_tree_is_watched(res):
+ print "MEOW 2"
d2 = defer.Deferred()
self.magicfolder.set_processed_callback(d2.callback, ignore_count=0)
fileutil.write(abspath_expanduser_unicode(u"another", base=new_small_tree_dir), "file")