9ad54771d6a8fd4e1a6f9baf611edf3f40dd4198
2 * Copyright (C) 2007 Thiago Macieira <thiago@kde.org>
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include <QCoreApplication>
20 #include <QStringList>
25 #include "ruleparser.h"
26 #include "repository.h"
29 QHash
<QByteArray
, QByteArray
> loadIdentityMapFile(const QString
&fileName
)
31 QHash
<QByteArray
, QByteArray
> result
;
32 if (fileName
.isEmpty())
36 if (!file
.open(QIODevice::ReadOnly
))
39 while (!file
.atEnd()) {
40 QByteArray line
= file
.readLine().trimmed();
41 int space
= line
.indexOf(' ');
43 continue; // invalid line
45 QByteArray realname
= line
.mid(space
).trimmed();
47 result
.insert(line
, realname
);
53 int main(int argc
, char **argv
)
55 QCoreApplication
app(argc
, argv
);
58 options
.parseArguments(app
.arguments());
60 // Load the configuration
61 Rules
rules(options
.ruleFile
);
64 int min_rev
= options
.options
.value("resume-from").toInt();
65 int max_rev
= options
.options
.value("max-rev").toInt();
69 // create the repository list
70 QHash
<QString
, Repository
*> repositories
;
71 foreach (Rules::Repository rule
, rules
.repositories()) {
72 Repository
*repo
= new Repository(rule
);
74 repo
->reloadBranches();
75 repositories
.insert(rule
.name
, repo
);
79 Svn
svn(options
.pathToRepository
);
80 svn
.setMatchRules(rules
.matchRules());
81 svn
.setRepositories(repositories
);
82 svn
.setIdentityMap(loadIdentityMapFile(options
.options
.value("identity-map")));
85 max_rev
= svn
.youngestRevision();
86 for (int i
= min_rev
; i
<= max_rev
; ++i
)
87 if (!svn
.exportRevision(i
))
90 qDeleteAll(repositories
);