Remove the GitProjectImporter
Since projects are listed by recursively walking the filesystem, we don't need to import them into the database. Change-Id: I86613ac34a9c0ac68ba82b70b2c0312f877a8e69 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -31,7 +31,6 @@ import com.google.gerrit.pgm.util.SiteProgram;
|
||||
import com.google.gerrit.reviewdb.ReviewDb;
|
||||
import com.google.gerrit.server.config.SitePath;
|
||||
import com.google.gerrit.server.config.SitePaths;
|
||||
import com.google.gerrit.server.git.GitProjectImporter;
|
||||
import com.google.gerrit.server.git.GitRepositoryManager;
|
||||
import com.google.gerrit.server.git.LocalDiskRepositoryManager;
|
||||
import com.google.gerrit.server.schema.SchemaUpdater;
|
||||
@@ -62,9 +61,6 @@ public class Init extends SiteProgram {
|
||||
@Option(name = "--batch", usage = "Batch mode; skip interactive prompting")
|
||||
private boolean batchMode;
|
||||
|
||||
@Option(name = "--import-projects", usage = "Import git repositories as projects")
|
||||
private boolean importProjects;
|
||||
|
||||
@Option(name = "--no-auto-start", usage = "Don't automatically start daemon after init")
|
||||
private boolean noAutoStart;
|
||||
|
||||
@@ -73,7 +69,6 @@ public class Init extends SiteProgram {
|
||||
ErrorLogFile.errorOnlyConsole();
|
||||
|
||||
final SiteInit init = createSiteInit();
|
||||
init.flags.importProjects = importProjects;
|
||||
init.flags.autoStart = !noAutoStart && init.site.isNew;
|
||||
|
||||
final SiteRun run;
|
||||
@@ -83,7 +78,6 @@ public class Init extends SiteProgram {
|
||||
|
||||
run = createSiteRun(init);
|
||||
run.upgradeSchema();
|
||||
run.importGit();
|
||||
} catch (Exception failure) {
|
||||
if (init.flags.deleteOnFailure) {
|
||||
recursiveDelete(getSitePath());
|
||||
@@ -166,7 +160,6 @@ public class Init extends SiteProgram {
|
||||
final SchemaUpdater schemaUpdater;
|
||||
final SchemaFactory<ReviewDb> schema;
|
||||
final GitRepositoryManager repositoryManager;
|
||||
final GitProjectImporter gitProjectImporter;
|
||||
final Browser browser;
|
||||
|
||||
@Inject
|
||||
@@ -174,14 +167,13 @@ public class Init extends SiteProgram {
|
||||
final SchemaUpdater schemaUpdater,
|
||||
final SchemaFactory<ReviewDb> schema,
|
||||
final GitRepositoryManager repositoryManager,
|
||||
final GitProjectImporter gitProjectImporter, final Browser browser) {
|
||||
final Browser browser) {
|
||||
this.ui = ui;
|
||||
this.site = site;
|
||||
this.flags = flags;
|
||||
this.schemaUpdater = schemaUpdater;
|
||||
this.schema = schema;
|
||||
this.repositoryManager = repositoryManager;
|
||||
this.gitProjectImporter = gitProjectImporter;
|
||||
this.browser = browser;
|
||||
}
|
||||
|
||||
@@ -241,23 +233,6 @@ public class Init extends SiteProgram {
|
||||
}
|
||||
}
|
||||
|
||||
void importGit() throws OrmException, IOException {
|
||||
if (flags.importProjects) {
|
||||
gitProjectImporter.run(new GitProjectImporter.Messages() {
|
||||
@Override
|
||||
public void info(String msg) {
|
||||
System.err.println(msg);
|
||||
System.err.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warning(String msg) {
|
||||
info(msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void start() throws Exception {
|
||||
if (flags.autoStart) {
|
||||
if (HostPlatform.isWin32()) {
|
||||
@@ -319,7 +294,6 @@ public class Init extends SiteProgram {
|
||||
bind(InitFlags.class).toInstance(init.flags);
|
||||
|
||||
bind(GitRepositoryManager.class).to(LocalDiskRepositoryManager.class);
|
||||
bind(GitProjectImporter.class);
|
||||
}
|
||||
});
|
||||
return createDbInjector(SINGLE_USER).createChildInjector(modules);
|
||||
|
@@ -30,9 +30,6 @@ public class InitFlags {
|
||||
/** Recursively delete the site path if initialization fails. */
|
||||
public boolean deleteOnFailure;
|
||||
|
||||
/** Run the Git project importer after initialization. */
|
||||
public boolean importProjects;
|
||||
|
||||
/** Run the daemon (and open the web UI in a browser) after initialization. */
|
||||
public boolean autoStart;
|
||||
|
||||
|
@@ -25,14 +25,11 @@ import java.io.File;
|
||||
/** Initialize the GitRepositoryManager configuration section. */
|
||||
@Singleton
|
||||
class InitGitManager implements InitStep {
|
||||
private final InitFlags flags;
|
||||
private final ConsoleUI ui;
|
||||
private final Section gerrit;
|
||||
|
||||
@Inject
|
||||
InitGitManager(final InitFlags flags, final ConsoleUI ui,
|
||||
final Section.Factory sections) {
|
||||
this.flags = flags;
|
||||
InitGitManager(final ConsoleUI ui, final Section.Factory sections) {
|
||||
this.ui = ui;
|
||||
this.gerrit = sections.get("gerrit");
|
||||
}
|
||||
@@ -44,11 +41,7 @@ class InitGitManager implements InitStep {
|
||||
if (d == null) {
|
||||
throw die("gerrit.basePath is required");
|
||||
}
|
||||
if (d.exists()) {
|
||||
if (!flags.importProjects && d.list() != null && d.list().length > 0) {
|
||||
flags.importProjects = ui.yesno(true, "Import existing repositories");
|
||||
}
|
||||
} else if (!d.mkdirs()) {
|
||||
if (!d.exists() && !d.mkdirs()) {
|
||||
throw die("Cannot create " + d);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user