Mercurial > hg > mercurial
view mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/ServerPluginConfigImpl.java @ 915:6b5e83970a26 Hajipur-9.0.x
Fix test: test repository requires a more recent mercurial
author | Dmitry Neverov <dmitry.neverov@jetbrains.com> |
---|---|
date | Fri, 02 Jan 2015 12:36:52 +0100 |
parents | d26bf03be294 |
children | 31ac1d822fd7 |
line wrap: on
line source
/* * Copyright 2000-2014 JetBrains s.r.o. * * 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 jetbrains.buildServer.buildTriggers.vcs.mercurial; import com.intellij.openapi.diagnostic.Logger; import jetbrains.buildServer.buildTriggers.vcs.mercurial.command.HgVcsRoot; import jetbrains.buildServer.serverSide.CachePaths; import jetbrains.buildServer.serverSide.TeamCityProperties; import jetbrains.buildServer.util.Dates; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.quartz.CronExpression; import java.io.File; import java.text.ParseException; import static com.intellij.openapi.util.text.StringUtil.isEmpty; /** * @author dmitry.neverov */ public class ServerPluginConfigImpl implements ServerPluginConfig { private static final Logger LOG = Logger.getInstance(ServerPluginConfigImpl.class.getName()); private static final String PULL_TIMEOUT_SECONDS = "teamcity.hg.pull.timeout.seconds"; public static final int DEFAULT_PULL_TIMEOUT_SECONDS = 3600; private final File myCachesDir; public ServerPluginConfigImpl(@NotNull final CachePaths paths) { myCachesDir = paths.getCacheDirectory("mercurial"); } public boolean isUsePullProtocol() { return TeamCityProperties.getBooleanOrTrue("teamcity.hg.use.pull.protocol"); } @Nullable public String getHgPath() { return TeamCityProperties.getPropertyOrNull("teamcity.hg.server.path"); } @NotNull public File getCachesDir() { String customCachesDir = TeamCityProperties.getProperty(Constants.CUSTOM_CACHES_DIR); if (!isEmpty(customCachesDir)) return new File(customCachesDir); return myCachesDir; } public boolean dontUseRevsets() { return TeamCityProperties.getBoolean("teamcity.hg.dont.use.revsets"); } public int getPullTimeout() { int timeout = TeamCityProperties.getInteger(PULL_TIMEOUT_SECONDS, DEFAULT_PULL_TIMEOUT_SECONDS); return timeout > 0 ? timeout : DEFAULT_PULL_TIMEOUT_SECONDS; } public int getMaxDagNodesCount() { return TeamCityProperties.getInteger("teamcity.hg.maxDagNodesCount", 0); } public int getLogOutputLimit() { return TeamCityProperties.getInteger("teamcity.hg.logOutputLimitChars", 2048); } public boolean detectSubrepoChanges() { return TeamCityProperties.getBooleanOrTrue("teamcity.hg.detectSubrepoChanges"); } public boolean bookmarksEnabled() { return TeamCityProperties.getBooleanOrTrue("teamcity.hg.enableBookmarks"); } public boolean useTagsAsBranches() { return TeamCityProperties.getBooleanOrTrue("teamcity.hg.useTagsAsBranches"); } public long getMirrorExpirationTimeoutMillis() { int days = TeamCityProperties.getInteger("teamcity.hg.mirrorExpirationTimeoutDays", 7); return days * Dates.ONE_DAY; } @Nullable public CronExpression getCleanupCronExpression() { String cron = TeamCityProperties.getProperty("teamcity.hg.cleanupCron", "0 0 2 * * ? *"); if (isEmpty(cron)) return null; try { return new CronExpression(cron); } catch (ParseException e) { LOG.warn("Wrong cron expression " + cron, e); return null; } } public boolean reportSubrepoChangesFileStatus() { return TeamCityProperties.getBoolean("teamcity.hg.reportSubrepoChangesFileStatus"); } public boolean allowSourceCaching() { return TeamCityProperties.getBoolean("teamcity.hg.allowSourceCaching"); } public int listFilesTTLSeconds() { return TeamCityProperties.getInteger("teamcity.hg.listFilesTTLSeconds", 60); } public String getMergeTool() { return TeamCityProperties.getProperty("teamcity.hg.mergeTool", "internal:merge"); } public boolean runWithProfile(@NotNull HgVcsRoot root) { String urls = TeamCityProperties.getProperty("teamcity.hg.runCommandsWithProfile"); return urls.contains(root.getRepository()); } }