changeset 885:39ebb1402c18

Create HgRepo via OperationContext
author Dmitry Neverov <dmitry.neverov@jetbrains.com>
date Sun, 05 Oct 2014 21:05:15 +0200
parents 31b9442acf2a
children bf83331f51f0
files mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialCollectChangesPolicy.java
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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<String, String> 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)