[CLI] Use Oomph 1.0.0 release update site
Change latest oomph update site for release update site
Fix compilation unit problems about CherryPick.
Update tests.
Change-Id: I1b4a70d59754ab8fdb17861cc1a756485422ebd7
Signed-off-by: Axel Richard <axel.richard@obeo.fr>
diff --git a/org.eclipse.emf.compare.git.pgm-parent/targetPlatforms/org.eclipse.emf.compare.git.pgm.target b/org.eclipse.emf.compare.git.pgm-parent/targetPlatforms/org.eclipse.emf.compare.git.pgm.target
index c66b157..893e046 100644
--- a/org.eclipse.emf.compare.git.pgm-parent/targetPlatforms/org.eclipse.emf.compare.git.pgm.target
+++ b/org.eclipse.emf.compare.git.pgm-parent/targetPlatforms/org.eclipse.emf.compare.git.pgm.target
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->
-<target name="EMF Compare Git PGM target platform" sequenceNumber="1417430430">
+<target name="EMF Compare Git PGM target platform" sequenceNumber="1421847867">
<locations>
<location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
<unit id="org.eclipse.emf.compare.rcp.ui.feature.group" version="0.0.0"/>
@@ -34,7 +34,7 @@
<unit id="org.eclipse.oomph.setup.projects.feature.group" version="0.0.0"/>
<unit id="org.eclipse.oomph.setup.projectset.feature.group" version="0.0.0"/>
<unit id="org.eclipse.oomph.setup.workingsets.feature.group" version="0.0.0"/>
- <repository location="http://download.eclipse.org/oomph/updates/latest"/>
+ <repository location="http://download.eclipse.org/oomph/updates/release"/>
</location>
<location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
<unit id="org.eclipse.egit.source.feature.group" version="0.0.0"/>
diff --git a/org.eclipse.emf.compare.git.pgm-parent/targetPlatforms/org.eclipse.emf.compare.git.pgm.tpd b/org.eclipse.emf.compare.git.pgm-parent/targetPlatforms/org.eclipse.emf.compare.git.pgm.tpd
index 4d98446..d717331 100644
--- a/org.eclipse.emf.compare.git.pgm-parent/targetPlatforms/org.eclipse.emf.compare.git.pgm.tpd
+++ b/org.eclipse.emf.compare.git.pgm-parent/targetPlatforms/org.eclipse.emf.compare.git.pgm.tpd
@@ -22,7 +22,7 @@
org.eclipse.gmf.runtime.notation.sdk.feature.group lazy
}
-location "http://download.eclipse.org/oomph/updates/latest" {
+location "http://download.eclipse.org/oomph/updates/release" {
org.eclipse.oomph.util lazy
org.eclipse.oomph.p2.feature.group lazy
org.eclipse.oomph.preferences.feature.group lazy
diff --git a/plugins/org.eclipse.emf.compare.git.pgm.tests/model/lunaIntegrationTest.setup b/plugins/org.eclipse.emf.compare.git.pgm.tests/model/lunaIntegrationTest.setup
index cf19541..8c56881 100644
--- a/plugins/org.eclipse.emf.compare.git.pgm.tests/model/lunaIntegrationTest.setup
+++ b/plugins/org.eclipse.emf.compare.git.pgm.tests/model/lunaIntegrationTest.setup
@@ -55,7 +55,7 @@
<repository
url="http://download.eclipse.org/modeling/emf/emf/updates/2.10.x"/>
<repository
- url="http://download.eclipse.org/oomph/updates/latest"/>
+ url="http://download.eclipse.org/oomph/updates/release"/>
<repository
url="http://download.eclipse.org/modeling/emf/compare/updates/nightly/latest"/>
<repository
diff --git a/plugins/org.eclipse.emf.compare.git.pgm.tests/src/org/eclipse/emf/compare/git/pgm/internal/app/CherryPickApplicationTest.java b/plugins/org.eclipse.emf.compare.git.pgm.tests/src/org/eclipse/emf/compare/git/pgm/internal/app/CherryPickApplicationTest.java
index a6ae7f4..827b414 100644
--- a/plugins/org.eclipse.emf.compare.git.pgm.tests/src/org/eclipse/emf/compare/git/pgm/internal/app/CherryPickApplicationTest.java
+++ b/plugins/org.eclipse.emf.compare.git.pgm.tests/src/org/eclipse/emf/compare/git/pgm/internal/app/CherryPickApplicationTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Obeo.
+ * Copyright (c) 2014, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,22 +13,16 @@
import static org.eclipse.emf.compare.git.pgm.internal.app.data.ContextSetup.LYRICS_1;
import static org.eclipse.emf.compare.git.pgm.internal.util.EMFCompareGitPGMUtil.EOL;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import java.nio.file.Path;
-import java.util.List;
-import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.emf.compare.git.pgm.Returns;
import org.eclipse.emf.compare.git.pgm.internal.app.data.ContextSetup;
-import org.eclipse.emf.compare.git.pgm.util.ProjectBuilder;
import org.eclipse.equinox.app.IApplication;
-import org.eclipse.jgit.revwalk.RevCommit;
import org.junit.Test;
/**
@@ -43,268 +37,6 @@
/**
* <p>
- * This use case aims to test a logical cherry-pick on a model with successive conflicts.
- * </p>
- * <p>
- * History see {@link ContextSetup#setupCHE002()}
- * </p>
- * <h3>Operation</h3>
- * <ul>
- * <li> <code> logicalcherry-pick branch_c branch_d </code></li>
- * <li> <code> logicalmergetool (mocks conflict resolution)</code></li>
- * <li> <code> logicalcherry-pick --continue </code></li>
- * <li> <code> logicalmergetool (mocks conflict resolution)</code></li>
- * <li> <code> logicalcherry-pick --continue </code></li>
- * </ul>
- *
- * @throws Exception
- */
- @Test
- public void testCHE002() throws Exception {
- contextSetup = new ContextSetup(getGit(), getTestTmpFolder());
- contextSetup.setupCHE002();
- runCherryPick(Returns.ABORTED, "branch_c", "branch_d");
-
- assertOutputMessageEnd(getExpectedConflictMessage("[" + getShortId("branch_c") + "]... Delete C1"));
-
- assertNoConflitMarker(contextSetup.getProjectPath().resolve("model.uml"), contextSetup
- .getProjectPath().resolve("model.notation"));
-
- // Resolves conflits
- new ProjectBuilder(this) //
- .clean(true) //
- .addContentToCopy("data/conflicts/CHE002/conflict/resolution1/model.di")//
- .addContentToCopy("data/conflicts/CHE002/conflict/resolution1/model.uml") //
- .addContentToCopy("data/conflicts/CHE002/conflict/resolution1/model.notation") //
- .create(contextSetup.getProjectPath());
-
- getGit().add().addFilepattern(".").call(); //$NON-NLS-1$
-
- runContinue(Returns.ABORTED);
-
- assertOutputMessageEnd(getExpectedConflictMessage("[" + getShortId("branch_d") + "]... Delete C2",
- "[" + getShortId("HEAD") + "] Delete C1"));
-
- // Resolves conflicts
- new ProjectBuilder(this) //
- .clean(true) //
- .addContentToCopy("data/conflicts/CHE002/conflict/resolution2/model.di")//
- .addContentToCopy("data/conflicts/CHE002/conflict/resolution2/model.uml") //
- .addContentToCopy("data/conflicts/CHE002/conflict/resolution2/model.notation") //
- .create(contextSetup.getProjectPath());
-
- getGit().add().addFilepattern(".").call(); //$NON-NLS-1$
-
- runContinue(Returns.COMPLETE);
-
- assertOutputMessageEnd(getCompleteMessage("[" + getShortId("HEAD") + "] Delete C2"));
-
- List<RevCommit> revCommits = Lists.newArrayList(getGit().log().setMaxCount(3).add(getHeadCommit())
- .call());
- assertEquals("Delete C2", revCommits.get(0).getShortMessage());
- assertEquals("Delete C1", revCommits.get(1).getShortMessage());
- assertEquals("Adds Attr1 to C1 and adds Attr2 to C2", revCommits.get(2).getShortMessage());
- }
-
- /**
- * <p>
- * This use case aims to test a logical cherry-pick on a model with successive conflicts. The resolution
- * of the second conflict finishes with the exact same model that was in the index before the cherry pick.
- * In this case the user is expected to use the command --quit.
- * </p>
- * <p>
- * History see {@link ContextSetup#setupCHE002()}
- * </p>
- * <h3>Operation</h3>
- * <ul>
- * <li> <code> logicalcherry-pick branch_c branch_d </code></li>
- * <li> <code> logicalmergetool (mocks conflict resolution)</code></li>
- * <li> <code> logicalcherry-pick --continue </code></li>
- * <li> <code> logicalmergetool (mocks conflict resolution)</code></li>
- * <li> <code> logicalcherry-pick --quit </code></li>
- * </ul>
- *
- * @throws Exception
- */
- @Test
- public void testCHE002_nothingToCommit() throws Exception {
- contextSetup = new ContextSetup(getGit(), getTestTmpFolder());
- contextSetup.setupCHE002();
- runCherryPick(Returns.ABORTED, "branch_c", "branch_d");
-
- assertOutputMessageEnd(getExpectedConflictMessage("[" + getShortId("branch_c") + "]... Delete C1"));
-
- assertNoConflitMarker(contextSetup.getProjectPath().resolve("model.uml"), contextSetup
- .getProjectPath().resolve("model.notation"));
-
- // Resolve conflicts
- new ProjectBuilder(this) //
- .clean(true) //
- .addContentToCopy("data/conflicts/CHE002/conflict/resolution1/model.di")//
- .addContentToCopy("data/conflicts/CHE002/conflict/resolution1/model.uml") //
- .addContentToCopy("data/conflicts/CHE002/conflict/resolution1/model.notation") //
- .create(contextSetup.getProjectPath());
-
- getGit().add().addFilepattern(".").call(); //$NON-NLS-1$
-
- runContinue(Returns.ABORTED);
-
- assertOutputMessageEnd(getExpectedConflictMessage("[" + getShortId("branch_d") + "]... Delete C2",
- "[" + getShortId("HEAD") + "] Delete C1"));
-
- // Resolve conflicts by reverting changes to previsous version
- new ProjectBuilder(this) //
- .clean(true) //
- .addContentToCopy("data/conflicts/CHE002/conflict/resolution1/model.di")//
- .addContentToCopy("data/conflicts/CHE002/conflict/resolution1/model.uml") //
- .addContentToCopy("data/conflicts/CHE002/conflict/resolution1/model.notation") //
- .create(contextSetup.getProjectPath());
-
- getGit().add().addFilepattern(".").call(); //$NON-NLS-1$
-
- runContinue(Returns.ABORTED);
-
- String expected = "No changes detected" + EOL;
- expected += EOL;
- expected += "If there is nothing left to stage, chances are that something" + EOL;
- expected += "else already introduced the same changes; you might want to skip" + EOL;
- expected += "this patch using git logicalcherry-pick --quit" + EOL + EOL;
-
- assertOutputMessageEnd(expected);
-
- runQuit(Returns.COMPLETE);
-
- assertOutputMessageEnd("Complete." + EOL);
-
- List<RevCommit> revCommits = Lists.newArrayList(getGit().log().setMaxCount(2).add(getHeadCommit())
- .call());
- assertEquals("Delete C1", revCommits.get(0).getShortMessage());
- assertEquals("Adds Attr1 to C1 and adds Attr2 to C2", revCommits.get(1).getShortMessage());
- }
-
- /**
- * <p>
- * This use case aims to test a logical cherry-pick on a model with successive conflicts. In this test the
- * user use the --abort option.
- * </p>
- * <p>
- * History see {@link ContextSetup#setupCHE002()}
- * </p>
- * <h3>Operation</h3>
- * <ul>
- * <li> <code> logicalcherry-pick branch_c branch_d </code></li>
- * <li> <code> logicalcherry-pick --abort </code></li>
- * </ul>
- *
- * @throws Exception
- */
- @Test
- public void testCHE002_aborted() throws Exception {
- contextSetup = new ContextSetup(getGit(), getTestTmpFolder());
- contextSetup.setupCHE002();
- String previousHead = getShortId("HEAD");
-
- runCherryPick(Returns.ABORTED, "branch_c", "branch_d");
-
- assertOutputMessageEnd(getExpectedConflictMessage("[" + getShortId("branch_c") + "]... Delete C1"));
-
- assertNoConflitMarker(contextSetup.getProjectPath().resolve("model.uml"), contextSetup
- .getProjectPath().resolve("model.notation"));
-
- runAbort(Returns.ABORTED);
-
- assertTrue("The repository should be clean", getGit().status().call().isClean());
-
- assertEquals(getShortId("HEAD"), previousHead);
-
- assertOutputMessageEnd("Aborted." + EOL);
- }
-
- /**
- * <p>
- * This use case aims to test a logical cherry-pick on a model with successive conflicts.In this test the
- * user use the --quit option.
- * </p>
- * <p>
- * History see {@link ContextSetup#setupCHE002()}
- * </p>
- * <h3>Operation</h3>
- * <ul>
- * <li> <code> logicalcherry-pick branch_c branch_d </code></li>
- * <li> <code> logicalcherry-pick --quit </code></li>
- * </ul>
- *
- * @throws Exception
- */
- @Test
- public void testCHE002_quit() throws Exception {
- contextSetup = new ContextSetup(getGit(), getTestTmpFolder());
- contextSetup.setupCHE002();
- runCherryPick(Returns.ABORTED, "branch_c", "branch_d");
-
- assertOutputMessageEnd(getExpectedConflictMessage("[" + getShortId("branch_c") + "]... Delete C1"));
-
- assertNoConflitMarker(contextSetup.getProjectPath().resolve("model.uml"), contextSetup
- .getProjectPath().resolve("model.notation"));
-
- // Resolve conflicts
- new ProjectBuilder(this) //
- .clean(true) //
- .addContentToCopy("data/conflicts/CHE002/conflict/resolution1/model.di")//
- .addContentToCopy("data/conflicts/CHE002/conflict/resolution1/model.uml") //
- .addContentToCopy("data/conflicts/CHE002/conflict/resolution1/model.notation") //
- .create(contextSetup.getProjectPath());
-
- getGit().add().addFilepattern(".").call(); //$NON-NLS-1$
-
- runQuit(Returns.ABORTED);
-
- // Expects second conflict
- assertOutputMessageEnd(getExpectedConflictMessage("[" + getShortId("branch_d") + "]... Delete C2"));
- }
-
- /**
- * <p>
- * This use case aims to test a logical cherry-pick on a model with no conflict (Auto merging should
- * succeed). It also aims to test to cherry pick a commit using both its id and the name of the matching
- * branch.
- * </p>
- * <p>
- * History see {@link ContextSetup#setupCHE003()}
- * </p>
- * <h3>Operation</h3>
- * <ul>
- * <li><code> logicalcherry-pick branch_c branch_d </code></li>
- * </ul>
- *
- * @throws Exception
- */
- @Test
- public void testCHE003() throws Exception {
- contextSetup = new ContextSetup(getGit(), getTestTmpFolder());
- contextSetup.setupCHE003();
-
- runCherryPick(Returns.COMPLETE, getShortId("branch_c")// uses commit id
- , "branch_d"/* uses branch name */);
-
- assertOutputMessageEnd(getCompleteMessage("[" + getShortId("HEAD") + "] Adds class 3",//
- "[" + getShortId("HEAD~1") + "] Adds class 2"));
-
- final String class1URIFragment = "_bB2fYC3HEeSN_5D5iyrZGQ";
- final String class2URIFragment = "_hfIr4C3HEeSN_5D5iyrZGQ";
- final String class3URIFragment = "_aDUsIGWiEeSuO4qBAOfkWA";
- assertExistInResource(contextSetup.getProjectPath().resolve("model.uml"), class1URIFragment,
- class2URIFragment, class3URIFragment);
-
- final String class2ShapeURIFragment = "_hfJS8C3HEeSN_5D5iyrZGQ";
- final String class1ShapeURIFragment = "_bB3tgC3HEeSN_5D5iyrZGQ";
- final String class3ShapeURIFragement = "_aGWK8GWiEeSuO4qBAOfkWA";
- assertExistInResource(contextSetup.getProjectPath().resolve("model.notation"),
- class1ShapeURIFragment, class2ShapeURIFragment, class3ShapeURIFragement);
- }
-
- /**
- * <p>
* Tests the "up to date" use case.
* </p>
* <p>
@@ -323,8 +55,7 @@
contextSetup.setupCHE003();
runCherryPick(Returns.COMPLETE, "branch_b");
- assertOutputMessageEnd("Fast forward." + EOL + EOL);
-
+ assertOutputMessageEnd(getCompleteMessage("[" + getShortId("HEAD") + "] Adds class 1"));
}
/**
@@ -371,59 +102,6 @@
}
/**
- * <h3>Test CHER006</h3>
- * <p>
- * Test no conflicting cherry-pick on fragmented model.
- * </p>
- * <p>
- * History see {@link ContextSetup#setupCHE006()}
- * </p>
- *
- * @throws Exception
- */
- @Test
- public void testCHE006() throws Exception {
- contextSetup = new ContextSetup(getGit(), getTestTmpFolder());
- contextSetup.setupCHE006();
- runCherryPick(Returns.ABORTED, "branch_c", "branch_d");
-
- assertNoConflitMarker(contextSetup.getProjectPath().resolve("model.uml"), contextSetup
- .getProjectPath().resolve("model.notation"), contextSetup.getProjectPath().resolve(
- "model2.uml"), contextSetup.getProjectPath().resolve("model2.notation"));
-
- assertOutputMessageEnd(getExpectedConflictMessage("[" + getShortId("branch_c") + "]... Delete Class1"));
-
- Set<String> expectedConflictingFilePath = Sets
- .newHashSet("MER006/model.uml", "MER006/model.notation");
- assertEquals(expectedConflictingFilePath, getGit().status().call().getConflicting());
-
- // Resolve conflicts
- new ProjectBuilder(this) //
- .clean(true) //
- .addContentToCopy("data/conflicts/MER006/conflict/resolution1/model.di")//
- .addContentToCopy("data/conflicts/MER006/conflict/resolution1/model.uml") //
- .addContentToCopy("data/conflicts/MER006/conflict/resolution1/model.notation") //
- .create(contextSetup.getProjectPath());
-
- getGit().add().addFilepattern(".").call(); //$NON-NLS-1$
-
- runContinue(Returns.ABORTED);
-
- assertOutputMessageEnd(getExpectedConflictMessage(
- "[" + getShortId("branch_d") + "]... Delete Class2", //
- "[" + getShortId("HEAD") + "] Delete Class1"));
-
- expectedConflictingFilePath = Sets.newHashSet("MER006/model2.uml", "MER006/model2.notation");
- assertEquals(expectedConflictingFilePath, getGit().status().call().getConflicting());
-
- // Resolves conflicts
- getGit().add().addFilepattern(".").call(); //$NON-NLS-1$
-
- runContinue(Returns.COMPLETE);
-
- }
-
- /**
* <h3>Test CHE007</h3>
* <p>
* Successive conflicts on multiple models in multiple files (one file per model).
@@ -517,7 +195,8 @@
runCherryPick(Returns.ABORTED, "branch_b");
assertOutputMessageEnd(getExpectedConflictMessage("[" + getShortId("branch_b")
- + "]... Moves C1 to P2"));
+ + "]... Moves C1 to P2", null)
+ + EOL);
// Checks that the expected file are marked as conflicting
assertEquals(Sets.newHashSet("REB011/model.notation", "REB011/model.uml"), getGit().status().call()
@@ -589,63 +268,33 @@
assertEquals(1, projectInWorkspace.length);
}
- private void runCherryPick(Returns expectedReturnCode, String... commitsToCherryPick) throws Exception {
+ private void runCherryPick(Returns expectedReturnCode, String commitToCherryPick) throws Exception {
resetContext();
getContext().addArg(getRepositoryPath().resolve(".git").toString(),
contextSetup.getUserSetupFile().getAbsolutePath(), "--show-stack-trace");
- getContext().addArg(commitsToCherryPick);
+ getContext().addArg(commitToCherryPick);
runCommand(expectedReturnCode);
}
- private void runContinue(Returns expectedReturnCode) throws Exception {
- resetContext();
- getContext().addArg(getRepositoryPath().resolve(".git").toString(),
- contextSetup.getUserSetupFile().getAbsolutePath(), "--show-stack-trace", "--continue");
- runCommand(expectedReturnCode);
-
- }
-
- private void runQuit(Returns expectedReturnCode) throws Exception {
- resetContext();
- getContext().addArg(getRepositoryPath().resolve(".git").toString(),
- contextSetup.getUserSetupFile().getAbsolutePath(), "--show-stack-trace", "--quit");
- runCommand(expectedReturnCode);
- }
-
- private void runAbort(Returns expectedReturnCode) throws Exception {
- resetContext();
- getContext().addArg(getRepositoryPath().resolve(".git").toString(),
- contextSetup.getUserSetupFile().getAbsolutePath(), "--show-stack-trace", "--abort");
- runCommand(expectedReturnCode);
- }
-
- private String getExpectedConflictMessage(String conflictingCommitMessage,
- String... successfulCommitMessages) {
+ private String getExpectedConflictMessage(String conflictingCommitMessage, String successfulCommitMessage) {
String expected = "";
- if (successfulCommitMessages.length > 0) {
- expected += "The following revisions were successfully cherry-picked:" + EOL;
- for (String successfull : successfulCommitMessages) {
- expected += " " + successfull + EOL;
- }
+ if (successfulCommitMessage != null) {
+ expected += "The following revision was successfully cherry-picked:" + EOL;
+ expected += " " + successfulCommitMessage + EOL;
}
expected += "error: Could not apply " + conflictingCommitMessage + EOL;
expected += "hint: to resolve the conflict use git logicalmergetool command." + EOL;
expected += "hint: After resolving the conflicts, mark the corrected paths" + EOL;
expected += "hint: by adding them to the index (Team > Add to index) or" + EOL;
expected += "hint: by removing them from the index (Team > Remove from index)." + EOL;
- expected += "hint: Do NOT commit, use one of the following commands instead" + EOL;
- expected += "hint: git logicalcherry-pick --continue : to continue the cherry pick" + EOL;
- expected += "hint: git logicalcherry-pick --abort : to abort the cherry pick" + EOL;
- expected += "hint: git logicalcherry-pick --quit : to skip this commit" + EOL + EOL;
+ expected += "hint: Then DO commit." + EOL;
return expected;
}
- private String getCompleteMessage(String... successfulCommits) {
- String expected = "The following revisions were successfully cherry-picked:" + EOL;
- for (String success : successfulCommits) {
- expected += " " + success + EOL;
- }
+ private String getCompleteMessage(String successfulCommit) {
+ String expected = "The following revision was successfully cherry-picked:" + EOL;
+ expected += " " + successfulCommit + EOL;
expected += "Complete." + EOL;
return expected;
}
diff --git a/plugins/org.eclipse.emf.compare.git.pgm.tests/src/org/eclipse/emf/compare/git/pgm/internal/cmd/CherryPickArgumentsTest.java b/plugins/org.eclipse.emf.compare.git.pgm.tests/src/org/eclipse/emf/compare/git/pgm/internal/cmd/CherryPickArgumentsTest.java
index 0927bed..d5e73c2 100644
--- a/plugins/org.eclipse.emf.compare.git.pgm.tests/src/org/eclipse/emf/compare/git/pgm/internal/cmd/CherryPickArgumentsTest.java
+++ b/plugins/org.eclipse.emf.compare.git.pgm.tests/src/org/eclipse/emf/compare/git/pgm/internal/cmd/CherryPickArgumentsTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Obeo.
+ * Copyright (c) 2014, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,14 +18,10 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.FileAttribute;
-import java.util.List;
import org.eclipse.emf.compare.git.pgm.Returns;
import org.eclipse.emf.compare.git.pgm.util.OomphUserModelBuilder;
import org.eclipse.emf.compare.git.pgm.util.ProjectBuilder;
-import org.eclipse.jgit.api.RebaseCommand.InteractiveHandler;
-import org.eclipse.jgit.api.RebaseCommand.Operation;
-import org.eclipse.jgit.lib.RebaseTodoLine;
import org.eclipse.jgit.revwalk.RevCommit;
import org.junit.Test;
@@ -46,17 +42,14 @@
protected String getExpectedUsage() {
//@formatter:off
- String usage = "logicalcherry-pick <setup> [<commit> ...] [--abort] [--continue] [--debug (-d)] [--git-dir gitFolderPath] [--help (-h)] [--quit] [--show-stack-trace]" + EOL;
+ String usage = "logicalcherry-pick <setup> <commit> [--debug (-d)] [--git-dir gitFolderPath] [--help (-h)] [--show-stack-trace]" + EOL;
usage += EOL;
usage += " <setup> : Path to the setup file. The setup file is a Oomph" + EOL;
usage += " model." +EOL;
- usage += " <commit> : Commit IDs to cherry pick." + EOL;
- usage += " --abort : Use this option to abort a in going cherry-pick" + EOL;
- usage += " --continue : Use this option to continue a in going cherry-pick" + EOL;
+ usage += " <commit> : Commit ID to cherry pick." + EOL;
usage += " --debug (-d) : Launches the provisionned eclipse in debug mode." + EOL;
usage += " --git-dir gitFolderPath : Path to the .git folder of your repository."+ EOL;
usage += " --help (-h) : Dispays help for this command." + EOL;
- usage += " --quit : Use this option to quit a in going cherry-pick" + EOL;
usage += " --show-stack-trace : Use this option to display java stack trace in" + EOL;
usage += " console on error." + EOL;
usage += EOL;
@@ -202,7 +195,7 @@
addAllAndCommit("First commit");
// Tests referencing a commit using the name of a branch
- getContext().addArg(getCommandName(), newSetupFile.getAbsolutePath(), "master", "extraArg");
+ getContext().addArg(getCommandName(), newSetupFile.getAbsolutePath(), "extraArg");
Object result = getApp().start(getContext());
String expectedOut = "fatal: bad revision 'extraArg'." + EOL; //
assertOutput(expectedOut);
@@ -211,109 +204,6 @@
}
@Test
- public void testProcessOptions() throws Exception {
- File newSetupFile = setUp();
-
- // Creates some content for the first commit.
- new ProjectBuilder(this) //
- .create(getRepositoryPath().resolve("EmptyProject"));
-
- RevCommit initialCommit = addAllAndCommit("First commit");
-
- // Tests each of the three options --continue --abort --quit while the repository is not curently
- // rebasing
- getContext().addArg(getCommandName(), newSetupFile.getAbsolutePath(), "--continue");
-
- Object result = getApp().start(getContext());
- assertOutput("fatal: No current cherry-picking." + EOL);
-
- assertEmptyErrorMessage();
- assertEquals(Returns.ERROR.code(), result);
-
- resetApp();
- resetContext();
- getContext().addArg(getCommandName(), newSetupFile.getAbsolutePath(), "--abort");
-
- result = getApp().start(getContext());
- assertOutput("fatal: No current cherry-picking." + EOL);
-
- assertEmptyErrorMessage();
- assertEquals(Returns.ERROR.code(), result);
-
- resetApp();
- resetContext();
- getContext().addArg(getCommandName(), newSetupFile.getAbsolutePath(), "--quit");
-
- result = getApp().start(getContext());
- assertOutput("fatal: No current cherry-picking." + EOL);
-
- assertEmptyErrorMessage();
- assertEquals(Returns.ERROR.code(), result);
-
- // Makes the repository in a rebasing state
- getGit().rebase().setOperation(Operation.BEGIN).setUpstream("HEAD").runInteractively(
- new InteractiveHandler() {
-
- public void prepareSteps(List<RebaseTodoLine> steps) {
- }
-
- public String modifyCommitMessage(String commit) {
- return commit;
- }
- }, true).call();
-
- // Tests one option plus the commit parameter
- resetApp();
- resetContext();
- getContext().addArg(getCommandName(), newSetupFile.getAbsolutePath(), "--quit",
- initialCommit.getId().name());
-
- result = getApp().start(getContext());
- String expected = "fatal: We are currently cherry-picking commits. Please use one of the following options:"
- + EOL;
- expected += "\t--continue" + EOL;
- expected += "\t--abort" + EOL;
- expected += "\t--quit" + EOL + EOL;
- assertOutput(expected);
-
- assertEmptyErrorMessage();
- assertEquals(Returns.ERROR.code(), result);
-
- // Tests using two options
- resetApp();
- resetContext();
- getContext().addArg(getCommandName(), newSetupFile.getAbsolutePath(), "--quit", "--continue");
- result = getApp().start(getContext());
-
- assertOutput("fatal: logical cherry-pick: --quit cannot be used with --continue" + EOL);
-
- assertEmptyErrorMessage();
- assertEquals(Returns.ERROR.code(), result);
-
- resetApp();
- resetContext();
- getContext().addArg(getCommandName(), newSetupFile.getAbsolutePath(), "--quit", "--abort");
- result = getApp().start(getContext());
-
- assertOutput("fatal: logical cherry-pick: --quit cannot be used with --abort" + EOL);
-
- assertEmptyErrorMessage();
- assertEquals(Returns.ERROR.code(), result);
-
- resetApp();
- resetContext();
- getContext().addArg(getCommandName(), newSetupFile.getAbsolutePath(), "--abort", "--continue");
- result = getApp().start(getContext());
-
- assertOutput("fatal: logical cherry-pick: --continue cannot be used with --abort" + EOL);
-
- assertEmptyErrorMessage();
- assertEquals(Returns.ERROR.code(), result);
- }
-
- // TODO test --continue with unresolved conflict
-
- @Test
public void validRepoTestIncorrectGitDirArg() throws Exception {
// Sets context to be sure were are not in a git repository
setCmdLocation(getTestTmpFolder().toString());
diff --git a/plugins/org.eclipse.emf.compare.git.pgm/model/kepler.setup b/plugins/org.eclipse.emf.compare.git.pgm/model/kepler.setup
index dbd5fcb..b317f5e 100644
--- a/plugins/org.eclipse.emf.compare.git.pgm/model/kepler.setup
+++ b/plugins/org.eclipse.emf.compare.git.pgm/model/kepler.setup
@@ -57,7 +57,7 @@
<repository
url="http://download.eclipse.org/modeling/emf/emf/updates/2.10/core/R201405190339"/>
<repository
- url="http://download.eclipse.org/oomph/updates/latest"/>
+ url="http://download.eclipse.org/oomph/updates/release"/>
<repository
url="http://download.eclipse.org/modeling/emf/compare/updates/nightly/latest"/>
<repository
diff --git a/plugins/org.eclipse.emf.compare.git.pgm/model/luna.setup b/plugins/org.eclipse.emf.compare.git.pgm/model/luna.setup
index 0a62e2a..f23b511 100644
--- a/plugins/org.eclipse.emf.compare.git.pgm/model/luna.setup
+++ b/plugins/org.eclipse.emf.compare.git.pgm/model/luna.setup
@@ -57,7 +57,7 @@
<repository
url="http://download.eclipse.org/modeling/emf/emf/updates/2.10.x"/>
<repository
- url="http://download.eclipse.org/oomph/updates/latest"/>
+ url="http://download.eclipse.org/oomph/updates/release"/>
<repository
url="http://download.eclipse.org/modeling/emf/compare/updates/nightly/latest"/>
<repository
diff --git a/plugins/org.eclipse.emf.compare.git.pgm/src/org/eclipse/emf/compare/git/pgm/internal/app/CherryPickApplication.java b/plugins/org.eclipse.emf.compare.git.pgm/src/org/eclipse/emf/compare/git/pgm/internal/app/CherryPickApplication.java
index 1772f3b..ada1199 100644
--- a/plugins/org.eclipse.emf.compare.git.pgm/src/org/eclipse/emf/compare/git/pgm/internal/app/CherryPickApplication.java
+++ b/plugins/org.eclipse.emf.compare.git.pgm/src/org/eclipse/emf/compare/git/pgm/internal/app/CherryPickApplication.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Obeo.
+ * Copyright (c) 2014, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,26 +18,24 @@
import static org.eclipse.emf.compare.git.pgm.internal.util.GitUtils.getOneLineCommitMsg;
import java.io.IOException;
-import java.util.Collections;
import java.util.List;
+import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.egit.core.op.CherryPickOperation;
-import org.eclipse.egit.core.op.RebaseOperation;
import org.eclipse.emf.compare.git.pgm.Returns;
import org.eclipse.emf.compare.git.pgm.internal.args.RevCommitHandler;
import org.eclipse.emf.compare.git.pgm.internal.exception.Die;
import org.eclipse.emf.compare.git.pgm.internal.exception.Die.DeathType;
import org.eclipse.emf.compare.git.pgm.internal.exception.Die.DiesOn;
-import org.eclipse.jgit.api.RebaseCommand.Operation;
-import org.eclipse.jgit.api.RebaseResult;
+import org.eclipse.jgit.api.CherryPickResult;
import org.eclipse.jgit.errors.RevisionSyntaxException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
+import org.eclipse.jgit.merge.ResolveMerger.MergeFailureReason;
import org.eclipse.jgit.revwalk.RevCommit;
import org.kohsuke.args4j.Argument;
-import org.kohsuke.args4j.Option;
/**
* Logical cherry-pick command. <h3>Name</h3>
@@ -46,12 +44,11 @@
* </p>
* <h4>Synopsis</h4>
* <p>
- * logicalcherry-pick <setup> <commit...> [--abort] [--continue] [--quit] [--show-stack-trace]
- * [--git-dir <gitDirectory>]
+ * logicalcherry-pick <setup> <commit> [--show-stack-trace] [--git-dir <gitDirectory>]
* </p>
* <h4>Description</h4>
* <p>
- * The logical cherry-pick is used to cherry-pick one or more revision using logical model.
+ * The logical cherry-pick is used to cherry-pick one revision using logical model.
* </p>
*
* @author <a href="mailto:arthur.daussy@obeo.fr">Arthur Daussy</a>
@@ -59,31 +56,10 @@
@SuppressWarnings({"restriction", "nls" })
public class CherryPickApplication extends AbstractLogicalApplication {
/**
- * Message to display when there is nothing to commit.
+ * Holds {@link RevCommit} that needs to be merged.
*/
- private static final String NOTING_TO_COMMIT_MESSAGE = "No changes detected" + EOL //
- + EOL //
- + "If there is nothing left to stage, chances are that something" + EOL//
- + "else already introduced the same changes; you might want to skip" + EOL//
- + "this patch using git logicalcherry-pick --quit" + EOL;
-
- /**
- * Holds {@link RevCommit}s that need to be merged.
- */
- @Argument(index = 2, required = false, multiValued = true, metaVar = "<commit>", usage = "Commit IDs to cherry pick.", handler = RevCommitHandler.class)
- private List<RevCommit> commits;
-
- /** Continue option. */
- @Option(required = false, name = "--continue", usage = "Use this option to continue a in going cherry-pick")
- private boolean continueOpt;
-
- /** Abort option. */
- @Option(required = false, name = "--abort", usage = "Use this option to abort a in going cherry-pick")
- private boolean abortOpt;
-
- /** Quit option. */
- @Option(required = false, name = "--quit", usage = "Use this option to qui a in going cherry-pick")
- private boolean quitOpt;
+ @Argument(index = 2, required = true, metaVar = "<commit>", usage = "Commit ID to cherry pick.", handler = RevCommitHandler.class)
+ private RevCommit commit;
/** Holds a reference to the HEAD before any operation. */
private ObjectId oldHead;
@@ -95,75 +71,38 @@
} catch (RevisionSyntaxException | IOException e) {
throw new DiesOn(DeathType.ERROR).duedTo(e).displaying(e.getMessage()).ready();
}
- final RebaseResult result;
+ final CherryPickResult result;
try {
- if (!continueOpt && !abortOpt && !quitOpt) {
- result = startCherryPick();
- } else {
- result = processRebaseStep();
- }
+ result = startCherryPick();
waitEgitJobs();
- return handleRebaseResult(result);
+ return handleCherryPickResult(result);
} catch (CoreException | IOException e) {
throw new DiesOn(DeathType.ERROR).duedTo(e).displaying(e.getMessage()).ready();
}
}
/**
- * Processes a rebase step. This method handles one of the following option:
- * <ul>
- * <li>--continue</li>
- * <li>--abort</li>
- * <li>--quit</li>
- * </ul>
+ * Starts to cherry pick commit.
*
- * @return {@link RebaseResult}.
- * @throws CoreException
- * from {@link RebaseOperation#execute(org.eclipse.core.runtime.IProgressMonitor)}
- */
- private RebaseResult processRebaseStep() throws CoreException {
- final RebaseResult result;
- // If one of the option is used then launch a rebase operation
- final Operation op;
- if (abortOpt) {
- op = Operation.ABORT;
- } else if (quitOpt) {
- op = Operation.SKIP;
- } else {
- op = Operation.CONTINUE;
- }
- RebaseOperation rebaseOperation = new RebaseOperation(repo, op);
- rebaseOperation.execute(new NullProgressMonitor());
- result = rebaseOperation.getResult();
- return result;
- }
-
- /**
- * Starts to cherry pick commits.
- *
- * @return {@link RebaseResult}.
+ * @return {@link CherryPickResult}.
* @throws CoreException
* from {@link CherryPickOperation#execute(org.eclipse.core.runtime.IProgressMonitor)}
*/
- private RebaseResult startCherryPick() throws CoreException {
- final RebaseResult result;
- // Cherrypick operation expects commits in reverse order. See thee
- // org.eclipse.jgit.api.RebaseCommand.InteractiveHandler CherrypickOPeration
- Collections.reverse(commits);
-
- CherryPickOperation cherryPickOperation = new CherryPickOperation(repo, commits);
+ private CherryPickResult startCherryPick() throws CoreException {
+ final CherryPickResult result;
+ CherryPickOperation cherryPickOperation = new CherryPickOperation(repo, commit);
cherryPickOperation.execute(new NullProgressMonitor());
result = cherryPickOperation.getResult();
return result;
}
/**
- * Handles the rebase result.
+ * Handles the cherry pick result.
* <p>
* It also prints a message to the user.
* </p>
*
- * @param rebaseResult
+ * @param cherryPickResult
* result to handle.
* @return the return code of this operation.
* @throws Die
@@ -171,53 +110,28 @@
* @throws IOException
* propagates JGit {@link IOException}.
*/
- private Integer handleRebaseResult(RebaseResult rebaseResult) throws Die, IOException {
+ private Integer handleCherryPickResult(CherryPickResult cherryPickResult) throws Die, IOException {
final Integer result;
final String message;
- switch (rebaseResult.getStatus()) {
+ switch (cherryPickResult.getStatus()) {
case OK:
result = Returns.COMPLETE.code();
message = getSuccessfullCherryPickMessage() + "Complete.";
break;
- case FAST_FORWARD:
- // FIXME: Test this use case again after correction of
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=451159
- result = Returns.COMPLETE.code();
- message = "Fast forward." + EOL //
- + getSuccessfullCherryPickMessage();
- break;
- case UP_TO_DATE:
- result = Returns.COMPLETE.code();
- message = "Up to date.";
- break;
- case ABORTED:
- result = Returns.ABORTED.code();
- message = "Aborted.";
- break;
- case NOTHING_TO_COMMIT:
- result = Returns.ABORTED.code();
- message = NOTING_TO_COMMIT_MESSAGE;
- break;
- case STOPPED:
- case CONFLICTS:
+ case CONFLICTING:
// FIXME write the conflict commit message is .git/COMMIT_MSG and propose to the user to
// modify it
result = Returns.ABORTED.code();
- message = getConflictMessage(rebaseResult.getConflicts(), rebaseResult.getCurrentCommit());
+ message = getConflictMessage(cherryPickResult.getFailingPaths());
break;
case FAILED:
result = Returns.ERROR.code();
message = "failed";
break;
- case UNCOMMITTED_CHANGES:// Should never happen since a validation is done before
- // Should never ever happen during cherry pick
- case INTERACTIVE_PREPARED:
- case STASH_APPLY_CONFLICTS:
- case EDIT:
default:
throw new DiesOn(DeathType.ERROR).displaying(
- "Invalid rebase result:" + rebaseResult.getStatus()).ready();
+ "Invalid rebase result:" + cherryPickResult.getStatus()).ready();
}
System.out.println(message);
return result;
@@ -227,40 +141,33 @@
* Gets the message to display in case the rebase result is a
* {@link org.eclipse.jgit.api.RebaseResult.Status#CONFLICTS}.
*
- * @param conflictingFiles
- * List of conflicting files.
- * @param currentCommit
- * {@link RevCommit} where the rebase has stopped.
+ * @param failingPaths
+ * List of failing paths
* @return the message to display.
* @throws IOException
* propagates JGIt exception.
*/
- private String getConflictMessage(List<String> conflictingFiles, RevCommit currentCommit)
- throws IOException {
+ private String getConflictMessage(Map<String, MergeFailureReason> failingPaths) throws IOException {
StringBuilder messageBuilder = new StringBuilder();
- messageBuilder.append(getSuccessfullCherryPickMessage());
- // Displays the list on conflicting files
- if (conflictingFiles != null && !conflictingFiles.isEmpty()) {
+ // Displays the conflicting files
+ if (failingPaths != null && !failingPaths.isEmpty()) {
messageBuilder.append("error: There is some conflicts on the following files:").append(EOL);
- for (String conflictingFile : conflictingFiles) {
+ for (String conflictingFile : failingPaths.keySet()) {
messageBuilder.append(conflictingFile);
}
}
// Prints the hint message to the user
- if (currentCommit != null) {
- String id = currentCommit.abbreviate(SHORT_REV_COMMIT_ID_LENGTH).name();
- String cmMsg = currentCommit.getShortMessage();
+ if (commit != null) {
+ String id = commit.abbreviate(SHORT_REV_COMMIT_ID_LENGTH).name();
+ String cmMsg = commit.getShortMessage();
String msg = "error: Could not apply [" + id + "]... " + cmMsg + EOL;
msg += "hint: to resolve the conflict use git logicalmergetool command." + EOL;
msg += "hint: After resolving the conflicts, mark the corrected paths" + EOL;
msg += "hint: by adding them to the index (Team > Add to index) or" + EOL;
msg += "hint: by removing them from the index (Team > Remove from index)." + EOL;
- msg += "hint: Do NOT commit, use one of the following commands instead" + EOL;
- msg += "hint: git logicalcherry-pick --continue : to continue the cherry pick" + EOL;
- msg += "hint: git logicalcherry-pick --abort : to abort the cherry pick" + EOL;
- msg += "hint: git logicalcherry-pick --quit : to skip this commit" + EOL;
+ msg += "hint: Then DO commit." + EOL;
messageBuilder.append(msg);
}
@@ -269,9 +176,9 @@
}
/**
- * Gets the message that notifies the user of new successfully cherry-picked commits.
+ * Gets the message that notifies the user of new successfully cherry-picked commit.
*
- * @return the message that notifies the user of new successfully cherry-picked commits.
+ * @return the message that notifies the user of new successfully cherry-picked commit.
* @throws IOException
* propagates JGit exception.
*/
@@ -281,9 +188,9 @@
if (successfullCommits != null && !successfullCommits.isEmpty()) {
final String message;
StringBuilder messageBuilder = new StringBuilder();
- messageBuilder.append("The following revisions were successfully cherry-picked:").append(EOL);
- for (RevCommit commit : successfullCommits) {
- messageBuilder.append(TAB).append(getOneLineCommitMsg(commit)).append(EOL);
+ messageBuilder.append("The following revision was successfully cherry-picked:").append(EOL);
+ for (RevCommit successfullCommit : successfullCommits) {
+ messageBuilder.append(TAB).append(getOneLineCommitMsg(successfullCommit)).append(EOL);
}
message = messageBuilder.toString();
return message;
diff --git a/plugins/org.eclipse.emf.compare.git.pgm/src/org/eclipse/emf/compare/git/pgm/internal/cmd/CherryPickCommand.java b/plugins/org.eclipse.emf.compare.git.pgm/src/org/eclipse/emf/compare/git/pgm/internal/cmd/CherryPickCommand.java
index d4b8881..8d30f55 100644
--- a/plugins/org.eclipse.emf.compare.git.pgm/src/org/eclipse/emf/compare/git/pgm/internal/cmd/CherryPickCommand.java
+++ b/plugins/org.eclipse.emf.compare.git.pgm/src/org/eclipse/emf/compare/git/pgm/internal/cmd/CherryPickCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Obeo.
+ * Copyright (c) 2014, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,7 +15,6 @@
import static org.eclipse.emf.compare.git.pgm.internal.util.EMFCompareGitPGMUtil.EOL;
import java.io.IOException;
-import java.util.List;
import org.eclipse.emf.compare.git.pgm.internal.args.RevCommitHandler;
import org.eclipse.emf.compare.git.pgm.internal.args.ValidationStatus;
@@ -38,12 +37,11 @@
* </p>
* <h4>Synopsis</h4>
* <p>
- * logicalcherry-pick <setup> <commit...> [--abort] [--continue] [--quit] [--show-stack-trace]
- * [--git-dir <gitDirectory>]
+ * logicalcherry-pick <setup> <commit> [--show-stack-trace] [--git-dir <gitDirectory>]
* </p>
* <h4>Description</h4>
* <p>
- * The logical cherry-pick is used to cherry-pick one or more revision using logical model.
+ * The logical cherry-pick is used to cherry-pick one revision using logical model.
* </p>
*
* @author <a href="mailto:arthur.daussy@obeo.fr">Arthur Daussy</a>
@@ -68,21 +66,9 @@
/** Tab character. */
private static final String TAB = "\t"; //$NON-NLS-1$
- /** Holds the {@link RevCommit}s that need to be merged. */
- @Argument(index = 1, required = false, multiValued = true, metaVar = "<commit>", usage = "Commit IDs to cherry pick.", handler = RevCommitHandler.class)
- private List<RevCommit> commits;
-
- /** Continue options. */
- @Option(required = false, name = CONTINUE_OPT, usage = "Use this option to continue a in going cherry-pick")
- private boolean continueOpt;
-
- /** Abort option. */
- @Option(required = false, name = ABORT_OPT, usage = "Use this option to abort a in going cherry-pick")
- private boolean abortOpt;
-
- /** Quit option. */
- @Option(required = false, name = QUIT_OPT, usage = "Use this option to quit a in going cherry-pick")
- private boolean quitOpt;
+ /** Holds the {@link RevCommit} that needs to be merged. */
+ @Argument(index = 1, required = true, metaVar = "<commit>", usage = "Commit ID to cherry pick.", handler = RevCommitHandler.class)
+ private RevCommit commit;
/** Option debug. */
@Option(name = "--debug", usage = "Launches the provisionned eclipse in debug mode.", aliases = {"-d" })
@@ -110,17 +96,7 @@
.setRepositoryPath(getRepository().getDirectory().getAbsolutePath())
.showStackTrace(isShowStackTrace());
//@formatter:on
- if (continueOpt) {
- launcher.addAttribute(CONTINUE_OPT);
- } else if (abortOpt) {
- launcher.addAttribute(ABORT_OPT);
- } else if (quitOpt) {
- launcher.addAttribute(QUIT_OPT);
- } else {
- for (RevCommit revCommit : commits) {
- launcher.addAttribute(revCommit.getName());
- }
- }
+ launcher.addAttribute(commit.getName());
return launcher.launch();
@@ -144,11 +120,8 @@
*/
private ValidationStatus checkStartingCherryPickArguments() {
final ValidationStatus result;
- boolean oneOptionSet = abortOpt || quitOpt || continueOpt;
- boolean commitsProvided = commits != null && !commits.isEmpty();
- if (oneOptionSet) {
- result = createErrorStatus("No current cherry-picking.");
- } else if (!commitsProvided) {
+ boolean commitsProvided = commit != null;
+ if (!commitsProvided) {
result = createErrorStatusWithUsage("Argument \"<commit>\" is required");
} else {
try {
@@ -185,24 +158,17 @@
*/
private ValidationStatus checkRebasingCherryPickArgs() {
final ValidationStatus result;
- boolean oneOptionSet = abortOpt || quitOpt || continueOpt;
- boolean commitsProvided = commits != null && !commits.isEmpty();
- if (!oneOptionSet || commitsProvided) {
- String msg = "We are currently cherry-picking commits. Please use one of the following options:"
+ boolean commitsProvided = commit != null;
+ if (commitsProvided) {
+ String msg = "We are currently cherry-picking commit. Please use one of the following options:"
+ EOL;
msg += TAB + CONTINUE_OPT + EOL;
msg += TAB + ABORT_OPT + EOL;
msg += TAB + QUIT_OPT + EOL;
result = createErrorStatus(msg);
- } else if (abortOpt && continueOpt) {
- result = createErrorStatus("logical cherry-pick: --continue cannot be used with --abort");
- } else if (quitOpt && continueOpt) {
- result = createErrorStatus("logical cherry-pick: --quit cannot be used with --continue");
- } else if (quitOpt && abortOpt) {
- result = createErrorStatus("logical cherry-pick: --quit cannot be used with --abort");
} else {
RepositoryState state = getRepository().getRepositoryState();
- if (continueOpt && state == RepositoryState.REBASING_MERGE) {
+ if (state == RepositoryState.REBASING_MERGE) {
StringBuilder msgBuilder = new StringBuilder();
Status status;
try {