From 6d3ad9b25957de52c1f74dfcfca813c271b122cc Mon Sep 17 00:00:00 2001 From: Raja R Harinath Date: Fri, 9 Jul 2010 20:01:36 +0530 Subject: 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. --- src/main.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/main.cpp') 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 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()); -- cgit v1.2.1