changeset 526:e9de7632c0d4

Fix BranchSupport
author Dmitry Neverov <dmitry.neverov@jetbrains.com>
date Sat, 29 Dec 2012 12:10:58 +0400
parents 6de7b8ad3f8d
children cd54b079d5ca
files mercurial-server-tc/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialBranchSupport.java
diffstat 1 files changed, 0 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial-server-tc/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialBranchSupport.java	Tue Dec 18 18:40:44 2012 +0400
+++ b/mercurial-server-tc/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialBranchSupport.java	Sat Dec 29 12:10:58 2012 +0400
@@ -1,78 +1,12 @@
 package jetbrains.buildServer.buildTriggers.vcs.mercurial;
 
-import jetbrains.buildServer.buildTriggers.vcs.mercurial.command.ChangeSet;
-import jetbrains.buildServer.buildTriggers.vcs.mercurial.command.HgVcsRoot;
 import jetbrains.buildServer.vcs.*;
-import jetbrains.buildServer.vcs.impl.VcsRootImpl;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 
 public class MercurialBranchSupport implements BranchSupport, MercurialServerExtension {
-
-  private HgVcsRootFactory myHgRootFactory;
-  private MercurialVcsSupport myMercurialSupport;
-
-  public MercurialBranchSupport() {
-  }
-
-  public void setMercurialSupport(@NotNull MercurialVcsSupport mercurialSupport) {
-    myMercurialSupport = mercurialSupport;
-  }
-
-  public void setHgRootFactory(@NotNull HgVcsRootFactory hgRootFactory) {
-    myHgRootFactory = hgRootFactory;
-  }
-
   @NotNull
   public String getRemoteRunOnBranchPattern() {
     return "remote-run/*";
   }
-
-  @NotNull
-  public RepositoryStateData getCurrentState(@NotNull VcsRoot repository) throws VcsException {
-    return myMercurialSupport.getCurrentState(repository);
-  }
-
-  @NotNull
-  public Map<String, String> getBranchRootOptions(@NotNull VcsRoot original, @NotNull String branchName) {
-    final Map<String, String> options = new HashMap<String, String>(original.getProperties());
-    options.put(Constants.BRANCH_NAME_PROP, branchName);
-    return options;
-  }
-
-  @Nullable
-  public PersonalBranchDescription getPersonalBranchDescription(@NotNull VcsRoot original, @NotNull String branchName) throws VcsException {
-    HgVcsRoot hgRoot = myHgRootFactory.createHgRoot(original);
-    VcsRoot branchRoot = createBranchRoot(original, branchName);
-    String baseVersion = myMercurialSupport.getCurrentVersion(original);
-    String branchVersion = myMercurialSupport.getCurrentVersion(branchRoot);
-    String mergeBase = myMercurialSupport.getMergeBase(hgRoot, baseVersion, branchVersion);
-
-    if (mergeBase == null)
-      return null;
-
-    List<ChangeSet> changeSets = myMercurialSupport.createRepo(hgRoot)
-            .log()
-            .fromRevision(mergeBase)
-            .toRevision(branchVersion)
-            .showCommitsFromAllBranches()
-            .call();
-    if (changeSets.size() > 1) {//when branch points to the commit in original branch we get 1 cset
-      String branchId = changeSets.get(1).getId();
-      String username = changeSets.get(changeSets.size() - 1).getUser();
-      return new PersonalBranchDescription(branchId, username);
-    } else {
-      return null;
-    }
-  }
-
-  private VcsRoot createBranchRoot(VcsRoot original, String branchName) {
-    VcsRootImpl result = new VcsRootImpl(original.getId(), original.getProperties());
-    result.addProperty(Constants.BRANCH_NAME_PROP, branchName);
-    return result;
-  }
 }