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

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


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

Modified Files:
	merger.py 
Log Message:
The code that invokes diff3 can't actually use commands.getoutput(),
because that truncates the final newline if the is one.  Switch to
using os.popen().  Add tests that demonstrate this; in general add
tests that explicitly verify the exact contents of the local file
after the merge.


=== Zope3/src/zope/fssync/merger.py 1.4 => 1.5 ===
--- Zope3/src/zope/fssync/merger.py:1.4	Wed May 14 11:20:14 2003
+++ Zope3/src/zope/fssync/merger.py	Wed May 14 15:00:16 2003
@@ -155,7 +155,9 @@
         cmd = "diff3 -m -E %s %s %s" % (commands.mkarg(local),
                                         commands.mkarg(origfile),
                                         commands.mkarg(remote))
-        sts, output = commands.getstatusoutput(cmd)
+        pipe = os.popen(cmd, "r")
+        output = pipe.read()
+        sts = pipe.close()
         f = open(local, "wb")
         try:
             f.write(output)