# HG changeset patch # User Dmitry Neverov # Date 1412535915 -7200 # Node ID 39ebb1402c189f980b697ed3be519ce4293ed5e7 # Parent 31b9442acf2a03bb69cbaf8488bf76a4eade4506 Create HgRepo via OperationContext diff -r 31b9442acf2a -r 39ebb1402c18 mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialCollectChangesPolicy.java --- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialCollectChangesPolicy.java Sun Oct 05 12:49:09 2014 +0200 +++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialCollectChangesPolicy.java Sun Oct 05 21:05:15 2014 +0200 @@ -74,8 +74,8 @@ @NotNull public Map getHeads(@NotNull HgVcsRoot hgRoot) throws VcsException { - boolean includeTags = myConfig.useTagsAsBranches() && hgRoot.useTagsAsBranches(); - return myVcs.createRepo(hgRoot).getBranchRevisions(myConfig.bookmarksEnabled(), includeTags); + OperationContext context = new OperationContext(myVcs, myRepoFactory, MercurialProgress.NO_OP); + return getHeads(hgRoot, context); } @NotNull @@ -139,7 +139,7 @@ RepositoryStateData state = myVcs.getCollectChangesPolicy().getCurrentState(toRoot); toRevision = state.getBranchRevisions().get(state.getDefaultBranchName()); } - String mergeBase = getMergeBase(hgRoot, fromRootRevision, toRevision); + String mergeBase = getMergeBase(context, hgRoot, fromRootRevision, toRevision); if (mergeBase == null) return Collections.emptyList(); return collectChanges(context, toRoot, mergeBase, toRootRevision, checkoutRules); @@ -168,20 +168,20 @@ } @Nullable - private String getMergeBase(@NotNull HgVcsRoot root, @NotNull String revision1, @NotNull String revision2) throws VcsException { - String result = myVcs.createRepo(root).mergeBase() + private String getMergeBase(@NotNull OperationContext context, @NotNull HgVcsRoot root, @NotNull String revision1, @NotNull String revision2) throws VcsException { + String result = context.createRepo(root).mergeBase() .revision1(revision1) .revision2(revision2) .call(); if (result == null) - result = getMinusNthCommit(root, 10); + result = getMinusNthCommit(context, root, 10); return result; } @Nullable - private String getMinusNthCommit(@NotNull HgVcsRoot root, int n) throws VcsException { - LogCommand log = myVcs.createRepo(root).log() + private String getMinusNthCommit(@NotNull OperationContext context, @NotNull HgVcsRoot root, int n) throws VcsException { + LogCommand log = context.createRepo(root).log() .inBranch(root.getBranchName()) .toNamedRevision(root.getBranchName()); if (n > 0)