From 688d69ec473b06fb767cf29b62d66e9642c19a91 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 23 Dec 2007 19:31:35 -0200 Subject: [PATCH] Introduce the dry-run mode --- src/repository.cpp | 9 ++++++++- src/svn.cpp | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/repository.cpp b/src/repository.cpp index 966b73d..bd229f0 100644 --- a/src/repository.cpp +++ b/src/repository.cpp @@ -54,9 +54,14 @@ Repository::Transaction *Repository::newTransaction(const QString &branch, const txn->revnum = revnum; txn->lastmark = revnum; - if (fastImport.state() == QProcess::NotRunning) + if (fastImport.state() == QProcess::NotRunning) { // start the process +#ifndef DRY_RUN fastImport.start("git-fast-import", QStringList()); +#else + fastImport.start("/bin/cat", QStringList()); +#endif + } return txn; } @@ -91,12 +96,14 @@ QIODevice *Repository::Transaction::addFile(const QString &path, int mode, qint6 fp.mode = mode; fp.mark = ++lastmark; +#ifndef DRY_RUN repository->fastImport.write("blob\nmark :"); repository->fastImport.write(QByteArray::number(fp.mark)); repository->fastImport.write("\ndata "); repository->fastImport.write(QByteArray::number(length)); repository->fastImport.write("\n", 1); repository->fastImport.waitForBytesWritten(0); +#endif modifiedFiles.insert(path, fp); return &repository->fastImport; diff --git a/src/svn.cpp b/src/svn.cpp index 760e736..aeca0fc 100644 --- a/src/svn.cpp +++ b/src/svn.cpp @@ -197,13 +197,14 @@ static int dumpBlob(Repository::Transaction *txn, svn_fs_root_t *fs_root, // what type is it? int mode = pathMode(fs_root, pathname, pool); - svn_stream_t *in_stream, *out_stream; svn_filesize_t stream_length; SVN_ERR(svn_fs_file_length(&stream_length, fs_root, pathname, pool)); QIODevice *io = txn->addFile(pathname, mode, stream_length); +#ifndef DRY_RUN // open the file + svn_stream_t *in_stream, *out_stream; SVN_ERR(svn_fs_file_contents(&in_stream, fs_root, pathname, pool)); // open a generic svn_stream_t for the QIODevice @@ -212,6 +213,7 @@ static int dumpBlob(Repository::Transaction *txn, svn_fs_root_t *fs_root, // print an ending newline io->putChar('\n'); +#endif return EXIT_SUCCESS; } -- 2.45.1