public void run(IProgressMonitor mymonitor) throws CoreException {
IProject[] validProjects = ProjectUtil.getValidOpenProjects(repository);
mymonitor.beginTask(NLS.bind(CoreText.MergeOperation_ProgressMerge, refName), 3);
Git git = new Git(repository);
mymonitor.worked(1);
MergeCommand merge = git.merge();
try {
Ref ref = repository.getRef(refName);
if (ref != null)
merge.include(ref);
else
merge.include(ObjectId.fromString(refName));
} catch (IOException e) {
throw new TeamException(CoreText.MergeOperation_InternalError, e);
}
if (fastForwardMode != null)
merge.setFastForward(fastForwardMode);
if (commit != null)
merge.setCommit(commit.booleanValue());
if (squash != null)
merge.setSquash(squash.booleanValue());
if (mergeStrategy != null) {
merge.setStrategy(mergeStrategy);
}
if (message != null)
merge.setMessage(message);
try {
mergeResult = merge.call();
mymonitor.worked(1);
if (MergeResult.MergeStatus.NOT_SUPPORTED.equals(mergeResult.getMergeStatus()))
throw new TeamException(new Status(IStatus.INFO, Activator.getPluginId(), mergeResult.toString()));
} catch (NoHeadException e) {
throw new TeamException(CoreText.MergeOperation_MergeFailedNoHead, e);