ObjectDirectoryInserter(FileObjectDatabase dest, Config cfg) { db = dest; config = cfg.get(WriteConfig.KEY); }
private WriteConfig(Config rc) { compression = rc.get(CoreConfig.KEY).getCompression(); fsyncObjectFiles = rc.getBoolean("core", "fsyncobjectfiles", false); //$NON-NLS-1$ //$NON-NLS-2$ fsyncRefFiles = rc.getBoolean("core", "fsyncreffiles", false); //$NON-NLS-1$ //$NON-NLS-2$ }
private void setReader(ObjectReader reader, Config cfg, boolean closeReader) { close(); this.closeReader = closeReader; this.reader = reader; this.diffCfg = cfg.get(DiffConfig.KEY); ContentSource cs = ContentSource.create(reader); source = new ContentSource.Pair(cs, cs); if (diffCfg.isNoPrefix()) { setOldPrefix(""); //$NON-NLS-1$ setNewPrefix(""); //$NON-NLS-1$ } setDetectRenames(diffCfg.isRenameDetectionEnabled()); diffAlgorithm = DiffAlgorithm.getAlgorithm(cfg.getEnum( ConfigConstants.CONFIG_DIFF_SECTION, null, ConfigConstants.CONFIG_KEY_ALGORITHM, SupportedAlgorithm.HISTOGRAM)); }
@Inject public GerritPersonIdentProvider(@GerritServerConfig final Config cfg) { String name = cfg.getString("user", null, "name"); if (name == null) { name = "Gerrit Code Review"; } this.name = name; email = cfg.get(UserConfig.KEY).getCommitterEmail(); }
/** * Update properties by setting fields from the configuration. * <p> * If a property is not defined in the configuration, then it is left * unmodified. * * @param rc * configuration to read properties from. * @return {@code this} */ public DhtInserterOptions fromConfig(Config rc) { setChunkSize(rc.getInt("core", "dht", "chunkSize", getChunkSize())); setWriteBufferSize(rc.getInt("core", "dht", "writeBufferSize", getWriteBufferSize())); setCompression(rc.get(CoreConfig.KEY).getCompression()); setPrefetchDepth(rc.getInt("core", "dht", "packParserPrefetchDepth", getPrefetchDepth())); setParserCacheLimit(rc.getLong("core", "dht", "packParserCacheLimit", getParserCacheLimit())); return this; } }
@Inject public GerritPersonIdentProvider(@GerritServerConfig final Config cfg) { String name = cfg.getString("user", null, "name"); if (name == null) { name = "Gerrit Code Review"; } this.name = name; email = cfg.get(UserConfig.KEY).getCommitterEmail(); }
private WriteConfig(final Config rc) { compression = rc.get(CoreConfig.KEY).getCompression(); fsyncObjectFiles = rc.getBoolean("core", "fsyncobjectfiles", false); //$NON-NLS-1$ //$NON-NLS-2$ fsyncRefFiles = rc.getBoolean("core", "fsyncreffiles", false); //$NON-NLS-1$ //$NON-NLS-2$ }
/** * Update properties by setting fields from the configuration. * <p> * If a property is not defined in the configuration, then it is left * unmodified. * * @param rc * configuration to read properties from. * @return {@code this} */ public DhtInserterOptions fromConfig(Config rc) { setChunkSize(rc.getInt("core", "dht", "chunkSize", getChunkSize())); setWriteBufferSize(rc.getInt("core", "dht", "writeBufferSize", getWriteBufferSize())); setCompression(rc.get(CoreConfig.KEY).getCompression()); setPrefetchDepth(rc.getInt("core", "dht", "packParserPrefetchDepth", getPrefetchDepth())); setParserCacheLimit(rc.getLong("core", "dht", "packParserCacheLimit", getParserCacheLimit())); return this; } }
private void setReader(ObjectReader reader, Config cfg, boolean closeReader) { close(); this.closeReader = closeReader; this.reader = reader; this.diffCfg = cfg.get(DiffConfig.KEY); ContentSource cs = ContentSource.create(reader); source = new ContentSource.Pair(cs, cs); if (diffCfg.isNoPrefix()) { setOldPrefix(""); //$NON-NLS-1$ setNewPrefix(""); //$NON-NLS-1$ } setDetectRenames(diffCfg.isRenameDetectionEnabled()); diffAlgorithm = DiffAlgorithm.getAlgorithm(cfg.getEnum( ConfigConstants.CONFIG_DIFF_SECTION, null, ConfigConstants.CONFIG_KEY_ALGORITHM, SupportedAlgorithm.HISTOGRAM)); }
ObjectDirectoryPackParser(FileObjectDatabase odb, InputStream src) { super(odb, src); this.db = odb; this.crc = new CRC32(); this.tailDigest = Constants.newMessageDigest(); indexVersion = db.getConfig().get(CoreConfig.KEY).getPackIndexVersion(); }
private WriteConfig(Config rc) { compression = rc.get(CoreConfig.KEY).getCompression(); fsyncObjectFiles = rc.getBoolean("core", "fsyncobjectfiles", false); //$NON-NLS-1$ //$NON-NLS-2$ fsyncRefFiles = rc.getBoolean("core", "fsyncreffiles", false); //$NON-NLS-1$ //$NON-NLS-2$ }
private void setReader(ObjectReader reader, Config cfg, boolean closeReader) { close(); this.closeReader = closeReader; this.reader = reader; this.diffCfg = cfg.get(DiffConfig.KEY); ContentSource cs = ContentSource.create(reader); source = new ContentSource.Pair(cs, cs); if (diffCfg.isNoPrefix()) { setOldPrefix(""); //$NON-NLS-1$ setNewPrefix(""); //$NON-NLS-1$ } setDetectRenames(diffCfg.isRenameDetectionEnabled()); diffAlgorithm = DiffAlgorithm.getAlgorithm(cfg.getEnum( ConfigConstants.CONFIG_DIFF_SECTION, null, ConfigConstants.CONFIG_KEY_ALGORITHM, SupportedAlgorithm.HISTOGRAM)); }
/** * Get the EOL stream type of the current entry using the config and * {@link #getAttributes()}. * * @param opType * the operationtype (checkin/checkout) which should be used * @return the EOL stream type of the current entry using the config and * {@link #getAttributes()}. Note that this method may return null * if the {@link org.eclipse.jgit.treewalk.TreeWalk} is not based on * a working tree * @since 4.10 */ @Nullable public EolStreamType getEolStreamType(OperationType opType) { if (attributesNodeProvider == null || config == null) return null; return EolStreamTypeUtil.detectStreamType( opType != null ? opType : operationType, config.get(WorkingTreeOptions.KEY), getAttributes()); }
private static @NonNull DiffEntry diffFile(Repository repo, String oldCommit, String newCommit, String path) throws IOException, GitAPIException { Config config = new Config(); config.setBoolean("diff", null, "renames", true); DiffConfig diffConfig = config.get(DiffConfig.KEY); try (Git git = new Git(repo)) { List<DiffEntry> diffList = git.diff(). setOldTree(prepareTreeParser(repo, oldCommit)). setNewTree(prepareTreeParser(repo, newCommit)). setPathFilter(FollowFilter.create(path, diffConfig)). call(); if (diffList.size() == 0) return null; if (diffList.size() > 1) throw new RuntimeException("invalid diff"); return diffList.get(0); } } }
private static @NonNull DiffEntry diffFile(Repository repo, String oldCommit, String newCommit, String path) throws IOException, GitAPIException { Config config = new Config(); config.setBoolean("diff", null, "renames", true); DiffConfig diffConfig = config.get(DiffConfig.KEY); try (Git git = new Git(repo)) { List<DiffEntry> diffList = git.diff(). setOldTree(prepareTreeParser(repo, oldCommit)). setNewTree(prepareTreeParser(repo, newCommit)). setPathFilter(FollowFilter.create(path, diffConfig)). call(); if (diffList.size() == 0) return null; if (diffList.size() > 1) throw new RuntimeException("invalid diff"); return diffList.get(0); } } }
ObjectDirectoryInserter(final FileObjectDatabase dest, final Config cfg) { db = dest; config = cfg.get(WriteConfig.KEY); }
ObjectDirectoryInserter(FileObjectDatabase dest, Config cfg) { db = dest; config = cfg.get(WriteConfig.KEY); }
ObjectDirectoryPackParser(FileObjectDatabase odb, InputStream src) { super(odb, src); this.db = odb; this.crc = new CRC32(); this.tailDigest = Constants.newMessageDigest(); indexVersion = db.getConfig().get(CoreConfig.KEY).getPackIndexVersion(); }
ObjectDirectoryPackParser(FileObjectDatabase odb, InputStream src) { super(odb, src); this.db = odb; this.crc = new CRC32(); this.tailDigest = Constants.newMessageDigest(); indexVersion = db.getConfig().get(CoreConfig.KEY).getPackIndexVersion(); }
/** * @param opType * the operationtype (checkin/checkout) which should be used * @return the EOL stream type of the current entry using the config and * {@link #getAttributes()} Note that this method may return null if * the {@link TreeWalk} is not based on a working tree */ // TODO(msohn) make this method public in 4.4 @Nullable EolStreamType getEolStreamType(OperationType opType) { if (attributesNodeProvider == null || config == null) return null; return EolStreamTypeUtil.detectStreamType(opType, config.get(WorkingTreeOptions.KEY), getAttributes()); }