summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@google.com>2019-11-17 09:51:14 -0800
committerMatthias Sohn <matthias.sohn@sap.com>2020-12-15 02:00:35 +0100
commit7386f73bb0a5754f0b1dfc38aae37d68461a8cd8 (patch)
tree833db8a47b25a31836f1144bbe32750789072fed /org.eclipse.jgit.pgm
parent8548cb4e51894d5e10a06e82921dd1e1f9c6ea66 (diff)
downloadjgit-7386f73bb0a5754f0b1dfc38aae37d68461a8cd8.tar.gz
jgit-7386f73bb0a5754f0b1dfc38aae37d68461a8cd8.zip
Remove reftree and ketch
This was experimental code and never used in production. Change-Id: Ia3da7f2b82d9e365cec2ccf9397cbc47439cd150 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r--org.eclipse.jgit.pgm/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jgit.pgm/META-INF/services/org.eclipse.jgit.pgm.TextBuiltin1
-rw-r--r--org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties4
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java46
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java140
5 files changed, 3 insertions, 190 deletions
diff --git a/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF b/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF
index 6a20396d71..1dfb418010 100644
--- a/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF
@@ -22,12 +22,10 @@ Import-Package: javax.servlet;version="[3.1.0,4.0.0)",
org.eclipse.jgit.dircache;version="[5.11.0,5.12.0)",
org.eclipse.jgit.errors;version="[5.11.0,5.12.0)",
org.eclipse.jgit.gitrepo;version="[5.11.0,5.12.0)",
- org.eclipse.jgit.internal.ketch;version="[5.11.0,5.12.0)",
org.eclipse.jgit.internal.storage.file;version="[5.11.0,5.12.0)",
org.eclipse.jgit.internal.storage.io;version="[5.11.0,5.12.0)",
org.eclipse.jgit.internal.storage.pack;version="[5.11.0,5.12.0)",
org.eclipse.jgit.internal.storage.reftable;version="[5.11.0,5.12.0)",
- org.eclipse.jgit.internal.storage.reftree;version="[5.11.0,5.12.0)",
org.eclipse.jgit.lfs;version="[5.11.0,5.12.0)",
org.eclipse.jgit.lfs.server;version="[5.11.0,5.12.0)",
org.eclipse.jgit.lfs.server.fs;version="[5.11.0,5.12.0)",
diff --git a/org.eclipse.jgit.pgm/META-INF/services/org.eclipse.jgit.pgm.TextBuiltin b/org.eclipse.jgit.pgm/META-INF/services/org.eclipse.jgit.pgm.TextBuiltin
index 062b9643a3..e645255e96 100644
--- a/org.eclipse.jgit.pgm/META-INF/services/org.eclipse.jgit.pgm.TextBuiltin
+++ b/org.eclipse.jgit.pgm/META-INF/services/org.eclipse.jgit.pgm.TextBuiltin
@@ -47,7 +47,6 @@ org.eclipse.jgit.pgm.debug.MakeCacheTree
org.eclipse.jgit.pgm.debug.ReadDirCache
org.eclipse.jgit.pgm.debug.ReadReftable
org.eclipse.jgit.pgm.debug.RebuildCommitGraph
-org.eclipse.jgit.pgm.debug.RebuildRefTree
org.eclipse.jgit.pgm.debug.ShowCacheTree
org.eclipse.jgit.pgm.debug.ShowCommands
org.eclipse.jgit.pgm.debug.ShowDirCache
diff --git a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
index bf2455283e..afa253eeb5 100644
--- a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
+++ b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
@@ -118,7 +118,6 @@ metaVar_file=FILE
metaVar_filepattern=filepattern
metaVar_gitDir=GIT_DIR
metaVar_hostName=HOSTNAME
-metaVar_ketchServerType=SERVERTYPE
metaVar_lfsStorage=STORAGE
metaVar_linesOfContext=lines
metaVar_message=message
@@ -247,7 +246,6 @@ usage_DisplayTheVersionOfJgit=Display the version of jgit
usage_Gc=Cleanup unnecessary files and optimize the local repository
usage_Glog=View commit history as a graph
usage_IndexPack=Build pack index file for an existing packed archive
-usage_ketchServerType=Ketch server type
usage_LFSDirectory=Directory to store large objects
usage_LFSPort=Server http port
usage_LFSRunStore=Store (fs | s3), store lfs objects in file system or Amazon S3
@@ -267,8 +265,6 @@ usage_PreserveOldPacks=Preserve old pack files by moving them into the preserved
usage_PrunePreserved=Remove the preserved subdirectory containing previously preserved old pack files before repacking, and before preserving more old pack files
usage_ReadDirCache= Read the DirCache 100 times
usage_RebuildCommitGraph=Recreate a repository from another one's commit graph
-usage_RebuildRefTree=Copy references into a RefTree
-usage_RebuildRefTreeEnable=set extensions.refStorage = reftree
usage_Remote=Manage set of tracked repositories
usage_RepositoryToReadFrom=Repository to read from
usage_RepositoryToReceiveInto=Repository to receive into
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java
index bf9102552c..f987f2c806 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java
@@ -13,19 +13,12 @@ package org.eclipse.jgit.pgm;
import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
-import java.net.URISyntaxException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executors;
import org.eclipse.jgit.errors.ConfigInvalidException;
-import org.eclipse.jgit.internal.ketch.KetchLeader;
-import org.eclipse.jgit.internal.ketch.KetchLeaderCache;
-import org.eclipse.jgit.internal.ketch.KetchPreReceive;
-import org.eclipse.jgit.internal.ketch.KetchSystem;
-import org.eclipse.jgit.internal.ketch.KetchText;
-import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.pgm.internal.CLIText;
import org.eclipse.jgit.storage.file.FileBasedConfig;
@@ -33,10 +26,7 @@ import org.eclipse.jgit.storage.file.WindowCacheConfig;
import org.eclipse.jgit.storage.pack.PackConfig;
import org.eclipse.jgit.transport.DaemonClient;
import org.eclipse.jgit.transport.DaemonService;
-import org.eclipse.jgit.transport.ReceivePack;
import org.eclipse.jgit.transport.resolver.FileResolver;
-import org.eclipse.jgit.transport.resolver.ReceivePackFactory;
-import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.SystemReader;
import org.kohsuke.args4j.Argument;
@@ -71,13 +61,6 @@ class Daemon extends TextBuiltin {
@Option(name = "--export-all", usage = "usage_exportWithoutGitDaemonExportOk")
boolean exportAll;
- @Option(name = "--ketch", metaVar = "metaVar_ketchServerType", usage = "usage_ketchServerType")
- KetchServerType ketchServerType;
-
- enum KetchServerType {
- LEADER;
- }
-
@Argument(required = true, metaVar = "metaVar_directory", usage = "usage_directoriesToExport")
List<File> directory = new ArrayList<>();
@@ -102,9 +85,9 @@ class Daemon extends TextBuiltin {
}
cfg = new FileBasedConfig(configFile, FS.DETECTED);
}
- cfg.load();
- new WindowCacheConfig().fromConfig(cfg).install();
- packConfig.fromConfig(cfg);
+ cfg.load();
+ new WindowCacheConfig().fromConfig(cfg).install();
+ packConfig.fromConfig(cfg);
int threads = packConfig.getThreads();
if (threads <= 0)
@@ -137,9 +120,6 @@ class Daemon extends TextBuiltin {
service(d, n).setOverridable(true);
for (String n : forbidOverride)
service(d, n).setOverridable(false);
- if (ketchServerType == KetchServerType.LEADER) {
- startKetchLeader(d);
- }
d.start();
outw.println(MessageFormat.format(CLIText.get().listeningOn, d.getAddress()));
}
@@ -162,24 +142,4 @@ class Daemon extends TextBuiltin {
throw die(MessageFormat.format(CLIText.get().serviceNotSupported, n));
return svc;
}
-
- private void startKetchLeader(org.eclipse.jgit.transport.Daemon daemon) {
- KetchSystem system = new KetchSystem();
- final KetchLeaderCache leaders = new KetchLeaderCache(system);
- final ReceivePackFactory<DaemonClient> factory;
-
- factory = daemon.getReceivePackFactory();
- daemon.setReceivePackFactory((DaemonClient req, Repository repo) -> {
- ReceivePack rp = factory.create(req, repo);
- KetchLeader leader;
- try {
- leader = leaders.get(repo);
- } catch (URISyntaxException err) {
- throw new ServiceNotEnabledException(
- KetchText.get().invalidFollowerUri, err);
- }
- rp.setPreReceiveHook(new KetchPreReceive(leader));
- return rp;
- });
- }
}
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java
deleted file mode 100644
index 38951ba428..0000000000
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (C) 2015, Google Inc. and others
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Distribution License v. 1.0 which is available at
- * https://www.eclipse.org/org/documents/edl-v10.php.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-package org.eclipse.jgit.pgm.debug;
-
-import static org.eclipse.jgit.lib.Constants.HEAD;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jgit.internal.storage.reftree.RefTree;
-import org.eclipse.jgit.internal.storage.reftree.RefTreeDatabase;
-import org.eclipse.jgit.lib.CommitBuilder;
-import org.eclipse.jgit.lib.ConfigConstants;
-import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.ObjectInserter;
-import org.eclipse.jgit.lib.ObjectReader;
-import org.eclipse.jgit.lib.PersonIdent;
-import org.eclipse.jgit.lib.Ref;
-import org.eclipse.jgit.lib.RefDatabase;
-import org.eclipse.jgit.lib.RefUpdate;
-import org.eclipse.jgit.lib.StoredConfig;
-import org.eclipse.jgit.pgm.Command;
-import org.eclipse.jgit.pgm.TextBuiltin;
-import org.eclipse.jgit.revwalk.RevWalk;
-import org.kohsuke.args4j.Option;
-
-@Command(usage = "usage_RebuildRefTree")
-class RebuildRefTree extends TextBuiltin {
- @Option(name = "--enable", usage = "usage_RebuildRefTreeEnable")
- boolean enable;
-
- private String txnNamespace;
- private String txnCommitted;
-
- /** {@inheritDoc} */
- @Override
- protected void run() throws Exception {
- try (ObjectReader reader = db.newObjectReader();
- RevWalk rw = new RevWalk(reader);
- ObjectInserter inserter = db.newObjectInserter()) {
- RefDatabase refDb = db.getRefDatabase();
- if (refDb instanceof RefTreeDatabase) {
- RefTreeDatabase d = (RefTreeDatabase) refDb;
- refDb = d.getBootstrap();
- txnNamespace = d.getTxnNamespace();
- txnCommitted = d.getTxnCommitted();
- } else {
- RefTreeDatabase d = new RefTreeDatabase(db, refDb);
- txnNamespace = d.getTxnNamespace();
- txnCommitted = d.getTxnCommitted();
- }
-
- errw.format("Rebuilding %s from %s", //$NON-NLS-1$
- txnCommitted, refDb.getClass().getSimpleName());
- errw.println();
- errw.flush();
-
- CommitBuilder b = new CommitBuilder();
- Ref ref = refDb.exactRef(txnCommitted);
- RefUpdate update = refDb.newUpdate(txnCommitted, true);
- ObjectId oldTreeId;
-
- if (ref != null && ref.getObjectId() != null) {
- ObjectId oldId = ref.getObjectId();
- update.setExpectedOldObjectId(oldId);
- b.setParentId(oldId);
- oldTreeId = rw.parseCommit(oldId).getTree();
- } else {
- update.setExpectedOldObjectId(ObjectId.zeroId());
- oldTreeId = ObjectId.zeroId();
- }
-
- RefTree tree = rebuild(refDb);
- b.setTreeId(tree.writeTree(inserter));
- b.setAuthor(new PersonIdent(db));
- b.setCommitter(b.getAuthor());
- if (b.getTreeId().equals(oldTreeId)) {
- return;
- }
-
- update.setNewObjectId(inserter.insert(b));
- inserter.flush();
-
- RefUpdate.Result result = update.update(rw);
- switch (result) {
- case NEW:
- case FAST_FORWARD:
- break;
- default:
- throw die(String.format("%s: %s", update.getName(), result)); //$NON-NLS-1$
- }
-
- if (enable && !(db.getRefDatabase() instanceof RefTreeDatabase)) {
- StoredConfig cfg = db.getConfig();
- cfg.setInt(ConfigConstants.CONFIG_CORE_SECTION, null,
- ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, 1);
- cfg.setString(ConfigConstants.CONFIG_EXTENSIONS_SECTION, null,
- ConfigConstants.CONFIG_KEY_REFSTORAGE,
- ConfigConstants.CONFIG_REFSTORAGE_REFTREE);
- cfg.save();
- errw.println("Enabled reftree."); //$NON-NLS-1$
- errw.flush();
- }
- }
- }
-
- private RefTree rebuild(RefDatabase refdb) throws IOException {
- RefTree tree = RefTree.newEmptyTree();
- List<org.eclipse.jgit.internal.storage.reftree.Command> cmds
- = new ArrayList<>();
-
- Ref head = refdb.exactRef(HEAD);
- if (head != null) {
- cmds.add(new org.eclipse.jgit.internal.storage.reftree.Command(
- null,
- head));
- }
-
- for (Ref r : refdb.getRefs()) {
- if (r.getName().equals(txnCommitted) || r.getName().equals(HEAD)
- || r.getName().startsWith(txnNamespace)) {
- continue;
- }
- cmds.add(new org.eclipse.jgit.internal.storage.reftree.Command(
- null,
- db.getRefDatabase().peel(r)));
- }
- tree.apply(cmds);
- return tree;
- }
-}