List of usage examples for org.eclipse.jgit.api CherryPickResult getNewHead
public RevCommit getNewHead()
From source file:org.eclipse.egit.ui.internal.commit.command.CherryPickHandler.java
License:Open Source License
public Object execute(ExecutionEvent event) throws ExecutionException { RevCommit commit = getSelectedItem(RevCommit.class, event); if (commit == null) return null; Repository repo = getSelectedItem(Repository.class, event); if (repo == null) return null; final Shell parent = getPart(event).getSite().getShell(); if (!confirmCherryPick(parent, repo, commit)) return null; final CherryPickOperation op = new CherryPickOperation(repo, commit); Job job = new Job(MessageFormat.format(UIText.CherryPickHandler_JobName, commit.name())) { @Override// w ww. ja v a 2 s . c o m protected IStatus run(IProgressMonitor monitor) { try { op.execute(monitor); CherryPickResult cherryPickResult = op.getResult(); RevCommit newHead = cherryPickResult.getNewHead(); if (newHead != null && cherryPickResult.getCherryPickedRefs().isEmpty()) showNotPerformedDialog(parent); if (newHead == null) { CherryPickStatus status = cherryPickResult.getStatus(); switch (status) { case CONFLICTING: showConflictDialog(parent); break; case FAILED: showFailure(cherryPickResult); break; case OK: break; } } } catch (CoreException e) { Activator.logError(UIText.CherryPickOperation_InternalError, e); } return Status.OK_STATUS; } @Override public boolean belongsTo(Object family) { if (JobFamilies.CHERRY_PICK.equals(family)) return true; return super.belongsTo(family); } }; job.setUser(true); job.setRule(op.getSchedulingRule()); job.schedule(); return null; }