aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp10
-rw-r--r--src/svn.cpp12
-rw-r--r--src/svn.h1
3 files changed, 19 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 60c6bb8..09a4225 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -121,6 +121,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 +173,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 +241,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();
diff --git a/src/svn.cpp b/src/svn.cpp
index c103728..92c8abf 100644
--- a/src/svn.cpp
+++ b/src/svn.cpp
@@ -79,6 +79,7 @@ public:
QList<MatchRuleList> allMatchRules;
RepositoryHash repositories;
IdentityHash identities;
+ QString userdomain;
SvnPrivate(const QString &pathToRepository);
~SvnPrivate();
@@ -130,6 +131,11 @@ void Svn::setIdentityMap(const IdentityHash &identityMap)
d->identities = identityMap;
}
+void Svn::setIdentityDomain(const QString &identityDomain)
+{
+ d->userdomain = identityDomain;
+}
+
int Svn::youngestRevision()
{
return d->youngestRevision();
@@ -388,6 +394,7 @@ public:
QList<MatchRuleList> allMatchRules;
RepositoryHash repositories;
IdentityHash identities;
+ QString userdomain;
svn_fs_t *fs;
svn_fs_root_t *fs_root;
@@ -436,6 +443,7 @@ int SvnPrivate::exportRevision(int revnum)
rev.allMatchRules = allMatchRules;
rev.repositories = repositories;
rev.identities = identities;
+ rev.userdomain = userdomain;
// open this revision:
printf("Exporting revision %d ", revnum);
@@ -506,8 +514,8 @@ int SvnRevision::fetchRevProps()
if (!svnauthor || svn_string_isempty(svnauthor))
authorident = "nobody <nobody@localhost>";
else
- authorident = svnauthor->data + QByteArray(" <") +
- svnauthor->data + QByteArray("@localhost>");
+ authorident = svnauthor->data + QByteArray(" <") + svnauthor->data +
+ QByteArray("@") + userdomain.toUtf8() + QByteArray(">");
}
propsFetched = true;
return EXIT_SUCCESS;
diff --git a/src/svn.h b/src/svn.h
index 5fb3245..b0ada88 100644
--- a/src/svn.h
+++ b/src/svn.h
@@ -36,6 +36,7 @@ public:
void setMatchRules(const QList<QList<Rules::Match> > &matchRules);
void setRepositories(const QHash<QString, Repository *> &repositories);
void setIdentityMap(const QHash<QByteArray, QByteArray> &identityMap);
+ void setIdentityDomain(const QString &identityDomain);
int youngestRevision();
bool exportRevision(int revnum);