Mercurial > hg > mercurial
view mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/MergeCommand.java @ 674:61da07eceaa1
add more tests for fetchModificationInfo, simplified code
author | eugene.petrenko@gmail.com |
---|---|
date | Fri, 15 Nov 2013 13:28:45 +0100 |
parents | 3cc513b9e3c1 |
children | 31a1aca3305c |
line wrap: on
line source
package jetbrains.buildServer.buildTriggers.vcs.mercurial.command; import jetbrains.buildServer.buildTriggers.vcs.mercurial.command.exception.MergeConflictException; import jetbrains.buildServer.vcs.VcsException; import org.jetbrains.annotations.NotNull; import java.io.File; public class MergeCommand extends BaseCommand { private String myMergeTool; private String myRevision; public MergeCommand(@NotNull CommandSettings commandSettings, @NotNull String hgPath, @NotNull File workingDir) { super(commandSettings, hgPath, workingDir); } public MergeCommand revision(@NotNull String revision) { myRevision = revision; return this; } public MergeCommand withMergeTool(@NotNull String mergeTool) { myMergeTool = mergeTool; return this; } public void call() throws VcsException { MercurialCommandLine cmd = createCommandLine(); cmd.addParameter("merge"); if (myRevision != null) cmd.addParameters("-r", myRevision); if (myMergeTool != null) cmd.addParameters("--tool", myMergeTool); CommandResult result = runCommand(cmd); if (result.getExitCode() == 1) throw new MergeConflictException(); } }