# HG changeset patch # User Dmitry Neverov # Date 1412457934 -7200 # Node ID f697460552c80b1efea4126ccdb60db76857930d # Parent ea8b15b97960ad9e8b801353c3c33873d17dea61 Require progress in ChangesCollectingContext diff -r ea8b15b97960 -r f697460552c8 mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/CollectChangesContext.java --- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/CollectChangesContext.java Sat Oct 04 23:16:43 2014 +0200 +++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/CollectChangesContext.java Sat Oct 04 23:25:34 2014 +0200 @@ -51,23 +51,26 @@ public CollectChangesContext(@NotNull MercurialVcsSupport vcs, @NotNull RepoFactory repoFactory, + @NotNull MercurialProgress progress, @NotNull RepositoryStateData fromState, @NotNull RepositoryStateData toState) { - this(vcs, repoFactory, new HashSet(fromState.getBranchRevisions().values()), toState); + this(vcs, repoFactory, progress, new HashSet(fromState.getBranchRevisions().values()), toState); } public CollectChangesContext(@NotNull MercurialVcsSupport vcs, @NotNull RepoFactory repoFactory, + @NotNull MercurialProgress progress, @NotNull String fromVersion, @NotNull String toVersion) { - this(vcs, repoFactory, setOf(fromVersion), RepositoryStateData.createSingleVersionState(toVersion)); + this(vcs, repoFactory, progress, setOf(fromVersion), RepositoryStateData.createSingleVersionState(toVersion)); } public CollectChangesContext(@NotNull MercurialVcsSupport vcs, @NotNull RepoFactory repoFactory, + @NotNull MercurialProgress progress, @NotNull Collection fromVersions, @NotNull RepositoryStateData toState) { - super(vcs, repoFactory, MercurialProgress.NO_OP); + super(vcs, repoFactory, progress); myToState = toState; myUninterestingRevisions = new HashSet(fromVersions); } diff -r ea8b15b97960 -r f697460552c8 mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialCollectChangesPolicy.java --- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialCollectChangesPolicy.java Sat Oct 04 23:16:43 2014 +0200 +++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialCollectChangesPolicy.java Sat Oct 04 23:25:34 2014 +0200 @@ -96,7 +96,7 @@ @NotNull CheckoutRules rules) throws VcsException { List changes = new ArrayList(); HgVcsRoot hgRoot = myHgVcsRootFactory.createHgRoot(root); - CollectChangesContext ctx = new CollectChangesContext(myVcs, myRepoFactory, fromState, toState); + CollectChangesContext ctx = new CollectChangesContext(myVcs, myRepoFactory, createMercurialProgess(), fromState, toState); ctx.setProgressConsumer(createProgressConsumer()); for (Map.Entry entry : toState.getBranchRevisions().entrySet()) { String branch = entry.getKey(); @@ -149,7 +149,7 @@ @NotNull CheckoutRules checkoutRules) throws VcsException { if (currentVersion == null) return emptyList(); - CollectChangesContext ctx = new CollectChangesContext(myVcs, myRepoFactory, fromVersion, currentVersion); + CollectChangesContext ctx = new CollectChangesContext(myVcs, myRepoFactory, createMercurialProgess(), fromVersion, currentVersion); ctx.setProgressConsumer(createProgressConsumer()); List changes = collectChanges(ctx, root, asList(fromVersion), currentVersion, checkoutRules); changes.addAll(getSubrepoChanges(ctx, root, changes)); @@ -395,6 +395,16 @@ } + @NotNull + private MercurialProgress createMercurialProgess() { + try { + final VcsOperationProgress progress = myProgressProvider.getProgress(); + return new MercurialVcsOperationProgress(progress); + } catch (IllegalStateException e) { + return MercurialProgress.NO_OP; + } + } + @Nullable private ProgressParser.ProgressConsumer createProgressConsumer() { try { diff -r ea8b15b97960 -r f697460552c8 mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialModificationInfoBuilder.java --- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialModificationInfoBuilder.java Sat Oct 04 23:16:43 2014 +0200 +++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialModificationInfoBuilder.java Sat Oct 04 23:25:34 2014 +0200 @@ -50,6 +50,7 @@ final CollectChangesContext ctx = new CollectChangesContext(myVcs, myRepoFactory, + MercurialProgress.NO_OP, Collections.emptyList(), RepositoryStateData.createVersionState("", Collections.emptyMap()));