Skip to content

Commit 6ca6bc6

Browse files
Vampiretnyblom
authored andcommitted
Add an option to create a fast-import dump file instead of actually creating the repository (#9)
1 parent 6a83f29 commit 6ca6bc6

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ static const CommandLineOption options[] = {
135135
{"--resume-from revision", "start importing at svn revision number"},
136136
{"--max-rev revision", "stop importing at svn revision number"},
137137
{"--dry-run", "don't actually write anything"},
138+
{"--create-dump", "don't create the repository but a dump file suitable for piping into fast-import"},
138139
{"--debug-rules", "print what rule is being used for each file"},
139140
{"--commit-interval NUMBER", "if passed the cache will be flushed to git every NUMBER of commits"},
140141
{"--stats", "after a run print some statistics about the rules"},

src/repository.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ FastImportRepository::FastImportRepository(const Rules::Repository &rule)
266266
branches["master"].created = 1;
267267

268268
fastImport.setWorkingDirectory(name);
269-
if (!CommandLineParser::instance()->contains("dry-run")) {
269+
if (!CommandLineParser::instance()->contains("dry-run") && !CommandLineParser::instance()->contains("create-dump")) {
270270
if (!QDir(name).exists()) { // repo doesn't exist yet.
271271
qDebug() << "Creating new repository" << name;
272272
QDir::current().mkpath(name);
@@ -295,7 +295,10 @@ FastImportRepository::FastImportRepository(const Rules::Repository &rule)
295295
static QString logFileName(QString name)
296296
{
297297
name.replace('/', '_');
298-
name.prepend("log-");
298+
if (CommandLineParser::instance()->contains("create-dump"))
299+
name.append(".fi");
300+
else
301+
name.prepend("log-");
299302
return name;
300303
}
301304

@@ -734,7 +737,7 @@ void FastImportRepository::startFastImport()
734737
fastImport.setStandardOutputFile(logFileName(name), QIODevice::Append);
735738
fastImport.setProcessChannelMode(QProcess::MergedChannels);
736739

737-
if (!CommandLineParser::instance()->contains("dry-run")) {
740+
if (!CommandLineParser::instance()->contains("dry-run") && !CommandLineParser::instance()->contains("create-dump")) {
738741
fastImport.start("git", QStringList() << "fast-import" << marksOptions);
739742
} else {
740743
fastImport.start("/bin/cat", QStringList());

0 commit comments

Comments
 (0)