aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@trolltech.com>2007-12-28 13:04:03 +0100
committerThiago Macieira <thiago.macieira@trolltech.com>2007-12-28 13:47:01 +0100
commit25f3205a1a6f7a1ce1ff0a3c9b4dcaeb8ca9dd37 (patch)
tree0d484fdd17f9c9aa606534598288b94b1497146c
parent298d7968c1bd6381bd80a41c6bfea37d42c73a6a (diff)
downloadsvn2git-25f3205a1a6f7a1ce1ff0a3c9b4dcaeb8ca9dd37.tar
svn2git-25f3205a1a6f7a1ce1ff0a3c9b4dcaeb8ca9dd37.tar.gz
svn2git-25f3205a1a6f7a1ce1ff0a3c9b4dcaeb8ca9dd37.tar.bz2
svn2git-25f3205a1a6f7a1ce1ff0a3c9b4dcaeb8ca9dd37.tar.xz
svn2git-25f3205a1a6f7a1ce1ff0a3c9b4dcaeb8ca9dd37.zip
Fail if writing to the process fails
-rw-r--r--src/repository.cpp7
-rw-r--r--src/repository.h1
-rw-r--r--src/svn.cpp13
3 files changed, 15 insertions, 6 deletions
diff --git a/src/repository.cpp b/src/repository.cpp
index 63252b5..18d145a 100644
--- a/src/repository.cpp
+++ b/src/repository.cpp
@@ -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()));
}
diff --git a/src/repository.h b/src/repository.h
index f971345..4692080 100644
--- a/src/repository.h
+++ b/src/repository.h
@@ -77,6 +77,7 @@ private:
QString name;
QProcess fastImport;
int commitCount;
+ bool processHasStarted;
void startFastImport();
diff --git a/src/svn.cpp b/src/svn.cpp
index a32005a..e6dc519 100644
--- a/src/svn.cpp
+++ b/src/svn.cpp
@@ -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,