Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2015-10-03 20:59:22 +0000
committerGerrit Code Review @ Eclipse.org2015-10-03 20:59:24 +0000
commit456173b6922bb59d59e632989b75c973d1fcbb8c (patch)
treef1bcf6e33280faf9a6f57c60025d4e4352a50536
parent331210a99960b1b4f69b9a327c3242ad219105f1 (diff)
parentb3cef7557bc9a589f74720444dc55d5ef0cabe3b (diff)
downloadegit-456173b6922bb59d59e632989b75c973d1fcbb8c.tar.gz
egit-456173b6922bb59d59e632989b75c973d1fcbb8c.tar.xz
egit-456173b6922bb59d59e632989b75c973d1fcbb8c.zip
Merge "Fixed 'Finishing and squashing a feature aborts in bigger workspaces'"
-rw-r--r--org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/FeatureFinishHandler.java70
1 files changed, 48 insertions, 22 deletions
diff --git a/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/FeatureFinishHandler.java b/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/FeatureFinishHandler.java
index 91ca6dfc4e..d72bb83f1c 100644
--- a/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/FeatureFinishHandler.java
+++ b/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/FeatureFinishHandler.java
@@ -17,8 +17,8 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.jobs.IJobManager;
-import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.egit.core.internal.job.JobUtil;
import org.eclipse.egit.core.op.CommitOperation;
import org.eclipse.egit.gitflow.GitFlowRepository;
@@ -37,6 +37,7 @@ import org.eclipse.jgit.api.MergeResult;
import org.eclipse.jgit.api.MergeResult.MergeStatus;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.lib.Repository;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.handlers.HandlerUtil;
@@ -50,7 +51,7 @@ public class FeatureFinishHandler extends AbstractGitFlowHandler {
if (gfRepo == null) {
return error(UIText.Handlers_noGitflowRepositoryFound);
}
- String featureBranch;
+ final String featureBranch;
Repository repo = gfRepo.getRepository();
try {
featureBranch = repo.getBranch();
@@ -64,7 +65,7 @@ public class FeatureFinishHandler extends AbstractGitFlowHandler {
if (dialog.open() != Window.OK) {
return null;
}
- boolean squash = dialog.isSquash();
+ final boolean squash = dialog.isSquash();
boolean keepBranch = dialog.isKeepBranch();
try {
@@ -76,37 +77,62 @@ public class FeatureFinishHandler extends AbstractGitFlowHandler {
return null;
}
- FeatureFinishOperation operation = new FeatureFinishOperation(
+ final FeatureFinishOperation operation = new FeatureFinishOperation(
gfRepo);
operation.setSquash(squash);
operation.setKeepBranch(keepBranch);
- String develop = gfRepo.getConfig().getDevelop();
JobUtil.scheduleUserWorkspaceJob(operation,
UIText.FeatureFinishHandler_finishingFeature,
- JobFamilies.GITFLOW_FAMILY);
- IJobManager jobMan = Job.getJobManager();
- jobMan.join(JobFamilies.GITFLOW_FAMILY, null);
-
- MergeResult mergeResult = operation.getMergeResult();
-
- if (squash && mergeResult.getMergedCommits().length > 1) {
- rewordCommitMessage(activeShell, gfRepo);
- }
-
- MergeStatus mergeStatus = mergeResult.getMergeStatus();
- if (MergeStatus.CONFLICTING.equals(mergeStatus)) {
- MultiStatus status = createMergeConflictInfo(develop, featureBranch, mergeResult);
- ErrorDialog.openError(null, UIText.FeatureFinishHandler_Conflicts, null, status);
- }
+ JobFamilies.GITFLOW_FAMILY, new JobChangeAdapter() {
+ @Override
+ public void done(IJobChangeEvent jobChangeEvent) {
+ if (jobChangeEvent.getResult().isOK()) {
+ postMerge(gfRepo, featureBranch, squash,
+ operation.getMergeResult());
+ }
+ }
+ });
} catch (WrongGitFlowStateException | CoreException | IOException
- | OperationCanceledException | InterruptedException e) {
+ | OperationCanceledException e) {
return error(e.getMessage(), e);
}
+
return null;
}
+ private void postMerge(final GitFlowRepository gfRepo,
+ final String featureBranch, final boolean squash,
+ final MergeResult mergeResult) {
+ Display display = Display.getDefault();
+
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ Shell activeShell = Display.getDefault().getActiveShell();
+
+ if (squash && mergeResult.getMergedCommits().length > 1) {
+ try {
+ rewordCommitMessage(activeShell, gfRepo);
+ } catch (CoreException | IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ MergeStatus mergeStatus = mergeResult.getMergeStatus();
+ if (MergeStatus.CONFLICTING.equals(mergeStatus)) {
+ String develop = gfRepo.getConfig().getDevelop();
+ MultiStatus status = createMergeConflictInfo(develop,
+ featureBranch, mergeResult);
+ ErrorDialog.openError(null, UIText.FeatureFinishHandler_Conflicts,
+ null, status);
+ }
+ }
+ });
+
+ }
+
private void rewordCommitMessage(Shell activeShell,
final GitFlowRepository gfRepo) throws CoreException, IOException {
Repository repository = gfRepo.getRepository();

Back to the top