diff options
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java index d92adfe370..7634957eb2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java @@ -66,6 +66,7 @@ import org.eclipse.jgit.lib.ProgressMonitor; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.RepositoryState; +import org.eclipse.jgit.merge.MergeStrategy; import org.eclipse.jgit.transport.FetchResult; /** @@ -86,6 +87,8 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> { private String remoteBranchName; + private MergeStrategy strategy = MergeStrategy.RECURSIVE; + private enum PullRebaseMode { USE_CONFIG, REBASE, @@ -299,13 +302,14 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> { if (doRebase) { RebaseCommand rebase = new RebaseCommand(repo); RebaseResult rebaseRes = rebase.setUpstream(commitToMerge) - .setUpstreamName(upstreamName) - .setProgressMonitor(monitor).setOperation(Operation.BEGIN) + .setUpstreamName(upstreamName).setProgressMonitor(monitor) + .setOperation(Operation.BEGIN).setStrategy(strategy) .call(); result = new PullResult(fetchRes, remote, rebaseRes); } else { MergeCommand merge = new MergeCommand(repo); merge.include(upstreamName, commitToMerge); + merge.setStrategy(strategy); MergeResult mergeRes = merge.call(); monitor.update(1); result = new PullResult(fetchRes, remote, mergeRes); @@ -363,4 +367,15 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> { public String getRemoteBranchName() { return remoteBranchName; } + + /** + * @param strategy + * The merge strategy to use during this pull operation. + * @return {@code this} + * @since 3.4 + */ + public PullCommand setStrategy(MergeStrategy strategy) { + this.strategy = strategy; + return this; + } } |