Mercurial > hg > mercurial
changeset 955:31ac1d822fd7 Hajipur-9.1.x
Ability to disable fromRevisions computation
line wrap: on
line diff
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/CollectChangesContext.java Tue Feb 02 18:52:25 2016 +0100 +++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/CollectChangesContext.java Fri Jul 22 10:43:41 2016 +0200 @@ -37,6 +37,7 @@ public class CollectChangesContext extends OperationContext { + private final ServerPluginConfig myConfig; private final Set<String> myUninterestingRevisions; private final Map<VcsRootKey, DAG<String>> myDags = new HashMap<VcsRootKey, DAG<String>>(); private Set<File> mySyncedDirs = new HashSet<File>(); @@ -46,25 +47,29 @@ private boolean myIncludeFromRevisions = false;//by default don't include them, they should be included only for subrepos private TLongObjectHashMap<String> myStringPool = new TLongObjectHashMap<String>(); - public CollectChangesContext(@NotNull MercurialVcsSupport vcs, + public CollectChangesContext(@NotNull ServerPluginConfig config, + @NotNull MercurialVcsSupport vcs, @NotNull RepoFactory repoFactory, @NotNull MercurialProgress progress, @NotNull RepositoryStateData fromState) { - this(vcs, repoFactory, progress, new HashSet<String>(fromState.getBranchRevisions().values())); + this(config, vcs, repoFactory, progress, new HashSet<String>(fromState.getBranchRevisions().values())); } - public CollectChangesContext(@NotNull MercurialVcsSupport vcs, + public CollectChangesContext(@NotNull ServerPluginConfig config, + @NotNull MercurialVcsSupport vcs, @NotNull RepoFactory repoFactory, @NotNull MercurialProgress progress, @NotNull String fromVersion) { - this(vcs, repoFactory, progress, setOf(fromVersion)); + this(config, vcs, repoFactory, progress, setOf(fromVersion)); } - public CollectChangesContext(@NotNull MercurialVcsSupport vcs, + public CollectChangesContext(@NotNull ServerPluginConfig config, + @NotNull MercurialVcsSupport vcs, @NotNull RepoFactory repoFactory, @NotNull MercurialProgress progress, @NotNull Collection<String> fromVersions) { super(vcs, repoFactory, progress); + myConfig = config; myUninterestingRevisions = new HashSet<String>(fromVersions); } @@ -198,7 +203,7 @@ syncRepository(root); ServerHgRepo repo = createRepo(root, myVcs.getWorkingDir(root)); - if (!repo.supportRevsets()) + if (!repo.supportRevsets() || !myConfig.computeFromRevisions()) return singleton(fromRevision); Set<String> fromRevisions = new HashSet<String>();
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialCollectChangesPolicy.java Tue Feb 02 18:52:25 2016 +0100 +++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialCollectChangesPolicy.java Fri Jul 22 10:43:41 2016 +0200 @@ -105,7 +105,7 @@ @NotNull CheckoutRules rules) throws VcsException { List<ModificationData> changes = new ArrayList<ModificationData>(); HgVcsRoot hgRoot = myHgVcsRootFactory.createHgRoot(root); - CollectChangesContext ctx = new CollectChangesContext(myVcs, myRepoFactory, createMercurialProgess(), fromState); + CollectChangesContext ctx = new CollectChangesContext(myConfig, myVcs, myRepoFactory, createMercurialProgess(), fromState); for (Map.Entry<String, String> entry : toState.getBranchRevisions().entrySet()) { String branch = entry.getKey(); String toRevision = entry.getValue(); @@ -136,7 +136,7 @@ @Nullable String toRootRevision, @NotNull CheckoutRules checkoutRules) throws VcsException { HgVcsRoot hgRoot = myHgVcsRootFactory.createHgRoot(toRoot); - CollectChangesContext context = new CollectChangesContext(myVcs, myRepoFactory, createMercurialProgess(), fromRootRevision); + CollectChangesContext context = new CollectChangesContext(myConfig, myVcs, myRepoFactory, createMercurialProgess(), fromRootRevision); context.syncRepository(hgRoot); String toRevision = toRootRevision; if (toRevision == null) { @@ -156,7 +156,7 @@ @NotNull CheckoutRules checkoutRules) throws VcsException { if (currentVersion == null) return emptyList(); - CollectChangesContext ctx = new CollectChangesContext(myVcs, myRepoFactory, createMercurialProgess(), fromVersion); + CollectChangesContext ctx = new CollectChangesContext(myConfig, myVcs, myRepoFactory, createMercurialProgess(), fromVersion); return collectChanges(ctx, root, fromVersion, currentVersion, checkoutRules); }
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialModificationInfoBuilder.java Tue Feb 02 18:52:25 2016 +0100 +++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialModificationInfoBuilder.java Fri Jul 22 10:43:41 2016 +0200 @@ -26,15 +26,18 @@ public class MercurialModificationInfoBuilder implements ChangesInfoBuilder, MercurialServerExtension { + private final ServerPluginConfig myConfig; private final MercurialVcsSupport myVcs; private final HgVcsRootFactory myHgVcsRootFactory; private final RepoFactory myRepoFactory; private final HgPathProvider myHgPathProvider; - public MercurialModificationInfoBuilder(@NotNull MercurialVcsSupport vcs, + public MercurialModificationInfoBuilder(@NotNull ServerPluginConfig config, + @NotNull MercurialVcsSupport vcs, @NotNull HgVcsRootFactory hgVcsRootFactory, @NotNull RepoFactory repoFactory, @NotNull HgPathProvider hgPathProvider) { + myConfig = config; myVcs = vcs; myHgVcsRootFactory = hgVcsRootFactory; myRepoFactory = repoFactory; @@ -48,7 +51,7 @@ @NotNull final ChangesConsumer consumer) throws VcsException { final HgVcsRoot hgRoot = myHgVcsRootFactory.createHgRoot(root); - final CollectChangesContext ctx = new CollectChangesContext(myVcs, + final CollectChangesContext ctx = new CollectChangesContext(myConfig, myVcs, myRepoFactory, MercurialProgress.NO_OP, Collections.<String>emptyList());
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/ServerPluginConfig.java Tue Feb 02 18:52:25 2016 +0100 +++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/ServerPluginConfig.java Fri Jul 22 10:43:41 2016 +0200 @@ -59,4 +59,6 @@ public String getMergeTool(); public boolean runWithProfile(@NotNull HgVcsRoot root); + + boolean computeFromRevisions(); }
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/ServerPluginConfigImpl.java Tue Feb 02 18:52:25 2016 +0100 +++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/ServerPluginConfigImpl.java Fri Jul 22 10:43:41 2016 +0200 @@ -129,4 +129,8 @@ String urls = TeamCityProperties.getProperty("teamcity.hg.runCommandsWithProfile"); return urls.contains(root.getRepository()); } + + public boolean computeFromRevisions() { + return TeamCityProperties.getBooleanOrTrue("teamcity.hg.computeFromRevisions"); + } }
--- a/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialModificationInfoBuilderTest.java Tue Feb 02 18:52:25 2016 +0100 +++ b/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialModificationInfoBuilderTest.java Fri Jul 22 10:43:41 2016 +0200 @@ -56,7 +56,7 @@ MercurialSupportBuilder hgBuilder = mercurialSupport().withConfig(config); MercurialVcsSupport vcs = hgBuilder.build(); myVcs = vcs; - myModInfoBuilder = new MercurialModificationInfoBuilder(vcs, hgBuilder.getHgRootFactory(), hgBuilder.getHgRepoFactory(), hgBuilder.getHgPathProvider()); + myModInfoBuilder = new MercurialModificationInfoBuilder(config, vcs, hgBuilder.getHgRootFactory(), hgBuilder.getHgRepoFactory(), hgBuilder.getHgPathProvider()); }
--- a/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/ServerPluginConfigBuilder.java Tue Feb 02 18:52:25 2016 +0100 +++ b/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/ServerPluginConfigBuilder.java Fri Jul 22 10:43:41 2016 +0200 @@ -111,6 +111,10 @@ public boolean runWithProfile(@NotNull HgVcsRoot root) { return false; } + + public boolean computeFromRevisions() { + return true; + } }; }