diff options
author | Thiago Macieira <thiago.macieira@trolltech.com> | 2007-12-28 13:42:43 +0100 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@trolltech.com> | 2007-12-28 13:47:01 +0100 |
commit | bb416d33bd42c89e0ca3e7563ff57fe6d77a1bc2 (patch) | |
tree | 5511b47610c11549ec373cbb5b9ab494f8d5be6f /src/main.cpp | |
parent | 50cd32a4e9d105a086977bd071fda0a3401bc27d (diff) | |
download | svn2git-bb416d33bd42c89e0ca3e7563ff57fe6d77a1bc2.tar svn2git-bb416d33bd42c89e0ca3e7563ff57fe6d77a1bc2.tar.gz svn2git-bb416d33bd42c89e0ca3e7563ff57fe6d77a1bc2.tar.bz2 svn2git-bb416d33bd42c89e0ca3e7563ff57fe6d77a1bc2.tar.xz svn2git-bb416d33bd42c89e0ca3e7563ff57fe6d77a1bc2.zip |
Implement the identity map
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index bf7af76..9ad5477 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,6 +16,7 @@ */ #include <QCoreApplication> +#include <QFile> #include <QStringList> #include <stdio.h> @@ -25,6 +26,30 @@ #include "repository.h" #include "svn.h" +QHash<QByteArray, QByteArray> loadIdentityMapFile(const QString &fileName) +{ + QHash<QByteArray, QByteArray> result; + if (fileName.isEmpty()) + return result; + + QFile file(fileName); + if (!file.open(QIODevice::ReadOnly)) + return result; + + while (!file.atEnd()) { + QByteArray line = file.readLine().trimmed(); + int space = line.indexOf(' '); + if (space == -1) + continue; // invalid line + + QByteArray realname = line.mid(space).trimmed(); + line.truncate(space); + result.insert(line, realname); + }; + + return result; +} + int main(int argc, char **argv) { QCoreApplication app(argc, argv); @@ -54,6 +79,7 @@ int main(int argc, char **argv) Svn svn(options.pathToRepository); svn.setMatchRules(rules.matchRules()); svn.setRepositories(repositories); + svn.setIdentityMap(loadIdentityMapFile(options.options.value("identity-map"))); if (max_rev < 1) max_rev = svn.youngestRevision(); |