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