aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp6
-rw-r--r--src/repository.cpp20
-rw-r--r--src/ruleparser.cpp2
-rw-r--r--src/src.pro2
-rw-r--r--src/svn.cpp7
5 files changed, 28 insertions, 9 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 3feb3cf..f2b189e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -43,7 +43,11 @@ QHash<QByteArray, QByteArray> loadIdentityMapFile(const QString &fileName)
}
while (!file.atEnd()) {
- QByteArray line = file.readLine().trimmed();
+ QByteArray line = file.readLine();
+ int comment_pos = line.indexOf('#');
+ if (comment_pos != -1)
+ line.truncate(comment_pos);
+ line = line.trimmed();
int space = line.indexOf(' ');
if (space == -1)
continue; // invalid line
diff --git a/src/repository.cpp b/src/repository.cpp
index 760fc1a..5bcd8dd 100644
--- a/src/repository.cpp
+++ b/src/repository.cpp
@@ -214,6 +214,13 @@ Repository *makeRepository(const Rules::Repository &rule, const QHash<QString, R
return new PrefixingRepository(r, rule.prefix);
}
+static QString marksFileName(QString name)
+{
+ name.replace('/', '_');
+ name.prepend("marks-");
+ return name;
+}
+
FastImportRepository::FastImportRepository(const Rules::Repository &rule)
: name(rule.name), commitCount(0), outstandingTransactions(0), last_commit_mark(0), next_file_mark(maxMark), processHasStarted(false)
{
@@ -236,9 +243,8 @@ FastImportRepository::FastImportRepository(const Rules::Repository &rule)
init.setWorkingDirectory(name);
init.start("git", QStringList() << "--bare" << "init");
init.waitForFinished(-1);
- QDir::current().mkpath(name + "/info/fast-import");
{
- QFile marks(name + "/info/fast-import/marks");
+ QFile marks(name + "/" + marksFileName(name));
marks.open(QIODevice::WriteOnly);
marks.close();
}
@@ -255,7 +261,7 @@ static QString logFileName(QString name)
static int lastValidMark(QString name)
{
- QFile marksfile(name + "/info/fast-import/marks");
+ QFile marksfile(name + "/" + marksFileName(name));
if (!marksfile.open(QIODevice::ReadOnly))
return 0;
@@ -628,11 +634,17 @@ void FastImportRepository::startFastImport()
processHasStarted = true;
// start the process
+ QString marksFile = marksFileName(name);
+ QStringList marksOptions;
+ marksOptions << "--import-marks=" + marksFile;
+ marksOptions << "--export-marks=" + marksFile;
+ marksOptions << "--force";
+
fastImport.setStandardOutputFile(logFileName(name), QIODevice::Append);
fastImport.setProcessChannelMode(QProcess::MergedChannels);
if (!CommandLineParser::instance()->contains("dry-run")) {
- fastImport.start("git", QStringList() << "fast-import" << "--relative-marks" << "--import-marks=marks" << "--export-marks=marks" << "--force");
+ fastImport.start("git", QStringList() << "fast-import" << marksOptions);
} else {
fastImport.start("/bin/cat", QStringList());
}
diff --git a/src/ruleparser.cpp b/src/ruleparser.cpp
index d1f5cd4..d6e634e 100644
--- a/src/ruleparser.cpp
+++ b/src/ruleparser.cpp
@@ -44,7 +44,7 @@ void Rules::load()
{
QFile file(filename);
if (!file.open(QIODevice::ReadOnly))
- return;
+ qFatal("Could not read the rules file: %s", qPrintable(filename));
// initialize the regexps we will use
QRegExp repoLine("create repository\\s+(\\S+)", Qt::CaseInsensitive);
diff --git a/src/src.pro b/src/src.pro
index a402ca1..ad57cdd 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -13,7 +13,7 @@ QT = core
INCLUDEPATH += . $$SVN_INCLUDE $$APR_INCLUDE
!isEmpty($$SVN_LIBDIR): LIBS += -L$$SVN_LIBDIR
-LIBS += -lsvn_fs-1 -lsvn_repos-1
+LIBS += -lsvn_fs-1 -lsvn_repos-1 -lapr-1 -lsvn_subr-1
# Input
SOURCES += ruleparser.cpp \
diff --git a/src/svn.cpp b/src/svn.cpp
index 317bd3c..594a750 100644
--- a/src/svn.cpp
+++ b/src/svn.cpp
@@ -141,7 +141,10 @@ bool Svn::exportRevision(int revnum)
SvnPrivate::SvnPrivate(const QString &pathToRepository)
: global_pool(NULL)
{
- openRepository(pathToRepository);
+ if( openRepository(pathToRepository) != EXIT_SUCCESS) {
+ qCritical() << "Failed to open repository";
+ exit(1);
+ }
// get the youngest revision
svn_fs_youngest_rev(&youngest_rev, fs, global_pool);
@@ -322,7 +325,7 @@ static int recursiveDumpDir(Repository::Transaction *txn, svn_fs_root_t *fs_root
svn_fs_dirent_t *dirent = reinterpret_cast<svn_fs_dirent_t *>(value);
QByteArray entryName = pathname + '/' + dirent->name;
- QString entryFinalName = finalPathName + dirent->name;
+ QString entryFinalName = finalPathName + QString::fromUtf8(dirent->name);
if (dirent->kind == svn_node_dir) {
entryFinalName += '/';