view mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/MergeBaseCommand.java @ 719:59a3b5ef91a9

drop legacy
author eugene.petrenko@jetbrains.com
date Mon, 13 Jan 2014 19:42:22 +0100
parents 45f25ca68312
children 31a1aca3305c
line wrap: on
line source
package jetbrains.buildServer.buildTriggers.vcs.mercurial.command;

import jetbrains.buildServer.buildTriggers.vcs.mercurial.HgRepo;
import jetbrains.buildServer.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * Analog of git merge-base. It returns a last common ancestor between two revisions.
 *
 * @author dmitry.neverov
 */
public abstract class MergeBaseCommand {

  protected final HgRepo myRepo;
  protected String myRevision1;
  protected String myRevision2;

  protected MergeBaseCommand(@NotNull HgRepo repo) {
    myRepo = repo;
  }

  public MergeBaseCommand revision1(String revision1) {
    myRevision1 = revision1;
    return this;
  }

  public MergeBaseCommand revision2(String revision2) {
    myRevision2 = revision2;
    return this;
  }

  /**
   * Returns hash of least common ancestor between two revisions or null
   * if common ancestor is not found
   * @return see above
   * @throws VcsException if some commands fail
   */
  @Nullable
  public abstract String call() throws VcsException;

}