]> andersk Git - svn-all-fast-export.git/commitdiff
Fail if writing to the process fails
authorThiago Macieira <thiago.macieira@trolltech.com>
Fri, 28 Dec 2007 12:04:03 +0000 (13:04 +0100)
committerThiago Macieira <thiago.macieira@trolltech.com>
Fri, 28 Dec 2007 12:47:01 +0000 (13:47 +0100)
src/repository.cpp
src/repository.h
src/svn.cpp

index 63252b589fe576b7c38eb5f6d95852776e2582ca..18d145a6b0899f14f7f7044fb7c77da539a605de 100644 (file)
@@ -184,7 +184,6 @@ QIODevice *Repository::Transaction::addFile(const QString &path, int mode, qint6
     repository->fastImport.write("\ndata ");
     repository->fastImport.write(QByteArray::number(length));
     repository->fastImport.write("\n", 1);
-    repository->fastImport.waitForBytesWritten(0);
 #endif
 
     modifiedFiles.insert(path, fp);
@@ -243,7 +242,7 @@ void Repository::Transaction::commit()
 
     repository->fastImport.write("\n");
 
-    while (repository->fastImport.bytesToWrite() && repository->fastImport.waitForBytesWritten()) {
-        // nothing
-    }
+    while (repository->fastImport.bytesToWrite())
+        if (!repository->fastImport.waitForBytesWritten())
+            qFatal("Failed to write to process: %s", qPrintable(repository->fastImport.errorString()));
 }
index f971345787cfdf6f4d0901da78ad69132aa989e8..4692080a2f5c077b6c823165e2f25d5d75c046b1 100644 (file)
@@ -77,6 +77,7 @@ private:
     QString name;
     QProcess fastImport;
     int commitCount;
+    bool processHasStarted;
 
     void startFastImport();
 
index a32005a023e2cf1ce4f1e6e0de9ae877b66bc8ac..e6dc519bc19b09fa5e8576b541bc8cc00e21dfd6 100644 (file)
@@ -228,8 +228,14 @@ svn_error_t *QIODevice_write(void *baton, const char *data, apr_size_t *len)
     QIODevice *device = reinterpret_cast<QIODevice *>(baton);
     device->write(data, *len);
 
-    if (device->bytesToWrite() > 16384)
-        device->waitForBytesWritten(0);
+    while (device->bytesToWrite() > 16*1024) {
+        int timeout = device->bytesToWrite() >= 128*1024 ? -1 : 0;
+        if (!device->waitForBytesWritten(timeout)) {
+            qFatal("Failed to write to process: %s", qPrintable(device->errorString()));
+            return svn_error_createf(APR_EOF, SVN_NO_ERROR, "Failed to write to process: %s",
+                                     qPrintable(device->errorString()));
+        }
+    }
     return SVN_NO_ERROR;
 }
 
@@ -512,6 +518,9 @@ int SvnRevision::exportDispatch(const char *key, const svn_fs_path_change_t *cha
     case Rules::Match::Export:
         return exportInternal(key, change, path_from, rev_from, current, rule);
     }
+
+    // never reached
+    return EXIT_FAILURE;
 }
 
 int SvnRevision::exportInternal(const char *key, const svn_fs_path_change_t *change,
This page took 0.054353 seconds and 5 git commands to generate.