aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorRaja R Harinath <harinath@hurrynot.org>2010-07-09 20:01:36 +0530
committerRaja R Harinath <harinath@hurrynot.org>2010-07-09 21:32:29 +0530
commit6d3ad9b25957de52c1f74dfcfca813c271b122cc (patch)
treee9b4babd3809199c8e305f1de1411f30282059c9 /src/main.cpp
parent4cbcd3021d803012d31356b5cb36982a9921b2df (diff)
downloadsvn2git-6d3ad9b25957de52c1f74dfcfca813c271b122cc.tar
svn2git-6d3ad9b25957de52c1f74dfcfca813c271b122cc.tar.gz
svn2git-6d3ad9b25957de52c1f74dfcfca813c271b122cc.tar.bz2
svn2git-6d3ad9b25957de52c1f74dfcfca813c271b122cc.tar.xz
svn2git-6d3ad9b25957de52c1f74dfcfca813c271b122cc.zip
Introduce incremental mode with --incremental flag
We use the progress logs that we carefully maintained to recreate the branch data structures, as described in earlier commits. A major change/improvement is that reloadBranches() now uses the marks file and internal data structures to prime the fast-import rather than using git-rev-parse. We also handle --resume-from properly, by truncating the log file to revisions that only precede the revision resumed from. Note that git fast-import allows marks to be reused without any extra processing.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index c328ef1..da39a5b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -70,6 +70,7 @@ static const CommandLineOption options[] = {
{"--dry-run", "don't actually write anything"},
{"--debug-rules", "print what rule is being used for each file"},
{"--commit-interval NUMBER", "if passed the cache will be flushed to git every NUMBER of commits"},
+ {"--incremental", "attempts to restart an import based on information in log-* and git-fast-import"},
{"-h, --help", "show help"},
{"-v, --version", "show version"},
CommandLineLastOption
@@ -111,18 +112,28 @@ int main(int argc, char **argv)
Rules rules(args->optionArgument(QLatin1String("rules")));
rules.load();
- int min_rev = args->optionArgument(QLatin1String("resume-from")).toInt();
+ int resume_from = args->optionArgument(QLatin1String("resume-from")).toInt();
int max_rev = args->optionArgument(QLatin1String("max-rev")).toInt();
- if (min_rev < 1)
- min_rev = 1;
// create the repository list
QHash<QString, Repository *> repositories;
+ bool incremental = args->contains("incremental");
+
+ int min_rev = resume_from;
foreach (Rules::Repository rule, rules.repositories()) {
Repository *repo = new Repository(rule);
repositories.insert(rule.name, repo);
+
+ if (incremental) {
+ int repo_next = repo->setupIncremental(resume_from);
+ if (min_rev < repo_next)
+ min_rev = repo_next;
+ }
}
+ if (min_rev < 1)
+ min_rev = 1;
+
Svn::initialize();
Svn svn(args->arguments().first());
svn.setMatchRules(rules.matchRules());