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

Guido van Rossum guido@python.org
Tue, 13 May 2003 10:10:36 -0400


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

Modified Files:
	merger.py 
Log Message:
Use diff3 -m -E instead of merge.
GNU diff3 seems more common; merge is only part of RCS.

=== Zope3/src/zope/fssync/merger.py 1.1 => 1.2 ===
--- Zope3/src/zope/fssync/merger.py:1.1	Mon May 12 16:19:38 2003
+++ Zope3/src/zope/fssync/merger.py	Tue May 13 10:10:05 2003
@@ -94,7 +94,7 @@
     more work than reasonable).
     """
 
-    def __init__(self, metadata, verbose=True):
+    def __init__(self, metadata):
         """Constructor.
 
         The argument is the metadata database, which has a single
@@ -105,7 +105,6 @@
         clear() method.
         """
         self.metadata = metadata
-        self.verbose = verbose
 
     def getentry(self, file):
         """Helper to abstract away the existence of self.metadata."""
@@ -149,12 +148,15 @@
             origfile = orig
         else:
             origfile = "/dev/null"
-        cmd = "merge %s %s %s" % (commands.mkarg(local),
-                                  commands.mkarg(origfile),
-                                  commands.mkarg(remote))
+        cmd = "diff3 -m -E %s %s %s" % (commands.mkarg(local),
+                                        commands.mkarg(origfile),
+                                        commands.mkarg(remote))
         sts, output = commands.getstatusoutput(cmd)
-        if output and self.verbose:
-            print output
+        f = open(local, "wb")
+        try:
+            f.write(output)
+        finally:
+            f.close()
         shutil.copy(remote, orig)
         self.getentry(local).update(self.getentry(remote))
         self.clearflag(local)