summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-06-01 08:41:26 -0700
committerShawn O. Pearce <sop@google.com>2009-06-01 08:44:25 -0700
commit92cf3af8e93658a5af47f2d8873e2871882d271c (patch)
tree676a4a9cbf5afd7131694c2ec80c8aff69d5ce9d
parent1d3cb444af669511802edcaea341c66ce8f89e91 (diff)
Delete now unnecessary ImportProjectSubmitTypes
This was created for Gerrit 2.0.9 to support moving per-project configuration out of the project's ~/.git/config into the db, where it was more easily edited by the web UI. Since the per-project configuration was previously a hidden and undocumented feature, its likely nobody else used it except for me on review.source.android.com, and anyone who has used it has already upgraded past 2.0.9. So this is just dead code now. Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r--src/main/java/com/google/gerrit/pgm/ImportProjectSubmitTypes.java89
1 files changed, 0 insertions, 89 deletions
diff --git a/src/main/java/com/google/gerrit/pgm/ImportProjectSubmitTypes.java b/src/main/java/com/google/gerrit/pgm/ImportProjectSubmitTypes.java
deleted file mode 100644
index 24371253ca..0000000000
--- a/src/main/java/com/google/gerrit/pgm/ImportProjectSubmitTypes.java
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (C) 2009 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.gerrit.pgm;
-
-import com.google.gerrit.client.reviewdb.Project;
-import com.google.gerrit.client.reviewdb.ReviewDb;
-import com.google.gerrit.client.rpc.Common;
-import com.google.gerrit.git.InvalidRepositoryException;
-import com.google.gerrit.git.WorkQueue;
-import com.google.gerrit.server.GerritServer;
-import com.google.gwtjsonrpc.server.XsrfException;
-import com.google.gwtorm.client.OrmException;
-
-import org.spearce.jgit.lib.ProgressMonitor;
-import org.spearce.jgit.lib.Repository;
-import org.spearce.jgit.lib.TextProgressMonitor;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-
-/** Update project's submit_type field from their git config files. */
-public class ImportProjectSubmitTypes {
- private static final String GERRIT = "gerrit";
- private static final String FFO = "fastforwardonly";
-
- public static void main(final String[] argv) throws OrmException,
- XsrfException {
- try {
- mainImpl(argv);
- } finally {
- WorkQueue.terminate();
- }
- }
-
- private static void mainImpl(final String[] argv) throws OrmException,
- XsrfException {
- final ProgressMonitor pm = new TextProgressMonitor();
- final GerritServer gs = GerritServer.getInstance();
- final ReviewDb db = Common.getSchemaFactory().open();
- try {
- final List<Project> all = db.projects().all().toList();
- pm.start(1);
- pm.beginTask("Update projects", all.size());
- for (final Project p : all) {
- if (p.getSubmitType() != null
- && p.getSubmitType() != Project.SubmitType.MERGE_IF_NECESSARY) {
- pm.update(1);
- continue;
- }
-
- final Repository r;
- try {
- r = gs.getRepositoryCache().get(p.getName());
- } catch (InvalidRepositoryException e) {
- pm.update(1);
- continue;
- }
-
- if ("true".equals(r.getConfig().getString(GERRIT, null, FFO))) {
- p.setSubmitType(Project.SubmitType.FAST_FORWARD_ONLY);
- db.projects().update(Collections.singleton(p));
- r.getConfig().unsetString(GERRIT, null, FFO);
- try {
- r.getConfig().save();
- } catch (IOException e) {
- // Ignore a save error
- }
- }
- pm.update(1);
- }
- pm.endTask();
- } finally {
- db.close();
- }
- }
-}