aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTorgny Nyblom <kde@nyblom.org>2010-11-26 12:40:15 +0100
committerTorgny Nyblom <kde@nyblom.org>2010-11-26 12:40:15 +0100
commit3f2534affaa7b0ac65c07610ac39c51d61b779bb (patch)
tree18db7705943052d97da64ce86098d7e7b3ebf8bc /src
parent90805b608e32984d1b0df7c5b8e0ca2edc65bc95 (diff)
downloadsvn2git-3f2534affaa7b0ac65c07610ac39c51d61b779bb.tar
svn2git-3f2534affaa7b0ac65c07610ac39c51d61b779bb.tar.gz
svn2git-3f2534affaa7b0ac65c07610ac39c51d61b779bb.tar.bz2
svn2git-3f2534affaa7b0ac65c07610ac39c51d61b779bb.tar.xz
svn2git-3f2534affaa7b0ac65c07610ac39c51d61b779bb.zip
Add an option to parse a list (in a file) of revisions that should be
used.
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 7de7e45..42b40aa 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -63,12 +63,42 @@ QHash<QByteArray, QByteArray> loadIdentityMapFile(const QString &fileName)
line.truncate(space);
result.insert(line, realname);
};
+ file.close();
return result;
}
+QList<int> loadRevisionsFile( const QString &fileName )
+{
+ QList<int> revisions;
+ if(fileName.isEmpty())
+ return revisions;
+
+ QFile file(fileName);
+ if( !file.open(QIODevice::ReadOnly)) {
+ fprintf(stderr, "Could not open file %s: %s", qPrintable(fileName), qPrintable(file.errorString()));
+ return revisions;
+ }
+
+ while(!file.atEnd()) {
+ QByteArray line = file.readLine();
+ bool ok;
+ line = line.trimmed();
+ int rev = line.toInt(&ok);
+ if(!ok) {
+ fprintf(stderr, "Unable to convert %s to int, skipping revision.", qPrintable(QString(line)));
+ } else {
+ revisions.append(rev);
+ }
+ }
+ file.close();
+ qSort(revisions.begin(), revisions.end());
+ return revisions;
+}
+
static const CommandLineOption options[] = {
{"--identity-map FILENAME", "provide map between svn username and email"},
+ {"--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"},
{"--resume-from revision", "start importing at svn revision number"},
@@ -180,7 +210,17 @@ int main(int argc, char **argv)
max_rev = svn.youngestRevision();
bool errors = false;
+ QList<int> revisions = loadRevisionsFile(args->optionArgument(QLatin1String("revisions-file")));
+ const bool filerRevisions = !revisions.isEmpty();
for (int i = min_rev; i <= max_rev; ++i) {
+ if(filerRevisions) {
+ if( !revisions.contains(i) ) {
+ printf(".");
+ continue;
+ } else {
+ printf("\n");
+ }
+ }
if (!svn.exportRevision(i)) {
errors = true;
break;