aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-08-05 21:11:31 -0400
committerCode Review <codereview-daemon@eclipse.org>2010-08-05 21:11:31 -0400
commit8e9cc826e9275ce0e7ab51cc933923eb3b5f16ae (patch)
tree961272fbee29dff1360f9836085ea196c52edc1f /org.eclipse.jgit.pgm/src
parent97e93ca1eacbe840ac5277f38159a620c1c907d2 (diff)
parent5f5da8b1d47db5a390ef409095c76d5290441620 (diff)
downloadjgit-8e9cc826e9275ce0e7ab51cc933923eb3b5f16ae.tar.gz
jgit-8e9cc826e9275ce0e7ab51cc933923eb3b5f16ae.zip
Merge changes I39bfefee,I47795987,I70d120fb,I58cc5e01,I96bee7b9
* changes: Enable configuration of non-standard pack settings Pass PackConfig down to PackWriter when packing Simplify UploadPack use of options during writing Move PackWriter configuration to PackConfig Allow PackWriter callers to manage the thread pool
Diffstat (limited to 'org.eclipse.jgit.pgm/src')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java1
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java37
2 files changed, 37 insertions, 1 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java
index bae895cc76..14dcb1f50d 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java
@@ -67,6 +67,7 @@ public class CLIText extends TranslationBundle {
/***/ public String branchIsNotAnAncestorOfYourCurrentHEAD;
/***/ public String branchNotFound;
/***/ public String cacheTreePathInfo;
+ /***/ public String configFileNotFound;
/***/ public String cannotBeRenamed;
/***/ public String cannotChekoutNoHeadsAdvertisedByRemote;
/***/ public String cannotCreateCommand;
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 f015a9e7bd..3cca87abe8 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
@@ -48,13 +48,22 @@ import java.net.InetSocketAddress;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.Executors;
+import org.eclipse.jgit.storage.file.FileBasedConfig;
+import org.eclipse.jgit.storage.file.WindowCache;
+import org.eclipse.jgit.storage.file.WindowCacheConfig;
+import org.eclipse.jgit.storage.pack.PackConfig;
+import org.eclipse.jgit.transport.DaemonService;
+import org.eclipse.jgit.util.FS;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.Option;
-import org.eclipse.jgit.transport.DaemonService;
@Command(common = true, usage = "usage_exportRepositoriesOverGit")
class Daemon extends TextBuiltin {
+ @Option(name = "--config-file", metaVar = "metaVar_configFile", usage = "usage_configFile")
+ File configFile;
+
@Option(name = "--port", metaVar = "metaVar_port", usage = "usage_portNumberToListenOn")
int port = org.eclipse.jgit.transport.Daemon.DEFAULT_PORT;
@@ -89,12 +98,38 @@ class Daemon extends TextBuiltin {
@Override
protected void run() throws Exception {
+ PackConfig packConfig = new PackConfig();
+
+ if (configFile != null) {
+ if (!configFile.exists()) {
+ throw die(MessageFormat.format(
+ CLIText.get().configFileNotFound, //
+ configFile.getAbsolutePath()));
+ }
+
+ FileBasedConfig cfg = new FileBasedConfig(configFile, FS.DETECTED);
+ cfg.load();
+
+ WindowCacheConfig wcc = new WindowCacheConfig();
+ wcc.fromConfig(cfg);
+ WindowCache.reconfigure(wcc);
+
+ packConfig.fromConfig(cfg);
+ }
+
+ int threads = packConfig.getThreads();
+ if (threads <= 0)
+ threads = Runtime.getRuntime().availableProcessors();
+ if (1 < threads)
+ packConfig.setExecutor(Executors.newFixedThreadPool(threads));
+
final org.eclipse.jgit.transport.Daemon d;
d = new org.eclipse.jgit.transport.Daemon(
host != null ? new InetSocketAddress(host, port)
: new InetSocketAddress(port));
d.setExportAll(exportAll);
+ d.setPackConfig(packConfig);
if (0 <= timeout)
d.setTimeout(timeout);