Index: /mergebot/trunk/mergebot/svn.py
===================================================================
--- /mergebot/trunk/mergebot/svn.py	(revision 54)
+++ /mergebot/trunk/mergebot/svn.py	(revision 55)
@@ -131,11 +131,17 @@
         skipped_regex = re.compile("Skipped.* '(.*)'", re.M)
         start_rev, end_rev = revision_range
-        pipe = os.popen("cd %s && svn merge --revision %s:%s %s . 2>>%s" % \
-            (workingdir, start_rev, end_rev, from_url, logfile))
-        output = pipe.readlines()
+        pipe = subprocess.Popen(['svn', 'merge', '--non-interactive', '--revision', '%s:%s' % (start_rev, end_rev), from_url, '.'],
+            cwd = workingdir,
+            stdout = subprocess.PIPE,
+            stderr = open(logfile, 'a')
+        )
+        output, _stderr = pipe.communicate()
         # FIXME: check pipe.close for errors
+        # errorcode = pipe.wait()
         results = []
-        for line in output:
-            if line.startswith("Skipped"):
+        for line in output.split('\n'):
+            if line == '':
+                continue # ignore blank lines
+            elif line.startswith("Skipped"):
                 # This kind of conflict requires special handling.
                 filename = skipped_regex.findall(line)[0]
@@ -143,8 +149,13 @@
             elif line.startswith("--- Merging r"):
                 continue # ignore the line
+            elif line == 'Summary of conflicts:':
+                continue # ignore the line
+            elif line.startswith('  Text conflicts:'):
+                continue # ignore the line
+            # TODO: Tree conflicts
             else:
-                assert line[4] == ' ', "Unexpected output from svn merge " \
-                    "operation; the 5th character should always be a space." \
-                    "  Output was %r." % line
+                assert len(line) > 4 and line[4] == ' ', "Unexpected output " \
+                    "from svn merge operation; the 5th character should " \
+                    "always be a space.  Invalid output line was %r.\nFull output was: %r." % (line, output)
                 filename = line[5:-1] # (strip trailing newline)
                 status = line[:4].rstrip()
