use of org.eclipse.jgit.api.CherryPickCommand in project egit by eclipse.
the class CherryPickOperation method execute.
@Override
public void execute(IProgressMonitor m) throws CoreException {
IWorkspaceRunnable action = new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor pm) throws CoreException {
SubMonitor progress = SubMonitor.convert(pm, 2);
progress.subTask(MessageFormat.format(CoreText.CherryPickOperation_cherryPicking, commit.name()));
try (Git git = new Git(repo)) {
CherryPickCommand command = git.cherryPick().include(commit.getId());
MergeStrategy strategy = Activator.getDefault().getPreferredMergeStrategy();
if (strategy != null) {
command.setStrategy(strategy);
}
result = command.call();
} catch (GitAPIException e) {
throw new TeamException(e.getLocalizedMessage(), e.getCause());
}
progress.worked(1);
ProjectUtil.refreshValidProjects(ProjectUtil.getValidOpenProjects(repo), progress.newChild(1));
}
};
ResourcesPlugin.getWorkspace().run(action, getSchedulingRule(), IWorkspace.AVOID_UPDATE, m);
}
Aggregations