|
|
|
@ -95,6 +95,8 @@ public class RevertCommand extends GitCommand<RevCommit> {
|
|
|
|
|
|
|
|
|
|
private List<String> unmergedPaths; |
|
|
|
|
|
|
|
|
|
private MergeStrategy strategy = MergeStrategy.RECURSIVE; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param repo |
|
|
|
|
*/ |
|
|
|
@ -160,8 +162,7 @@ public class RevertCommand extends GitCommand<RevCommit> {
|
|
|
|
|
String revertName = srcCommit.getId().abbreviate(7).name() |
|
|
|
|
+ " " + srcCommit.getShortMessage(); //$NON-NLS-1$
|
|
|
|
|
|
|
|
|
|
ResolveMerger merger = (ResolveMerger) MergeStrategy.RECURSIVE |
|
|
|
|
.newMerger(repo); |
|
|
|
|
ResolveMerger merger = (ResolveMerger) strategy.newMerger(repo); |
|
|
|
|
merger.setWorkingTreeIterator(new FileTreeIterator(repo)); |
|
|
|
|
merger.setBase(srcCommit.getTree()); |
|
|
|
|
merger.setCommitNames(new String[] { |
|
|
|
@ -194,15 +195,14 @@ public class RevertCommand extends GitCommand<RevCommit> {
|
|
|
|
|
merger.getBaseCommitId(), |
|
|
|
|
new ObjectId[] { headCommit.getId(), |
|
|
|
|
srcParent.getId() }, |
|
|
|
|
MergeStatus.FAILED, MergeStrategy.RECURSIVE, |
|
|
|
|
MergeStatus.FAILED, strategy, |
|
|
|
|
merger.getMergeResults(), failingPaths, null); |
|
|
|
|
else |
|
|
|
|
failingResult = new MergeResult(null, |
|
|
|
|
merger.getBaseCommitId(), |
|
|
|
|
new ObjectId[] { headCommit.getId(), |
|
|
|
|
srcParent.getId() }, |
|
|
|
|
MergeStatus.CONFLICTING, |
|
|
|
|
MergeStrategy.RECURSIVE, |
|
|
|
|
MergeStatus.CONFLICTING, strategy, |
|
|
|
|
merger.getMergeResults(), failingPaths, null); |
|
|
|
|
if (!merger.failed() && !unmergedPaths.isEmpty()) { |
|
|
|
|
String message = new MergeMessageFormatter() |
|
|
|
@ -301,4 +301,15 @@ public class RevertCommand extends GitCommand<RevCommit> {
|
|
|
|
|
public List<String> getUnmergedPaths() { |
|
|
|
|
return unmergedPaths; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param strategy |
|
|
|
|
* The merge strategy to use during this revert command. |
|
|
|
|
* @return {@code this} |
|
|
|
|
* @since 3.4 |
|
|
|
|
*/ |
|
|
|
|
public RevertCommand setStrategy(MergeStrategy strategy) { |
|
|
|
|
this.strategy = strategy; |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|