[Zope3-checkins] CVS: Zope3/src/zope/fssync - fsmerger.py:1.9
Guido van Rossum
guido@python.org
Wed, 4 Jun 2003 07:11:29 -0400
Update of /cvs-repository/Zope3/src/zope/fssync
In directory cvs.zope.org:/tmp/cvs-serv14562
Modified Files:
fsmerger.py
Log Message:
Add code to remove the Extra and Annotations directories.
=== Zope3/src/zope/fssync/fsmerger.py 1.8 => 1.9 ===
--- Zope3/src/zope/fssync/fsmerger.py:1.8 Tue Jun 3 16:01:37 2003
+++ Zope3/src/zope/fssync/fsmerger.py Wed Jun 4 07:11:29 2003
@@ -58,14 +58,30 @@
self.merge_annotations(local, remote)
def merge_extra(self, local, remote):
+ """Helper to merge the Extra trees."""
lextra = fsutil.getextra(local)
rextra = fsutil.getextra(remote)
self.merge_dirs(lextra, rextra)
+ if not exists(local):
+ self.remove_special(local, "Extra")
def merge_annotations(self, local, remote):
+ """Helper to merge the Anotations trees."""
lannotations = fsutil.getannotations(local)
rannotations = fsutil.getannotations(remote)
self.merge_dirs(lannotations, rannotations)
+ if not exists(local):
+ self.remove_special(local, "Annotations")
+
+ def remove_special(self, local, what):
+ """Helper to remove an Extra or Annotations tree."""
+ lextra = fsutil.getextra(local)
+ if isdir(lextra):
+ shutil.rmtree(lextra)
+ try:
+ os.rmdir(join(local, "@@Zope", "Extra"))
+ except os.error:
+ pass
def merge_files(self, local, remote):
"""Merge remote file into local file."""