diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp index 60c6bb8..ec969c5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -55,12 +55,18 @@ QHash<QByteArray, QByteArray> loadIdentityMapFile(const QString &fileName) // Support git-svn author files, too // - svn2git native: loginname Joe User <user@example.com> // - git-svn: loginname = Joe User <user@example.com> - int rightspace = space; - if (line.indexOf(" = ") == space) - rightspace += 2; + int rightspace = line.indexOf(" = "); + int leftspace = space; + if (rightspace == -1) { + rightspace = space; + } else { + leftspace = rightspace; + rightspace += 2; + } QByteArray realname = line.mid(rightspace).trimmed(); - line.truncate(space); + line.truncate(leftspace); + result.insert(line, realname); }; file.close(); @@ -121,6 +127,7 @@ QSet<int> loadRevisionsFile( const QString &fileName, Svn &svn ) static const CommandLineOption options[] = { {"--identity-map FILENAME", "provide map between svn username and email"}, + {"--identity-domain DOMAIN", "provide user domain if no map was given"}, {"--revisions-file FILENAME", "provide a file with revision number that should be processed"}, {"--rules FILENAME[,FILENAME]", "the rules file(s) that determines what goes where"}, {"--add-metadata", "if passed, each git commit will have svn commit info"}, @@ -172,9 +179,9 @@ int main(int argc, char **argv) out << "svn-all-fast-export failed: please specify the rules using the 'rules' argument\n"; return 11; } - if (!args->contains("identity-map")) { + if (!args->contains("identity-map") && !args->contains("identity-domain")) { QTextStream out(stderr); - out << "WARNING; no identity-map specified, all commits will be without email address\n\n"; + out << "WARNING; no identity-map or -domain specified, all commits will use default @localhost email address\n\n"; } QCoreApplication app(argc, argv); @@ -240,6 +247,11 @@ int main(int argc, char **argv) svn.setMatchRules(rulesList.allMatchRules()); svn.setRepositories(repositories); svn.setIdentityMap(loadIdentityMapFile(args->optionArgument("identity-map"))); + // Massage user input a little, no guarantees that input makes sense. + QString domain = args->optionArgument("identity-domain").simplified().remove(QChar('@')); + if (domain.isEmpty()) + domain = QString("localhost"); + svn.setIdentityDomain(domain); if (max_rev < 1) max_rev = svn.youngestRevision(); |