]> source.dussan.org Git - jgit.git/commitdiff
Add copy constructor to PackConfig 24/3924/1
authorShawn O. Pearce <spearce@spearce.org>
Wed, 27 Jul 2011 13:34:52 +0000 (06:34 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Wed, 27 Jul 2011 17:00:41 +0000 (10:00 -0700)
Some embeddings of UploadPack (e.g. Gerrit Code Review) set their own
PackConfig from a server-wide configuration, overriding any JGit
defaults or settings that may exist at the local repository level.

Make a copy constructor form of PackConfig so this server-wide
configuration object can be copied and then merged with repository
specific configuration data.

Change-Id: I4463c95aeaf7d6536c3ab132dec9c50ee528d9e0
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java

index 7206bb8b0d6a1c9d03d579025cf5360646d84bdb..91275dc09868fbf88d26c243bf82b42e473dcd3d 100644 (file)
@@ -189,6 +189,29 @@ public class PackConfig {
                fromConfig(cfg);
        }
 
+       /**
+        * Copy an existing configuration to a new instance.
+        *
+        * @param cfg
+        *            the source configuration to copy from.
+        */
+       public PackConfig(PackConfig cfg) {
+               this.compressionLevel = cfg.compressionLevel;
+               this.reuseDeltas = cfg.reuseDeltas;
+               this.reuseObjects = cfg.reuseObjects;
+               this.deltaBaseAsOffset = cfg.deltaBaseAsOffset;
+               this.deltaCompress = cfg.deltaCompress;
+               this.maxDeltaDepth = cfg.maxDeltaDepth;
+               this.deltaSearchWindowSize = cfg.deltaSearchWindowSize;
+               this.deltaSearchMemoryLimit = cfg.deltaSearchMemoryLimit;
+               this.deltaCacheSize = cfg.deltaCacheSize;
+               this.deltaCacheLimit = cfg.deltaCacheLimit;
+               this.bigFileThreshold = cfg.bigFileThreshold;
+               this.threads = cfg.threads;
+               this.executor = cfg.executor;
+               this.indexVersion = cfg.indexVersion;
+       }
+
        /**
         * Check whether to reuse deltas existing in repository.
         *