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

Guido van Rossum guido@python.org
Wed, 14 May 2003 15:20:20 -0400


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

Modified Files:
	merger.py 
Log Message:
When diff3 signals a conflict and its output is empty, don't erase the
local file.  This probably means that diff3 couldn't be found, or ran
into severe trouble.  The error message will have been written to
stderr, so stdout should be empty in this case.


=== Zope3/src/zope/fssync/merger.py 1.5 => 1.6 ===
--- Zope3/src/zope/fssync/merger.py:1.5	Wed May 14 15:00:16 2003
+++ Zope3/src/zope/fssync/merger.py	Wed May 14 15:20:20 2003
@@ -158,11 +158,12 @@
         pipe = os.popen(cmd, "r")
         output = pipe.read()
         sts = pipe.close()
-        f = open(local, "wb")
-        try:
-            f.write(output)
-        finally:
-            f.close()
+        if output or not sts:
+            f = open(local, "wb")
+            try:
+                f.write(output)
+            finally:
+                f.close()
         shutil.copy(remote, original)
         self.getentry(local).update(self.getentry(remote))
         self.clearflag(local)