[Zope3-checkins] CVS: Zope3/src/zope/fssync - fssync.py:1.27

Guido van Rossum guido@python.org
Tue, 27 May 2003 16:36:48 -0400


Update of /cvs-repository/Zope3/src/zope/fssync
In directory cvs.zope.org:/tmp/cvs-serv9016

Modified Files:
	fssync.py 
Log Message:
When adding a directory, add a @@Zope/Entries.xml file to it, even
though it's empty and normally wouldn't be written.  This is to make
sure that the new directory will be pushed to the server on a commit
(since the snarf protocol doesn't do files).

Also report added files with "A" and removed files with "R" in the
add and remove commands.


=== Zope3/src/zope/fssync/fssync.py 1.26 => 1.27 ===
--- Zope3/src/zope/fssync/fssync.py:1.26	Tue May 27 09:50:56 2003
+++ Zope3/src/zope/fssync/fssync.py	Tue May 27 16:36:48 2003
@@ -37,6 +37,8 @@
 from os.path import dirname, basename, split, join
 from os.path import realpath, normcase, normpath
 
+from zope.xmlpickle import dumps
+
 from zope.fssync.metadata import Metadata
 from zope.fssync.fsmerger import FSMerger
 from zope.fssync.fsutil import Error
@@ -406,6 +408,17 @@
         if isdir(path):
             entry["type"] = entry["factory"] = "zope.app.content.folder.Folder"
         self.metadata.flush()
+        if isdir(path):
+            # Force Entries.xml to exist, even if it wouldn't normally
+            zopedir = join(path, "@@Zope")
+            efile = join(zopedir, "Entries.xml")
+            if not exists(efile):
+                if not exists(zopedir):
+                    os.makedirs(zopedir)
+                    self.network.writefile(dumps({}), efile)
+            print "A", join(path, "")
+        else:
+            print "A", path
 
     def remove(self, path):
         if exists(path):
@@ -421,6 +434,7 @@
         else:
             entry["flag"] = "removed"
         self.metadata.flush()
+        print "R", path
 
     def status(self, target, descend_only=False):
         entry = self.metadata.getentry(target)