Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Rosenberg2013-03-17 17:29:31 +0000
committerMatthias Sohn2013-03-25 02:14:13 +0000
commit4c8c7c4ff6a74d64344459f526d1f9219d62a07d (patch)
tree2bdf64d75b144adc701a0fa0961ac065cba4f667 /org.eclipse.egit.ui
parent2f6855d603cbe0f3c9108f80a874f76dac225beb (diff)
downloadegit-4c8c7c4ff6a74d64344459f526d1f9219d62a07d.tar.gz
egit-4c8c7c4ff6a74d64344459f526d1f9219d62a07d.tar.xz
egit-4c8c7c4ff6a74d64344459f526d1f9219d62a07d.zip
Improve error reporting for pull failures due to conflicts
Change-Id: I9d64db17f2924ac2726aeedc83e55e9fdf653e15 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.egit.ui')
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/PullResultDialog.java31
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseResultDialog.java54
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties2
4 files changed, 55 insertions, 38 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
index 89e01a4d10..94c2daef4a 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
@@ -1806,9 +1806,6 @@ public class UIText extends NLS {
public static String PullResultDialog_RebaseStatusLabel;
/** */
- public static String PullResultDialog_RebaseStoppedMessage;
-
- /** */
public static String PushAction_wrongURIDescription;
/** */
@@ -3435,6 +3432,9 @@ public class UIText extends NLS {
public static String MergeResultDialog_id;
/** */
+ public static String MergeResultDialog_conflicts;
+
+ /** */
public static String MergeResultDialog_failed;
/** */
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/PullResultDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/PullResultDialog.java
index bac51eaca1..45ccf36e09 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/PullResultDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/PullResultDialog.java
@@ -16,6 +16,7 @@ import org.eclipse.egit.ui.UIUtils;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.egit.ui.internal.fetch.FetchResultDialog;
import org.eclipse.egit.ui.internal.merge.MergeResultDialog;
+import org.eclipse.egit.ui.internal.rebase.RebaseResultDialog;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
@@ -37,9 +38,6 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
/**
* Display the result of a pull.
@@ -131,33 +129,10 @@ public class PullResultDialog extends Dialog {
repo, result.getMergeResult());
dlg.createDialogArea(mergeResultGroup);
} else if (hasRebaseResults()) {
+ RebaseResultDialog.createFailedOrConflictsParts(mergeResultGroup,
+ result.getRebaseResult());
GridDataFactory.fillDefaults().grab(true, false).applyTo(
mergeResultGroup);
- GridLayoutFactory.swtDefaults().applyTo(mergeResultGroup);
- Status status = result.getRebaseResult().getStatus();
- switch (status) {
- case OK:
- // fall through
- case FAST_FORWARD:
- // fall through
- case UP_TO_DATE:
- // fall through
- case FAILED:
- // fall through
- case ABORTED:
- break;
- case STOPPED:
- Label errorLabel = new Label(mergeResultGroup, SWT.NONE);
- errorLabel.setImage(PlatformUI.getWorkbench().getSharedImages()
- .getImage(ISharedImages.IMG_OBJS_ERROR_TSK));
- Text errorText = new Text(mergeResultGroup, SWT.READ_ONLY);
- errorText.setText(UIText.PullResultDialog_RebaseStoppedMessage);
- break;
- }
- Label statusLabel = new Label(mergeResultGroup, SWT.NONE);
- statusLabel.setText(UIText.PullResultDialog_RebaseStatusLabel);
- Text statusText = new Text(mergeResultGroup, SWT.READ_ONLY);
- statusText.setText(status.name());
} else {
GridDataFactory.fillDefaults().grab(true, false).applyTo(
mergeResultGroup);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseResultDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseResultDialog.java
index eaf6bc96e3..b7298a9a38 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseResultDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseResultDialog.java
@@ -182,14 +182,28 @@ public class RebaseResultDialog extends MessageDialog {
if (result.getStatus() == Status.STOPPED)
return createStoppedDialogArea(parent);
- if (result.getStatus() == Status.FAILED)
- return createFailedDialog(parent);
+ if (result.getStatus() == Status.FAILED
+ || result.getStatus() == Status.CONFLICTS)
+ return createFailedOrConflictDialog(parent);
createToggleButton(parent);
return null;
}
- private Control createFailedDialog(Composite parent) {
+ private Control createFailedOrConflictDialog(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
+ createFailedOrConflictsParts(composite, result);
+
+ return composite;
+ }
+
+ /**
+ * Create the items in composite necessary for a rebase result
+ *
+ * @param composite
+ * @param result
+ */
+ public static void createFailedOrConflictsParts(Composite composite,
+ RebaseResult result) {
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
composite.setLayout(gridLayout);
@@ -203,7 +217,8 @@ public class RebaseResultDialog extends MessageDialog {
resultText.setSelection(resultText.getCaretPosition());
resultText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
if (result.getStatus() == Status.FAILED) {
- resultText.setForeground(parent.getDisplay().getSystemColor(
+ resultText.setForeground(composite.getParent().getDisplay()
+ .getSystemColor(
SWT.COLOR_RED));
StringBuilder paths = new StringBuilder();
@@ -234,9 +249,36 @@ public class RebaseResultDialog extends MessageDialog {
Integer.valueOf(n - failedPaths.size())));
}
pathsText.setText(paths.toString());
- }
+ } else if (result.getStatus() == Status.CONFLICTS) {
+ resultText.setForeground(composite.getParent().getDisplay()
+ .getSystemColor(SWT.COLOR_RED));
- return composite;
+ StringBuilder paths = new StringBuilder();
+ Label pathsLabel = new Label(composite, SWT.NONE);
+ pathsLabel.setText(UIText.MergeResultDialog_conflicts);
+ pathsLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false,
+ false));
+ Text pathsText = new Text(composite, SWT.READ_ONLY);
+ pathsText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false,
+ false));
+ List<String> conflList = result.getConflicts();
+ int n = 0;
+ for (String e : conflList) {
+ if (n > 0)
+ paths.append(Text.DELIMITER);
+ paths.append(e);
+ n++;
+ if (n > 10 && conflList.size() > 15)
+ break;
+ }
+ if (n < conflList.size()) {
+ paths.append(Text.DELIMITER);
+ paths.append(MessageFormat.format(
+ UIText.MergeResultDialog_nMore,
+ Integer.valueOf(n - conflList.size())));
+ }
+ pathsText.setText(paths.toString());
+ }
}
private Control createStoppedDialogArea(Composite parent) {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
index 54271d6488..7afd61dc35 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
@@ -626,7 +626,6 @@ PullResultDialog_FetchResultGroupHeader=Fetch Result
PullResultDialog_MergeAlreadyUpToDateMessage=Nothing to update - everything up to date
PullResultDialog_MergeResultGroupHeader=Update Result
PullResultDialog_RebaseStatusLabel=Rebase status
-PullResultDialog_RebaseStoppedMessage=Rebase has stopped because of conflicts
PushAction_wrongURIDescription=Remote repositories URIs configuration is corrupted.
PushAction_wrongURITitle=Corrupted Configuration
PushCommand_pushBranchTitle=Push Branch
@@ -979,6 +978,7 @@ MergeModeDialog_MergeMode_2_Label=Use &HEAD (the last local version) of conflict
MergeResultDialog_couldNotFindCommit=Could not find commit: {0}
MergeResultDialog_description=Description
MergeResultDialog_id=Commit Id
+MergeResultDialog_conflicts=Conflicting Paths
MergeResultDialog_failed=Failed Paths
MergeResultDialog_mergeInput=Merge input
MergeResultDialog_mergeResult=Merge result

Back to the top