This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 245236
Collapse All | Expand All

(-)git/nbproject/project.xml (-1 / +1 lines)
Lines 25-31 Link Here
25
                    <compile-dependency/>
25
                    <compile-dependency/>
26
                    <run-dependency>
26
                    <run-dependency>
27
                        <release-version>1</release-version>
27
                        <release-version>1</release-version>
28
                        <specification-version>1.25</specification-version>
28
                        <specification-version>1.26</specification-version>
29
                    </run-dependency>
29
                    </run-dependency>
30
                </dependency>
30
                </dependency>
31
                <dependency>
31
                <dependency>
(-)git/src/org/netbeans/modules/git/Git.java (-6 / +15 lines)
Lines 59-64 Link Here
59
import java.util.logging.Level;
59
import java.util.logging.Level;
60
import java.util.logging.Logger;
60
import java.util.logging.Logger;
61
import org.netbeans.libs.git.GitException;
61
import org.netbeans.libs.git.GitException;
62
import org.netbeans.libs.git.GitRepository;
62
import org.netbeans.modules.git.client.CredentialsCallback;
63
import org.netbeans.modules.git.client.CredentialsCallback;
63
import org.netbeans.modules.git.client.GitClient;
64
import org.netbeans.modules.git.client.GitClient;
64
import org.netbeans.modules.git.ui.shelve.ShelveChangesAction;
65
import org.netbeans.modules.git.ui.shelve.ShelveChangesAction;
Lines 212-226 Link Here
212
    }
213
    }
213
    
214
    
214
    public GitClient getClient (File repository, GitProgressSupport progressSupport, boolean handleAuthenticationIssues) throws GitException {
215
    public GitClient getClient (File repository, GitProgressSupport progressSupport, boolean handleAuthenticationIssues) throws GitException {
215
        // get the only instance for the repository folder, so we can synchronize on it
216
        GitClient client = new GitClient(singleInstanceRepositoryRoot(repository), progressSupport, handleAuthenticationIssues);
216
        File repositoryFolder = getRepositoryRoot(repository);
217
        if (repositoryFolder != null && repository.equals(repositoryFolder)) {
218
            repository = repositoryFolder;
219
        }
220
        GitClient client = new GitClient(repository, progressSupport, handleAuthenticationIssues);
221
        client.setCallback(new CredentialsCallback());
217
        client.setCallback(new CredentialsCallback());
222
        return client;
218
        return client;
223
    }
219
    }
220
    
221
    public GitRepository getRepository (File repository) throws GitException {
222
        return GitRepository.getInstance(singleInstanceRepositoryRoot(repository));
223
    }
224
224
225
    public RequestProcessor getRequestProcessor() {
225
    public RequestProcessor getRequestProcessor() {
226
        return getRequestProcessor(null);
226
        return getRequestProcessor(null);
Lines 361-366 Link Here
361
361
362
        return topmost;
362
        return topmost;
363
    }
363
    }
364
365
    private File singleInstanceRepositoryRoot (File repository) {
366
        // get the only instance for the repository folder, so we can synchronize on it
367
        File repositoryFolder = getRepositoryRoot(repository);
368
        if (repositoryFolder != null && repository.equals(repositoryFolder)) {
369
            repository = repositoryFolder;
370
        }
371
        return repository;
372
    }
364
    
373
    
365
    private File getKnownParent(File file) {
374
    private File getKnownParent(File file) {
366
        File[] roots = knownRoots.toArray(new File[knownRoots.size()]);
375
        File[] roots = knownRoots.toArray(new File[knownRoots.size()]);
(-)git/src/org/netbeans/modules/git/client/GitClient.java (-2 / +3 lines)
Lines 67-72 Link Here
67
import org.netbeans.libs.git.GitRebaseResult;
67
import org.netbeans.libs.git.GitRebaseResult;
68
import org.netbeans.libs.git.GitRefUpdateResult;
68
import org.netbeans.libs.git.GitRefUpdateResult;
69
import org.netbeans.libs.git.GitRemoteConfig;
69
import org.netbeans.libs.git.GitRemoteConfig;
70
import org.netbeans.libs.git.GitRepository.FastForwardOption;
70
import org.netbeans.libs.git.GitRepositoryState;
71
import org.netbeans.libs.git.GitRepositoryState;
71
import org.netbeans.libs.git.GitRevertResult;
72
import org.netbeans.libs.git.GitRevertResult;
72
import org.netbeans.libs.git.GitRevisionInfo;
73
import org.netbeans.libs.git.GitRevisionInfo;
Lines 608-619 Link Here
608
        }, "log"); //NOI18N
609
        }, "log"); //NOI18N
609
    }
610
    }
610
    
611
    
611
    public GitMergeResult merge (final String revision, final ProgressMonitor monitor) throws GitException.CheckoutConflictException, GitException {
612
    public GitMergeResult merge (final String revision, final FastForwardOption ffOption, final ProgressMonitor monitor) throws GitException.CheckoutConflictException, GitException {
612
        return new CommandInvoker().runMethod(new Callable<GitMergeResult>() {
613
        return new CommandInvoker().runMethod(new Callable<GitMergeResult>() {
613
614
614
            @Override
615
            @Override
615
            public GitMergeResult call () throws Exception {
616
            public GitMergeResult call () throws Exception {
616
                return delegate.merge(revision, monitor);
617
                return delegate.merge(revision, ffOption, monitor);
617
            }
618
            }
618
        }, "merge"); //NOI18N
619
        }, "merge"); //NOI18N
619
    }
620
    }
(-)git/src/org/netbeans/modules/git/ui/fetch/PullAction.java (-6 / +8 lines)
Lines 63-68 Link Here
63
import org.netbeans.libs.git.GitMergeResult;
63
import org.netbeans.libs.git.GitMergeResult;
64
import org.netbeans.libs.git.GitRebaseResult;
64
import org.netbeans.libs.git.GitRebaseResult;
65
import org.netbeans.libs.git.GitRemoteConfig;
65
import org.netbeans.libs.git.GitRemoteConfig;
66
import org.netbeans.libs.git.GitRepository;
66
import org.netbeans.libs.git.GitRevisionInfo;
67
import org.netbeans.libs.git.GitRevisionInfo;
67
import org.netbeans.libs.git.GitTransportUpdate;
68
import org.netbeans.libs.git.GitTransportUpdate;
68
import org.netbeans.modules.git.Git;
69
import org.netbeans.modules.git.Git;
Lines 315-329 Link Here
315
316
316
            @Override
317
            @Override
317
            public ActionProgress call () throws GitException {
318
            public ActionProgress call () throws GitException {
318
                boolean cont;
319
                GitClient client = getClient();
319
                GitClient client = getClient();
320
                File repository = getRepositoryRoot();
320
                File repository = getRepositoryRoot();
321
                setDisplayName(Bundle.MSG_PullAction_merging());
321
                setDisplayName(Bundle.MSG_PullAction_merging());
322
                MergeRevisionAction.MergeContext ctx = new MergeRevisionAction.MergeContext(branchToMerge, null);
323
                MergeRevisionAction.MergeResultProcessor mrp = new MergeRevisionAction.MergeResultProcessor(client, repository, ctx, getLogger(), getProgressMonitor());
322
                do {
324
                do {
323
                    MergeRevisionAction.MergeResultProcessor mrp = new MergeRevisionAction.MergeResultProcessor(client, repository, branchToMerge, getLogger(), getProgressMonitor());
325
                    ctx.setContinue(false);
324
                    cont = false;
326
                    GitRepository.FastForwardOption ffOption = null;
325
                    try {
327
                    try {
326
                        GitMergeResult result = client.merge(branchToMerge, getProgressMonitor());
328
                        GitMergeResult result = client.merge(branchToMerge, ffOption, getProgressMonitor());
327
                        mrp.processResult(result);
329
                        mrp.processResult(result);
328
                        if (result.getMergeStatus() == GitMergeResult.MergeStatus.ALREADY_UP_TO_DATE
330
                        if (result.getMergeStatus() == GitMergeResult.MergeStatus.ALREADY_UP_TO_DATE
329
                                || result.getMergeStatus() == GitMergeResult.MergeStatus.FAST_FORWARD
331
                                || result.getMergeStatus() == GitMergeResult.MergeStatus.FAST_FORWARD
Lines 334-342 Link Here
334
                        if (LOG.isLoggable(Level.FINE)) {
336
                        if (LOG.isLoggable(Level.FINE)) {
335
                            LOG.log(Level.FINE, "Local modifications in WT during merge: {0} - {1}", new Object[] { repository, Arrays.asList(ex.getConflicts()) }); //NOI18N
337
                            LOG.log(Level.FINE, "Local modifications in WT during merge: {0} - {1}", new Object[] { repository, Arrays.asList(ex.getConflicts()) }); //NOI18N
336
                        }
338
                        }
337
                        cont = mrp.resolveLocalChanges(ex.getConflicts());
339
                        ctx.setContinue(mrp.resolveLocalChanges(ex.getConflicts()));
338
                    }
340
                    }
339
                } while (cont && !isCanceled());
341
                } while (ctx.isContinue() && !isCanceled());
340
                return new ActionProgress.ActionResult(isCanceled(), true);
342
                return new ActionProgress.ActionResult(isCanceled(), true);
341
            }
343
            }
342
344
(-)git/src/org/netbeans/modules/git/ui/merge/Bundle.properties (+8 lines)
Lines 47-53 Link Here
47
MSG_MergeRevisionAction.result.conflict=Merge of HEAD with {0} produced conflicts in:\n
47
MSG_MergeRevisionAction.result.conflict=Merge of HEAD with {0} produced conflicts in:\n
48
MSG_MergeRevisionAction.result.failed=Merge of HEAD with {0} failed. For more information see the output.
48
MSG_MergeRevisionAction.result.failed=Merge of HEAD with {0} failed. For more information see the output.
49
MSG_MergeRevisionAction.result.failedFiles=Merge of HEAD with {0} failed because of these files:\n
49
MSG_MergeRevisionAction.result.failedFiles=Merge of HEAD with {0} failed because of these files:\n
50
MSG_MergeRevisionAction.result.aborted=Merge of HEAD with {0} failed because it requires a merge commit and only fast-forward merges were allowed.
50
MSG_MergeRevisionAction.result.unsupported=Merge unsupported.
51
MSG_MergeRevisionAction.result.unsupported=Merge unsupported.
51
LBL_MergeRevision.OKButton.text=Mer&ge
52
LBL_MergeRevision.OKButton.text=Mer&ge
52
LBL_MergeRevision.title=Merge Revision
53
LBL_MergeRevision.title=Merge Revision
53
MergeRevisionPanel.jLabel1.text=Select a revision to merge into HEAD
54
MergeRevisionPanel.jLabel1.text=Select a revision to merge into HEAD
55
MergeRevision.ffoption.ff=Fast-forward if possible (--ff)
56
MergeRevision.ffoption.ff.tt=Where possible merge will not create new commit but will move the branch to the merged commit.
57
MergeRevision.ffoption.ffonly=Fast-forward only (--ff-only)
58
MergeRevision.ffoption.ffonly.tt=Merge will fail if the merge commit is required (both branches have their own commits)
59
MergeRevision.ffoption.noff=Always create commit (--no-ff)
60
MergeRevision.ffoption.noff.tt=Merge will always create a merge commit, useful for merging feature branches.
61
MergeRevisionPanel.ffModePanel.text=Select Fast-Forward mode
(-)git/src/org/netbeans/modules/git/ui/merge/MergeRevision.java (-4 / +33 lines)
Lines 47-52 Link Here
47
import java.beans.PropertyChangeListener;
47
import java.beans.PropertyChangeListener;
48
import java.io.File;
48
import java.io.File;
49
import javax.swing.JButton;
49
import javax.swing.JButton;
50
import org.netbeans.libs.git.GitRepository.FastForwardOption;
50
import org.netbeans.modules.git.ui.repository.RevisionDialogController;
51
import org.netbeans.modules.git.ui.repository.RevisionDialogController;
51
import org.netbeans.modules.git.utils.GitUtils;
52
import org.netbeans.modules.git.utils.GitUtils;
52
import org.openide.DialogDescriptor;
53
import org.openide.DialogDescriptor;
Lines 59-74 Link Here
59
 * @author ondra
60
 * @author ondra
60
 */
61
 */
61
public class MergeRevision {
62
public class MergeRevision {
62
    private MergeRevisionPanel panel;
63
    private final MergeRevisionPanel panel;
63
    private RevisionDialogController revisionPicker;
64
    private final RevisionDialogController revisionPicker;
64
    private JButton okButton;
65
    private JButton okButton;
65
    private DialogDescriptor dd;
66
    private DialogDescriptor dd;
66
    private boolean valid = true;
67
    private boolean valid = true;
68
    private final FastForwardOption ffOption;
67
69
68
    MergeRevision (File repository, File[] roots, String initialRevision) {
70
    MergeRevision (File repository, File[] roots, String initialRevision, FastForwardOption defaultFFOption) {
71
        ffOption = defaultFFOption;
69
        revisionPicker = new RevisionDialogController(repository, roots, initialRevision);
72
        revisionPicker = new RevisionDialogController(repository, roots, initialRevision);
70
        revisionPicker.setMergingInto(GitUtils.HEAD);
73
        revisionPicker.setMergingInto(GitUtils.HEAD);
71
        panel = new MergeRevisionPanel(revisionPicker.getPanel());
74
        panel = new MergeRevisionPanel(revisionPicker.getPanel());
75
        initFFOptions();
72
    }
76
    }
73
77
74
    String getRevision() {
78
    String getRevision() {
Lines 79-85 Link Here
79
        okButton = new JButton(NbBundle.getMessage(MergeRevision.class, "LBL_MergeRevision.OKButton.text")); //NOI18N
83
        okButton = new JButton(NbBundle.getMessage(MergeRevision.class, "LBL_MergeRevision.OKButton.text")); //NOI18N
80
        org.openide.awt.Mnemonics.setLocalizedText(okButton, okButton.getText());
84
        org.openide.awt.Mnemonics.setLocalizedText(okButton, okButton.getText());
81
        dd = new DialogDescriptor(panel, NbBundle.getMessage(MergeRevision.class, "LBL_MergeRevision.title"), true,  //NOI18N
85
        dd = new DialogDescriptor(panel, NbBundle.getMessage(MergeRevision.class, "LBL_MergeRevision.title"), true,  //NOI18N
82
                new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx(MergeRevision.class), null);
86
                new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton, DialogDescriptor.DEFAULT_ALIGN,
87
                new HelpCtx("org.netbeans.modules.git.ui.merge.MergeRevision"), null); //NOI18N
83
        enableRevisionPanel();
88
        enableRevisionPanel();
84
        revisionPicker.addPropertyChangeListener(new PropertyChangeListener() {
89
        revisionPicker.addPropertyChangeListener(new PropertyChangeListener() {
85
            @Override
90
            @Override
Lines 94-99 Link Here
94
        return okButton == dd.getValue();
99
        return okButton == dd.getValue();
95
    }
100
    }
96
101
102
    FastForwardOption getFFOption () {
103
        if (panel.rbFFOptionOnly.isSelected()) {
104
            return FastForwardOption.FAST_FORWARD_ONLY;
105
        } else if (panel.rbFFOptionNever.isSelected()) {
106
            return FastForwardOption.NO_FAST_FORWARD;
107
        } else {
108
            return FastForwardOption.FAST_FORWARD;
109
        }
110
    }
111
    
97
    private void enableRevisionPanel () {
112
    private void enableRevisionPanel () {
98
        setValid(valid);
113
        setValid(valid);
99
    }
114
    }
Lines 103-106 Link Here
103
        okButton.setEnabled(flag);
118
        okButton.setEnabled(flag);
104
        dd.setValid(flag);
119
        dd.setValid(flag);
105
    }
120
    }
121
122
    private void initFFOptions () {
123
        switch (ffOption) {
124
            case FAST_FORWARD:
125
                panel.rbFFOption.setSelected(true);
126
                break;
127
            case FAST_FORWARD_ONLY:
128
                panel.rbFFOptionOnly.setSelected(true);
129
                break;
130
            case NO_FAST_FORWARD:
131
                panel.rbFFOptionNever.setSelected(true);
132
                break;
133
        }
134
    }
106
}
135
}
(-)git/src/org/netbeans/modules/git/ui/merge/MergeRevisionAction.java (-12 / +80 lines)
Lines 58-63 Link Here
58
import org.netbeans.modules.git.client.GitClient;
58
import org.netbeans.modules.git.client.GitClient;
59
import org.netbeans.libs.git.GitException;
59
import org.netbeans.libs.git.GitException;
60
import org.netbeans.libs.git.GitMergeResult;
60
import org.netbeans.libs.git.GitMergeResult;
61
import org.netbeans.libs.git.GitRepository.FastForwardOption;
61
import org.netbeans.libs.git.GitRevisionInfo;
62
import org.netbeans.libs.git.GitRevisionInfo;
62
import org.netbeans.libs.git.progress.ProgressMonitor;
63
import org.netbeans.libs.git.progress.ProgressMonitor;
63
import org.netbeans.modules.git.Git;
64
import org.netbeans.modules.git.Git;
Lines 94-100 Link Here
94
    }
95
    }
95
96
96
    public void mergeRevision (final File repository, String preselectedRevision) {
97
    public void mergeRevision (final File repository, String preselectedRevision) {
97
        final MergeRevision mergeRevision = new MergeRevision(repository, new File[0], preselectedRevision);
98
        FastForwardOption defaultFFOption = FastForwardOption.FAST_FORWARD;
99
        try {
100
            defaultFFOption = Git.getInstance().getRepository(repository).getDefaultFastForwardOption();
101
        } catch (GitException ex) {
102
            LOG.log(Level.INFO, null, ex);
103
        }
104
        final MergeRevision mergeRevision = new MergeRevision(repository, new File[0], preselectedRevision, defaultFFOption);
98
        if (mergeRevision.show()) {
105
        if (mergeRevision.show()) {
99
            GitProgressSupport supp = new GitProgressSupport() {
106
            GitProgressSupport supp = new GitProgressSupport() {
100
                private String revision;
107
                private String revision;
Lines 109-128 Link Here
109
                                client.addNotificationListener(new DefaultFileListener(new File[] { repository }));
116
                                client.addNotificationListener(new DefaultFileListener(new File[] { repository }));
110
                                revision = mergeRevision.getRevision();
117
                                revision = mergeRevision.getRevision();
111
                                LOG.log(Level.FINE, "Merging revision {0} into HEAD", revision); //NOI18N
118
                                LOG.log(Level.FINE, "Merging revision {0} into HEAD", revision); //NOI18N
112
                                boolean cont;
119
                                MergeContext ctx = new MergeContext(revision, mergeRevision.getFFOption());
113
                                MergeResultProcessor mrp = new MergeResultProcessor(client, repository, revision, getLogger(), getProgressMonitor());
120
                                MergeResultProcessor mrp = new MergeResultProcessor(client, repository, ctx, getLogger(), getProgressMonitor());
114
                                do {
121
                                do {
115
                                    cont = false;
122
                                    ctx.setContinue(false);
116
                                    try {
123
                                    try {
117
                                        GitMergeResult result = client.merge(revision, getProgressMonitor());
124
                                        GitMergeResult result = client.merge(revision, ctx.getFFOption(), getProgressMonitor());
118
                                        mrp.processResult(result);
125
                                        mrp.processResult(result);
119
                                    } catch (GitException.CheckoutConflictException ex) {
126
                                    } catch (GitException.CheckoutConflictException ex) {
120
                                        if (LOG.isLoggable(Level.FINE)) {
127
                                        if (LOG.isLoggable(Level.FINE)) {
121
                                            LOG.log(Level.FINE, "Local modifications in WT during merge: {0} - {1}", new Object[] { repository, Arrays.asList(ex.getConflicts()) }); //NOI18N
128
                                            LOG.log(Level.FINE, "Local modifications in WT during merge: {0} - {1}", new Object[] { repository, Arrays.asList(ex.getConflicts()) }); //NOI18N
122
                                        }
129
                                        }
123
                                        cont = mrp.resolveLocalChanges(ex.getConflicts());
130
                                        ctx.setContinue(mrp.resolveLocalChanges(ex.getConflicts()));
124
                                    }
131
                                    }
125
                                } while (cont);
132
                                } while (ctx.isContinue() && !isCanceled());
126
                                return null;
133
                                return null;
127
                            }
134
                            }
128
                        }, repository);
135
                        }, repository);
Lines 139-158 Link Here
139
        }
146
        }
140
    }
147
    }
141
    
148
    
149
    @NbBundle.Messages({
150
        "LBL_Merge.failed.title=Cannot Merge",
151
        "MSG_Merge.failed.aborted.text=Merge requires a merge commit and cannot be a fast-forward merge.\n\n"
152
                + "Do you want to restart the merge and allow merge commits (--ff option)."
153
    })
142
    public static class MergeResultProcessor extends ResultProcessor {
154
    public static class MergeResultProcessor extends ResultProcessor {
143
155
144
        private final OutputLogger logger;
156
        private final OutputLogger logger;
145
        private final String revision;
146
        private final GitBranch current;
157
        private final GitBranch current;
158
        private final MergeContext context;
147
        
159
        
148
        public MergeResultProcessor (GitClient client, File repository, String revision, OutputLogger logger, ProgressMonitor pm) {
160
        public MergeResultProcessor (GitClient client, File repository, MergeContext context, OutputLogger logger, ProgressMonitor pm) {
149
            super(client, repository, revision, pm);
161
            super(client, repository, context.getRevision(), pm);
162
            this.context = context;
150
            this.current = RepositoryInfo.getInstance(repository).getActiveBranch();
163
            this.current = RepositoryInfo.getInstance(repository).getActiveBranch();
151
            this.revision = revision;
152
            this.logger = logger;
164
            this.logger = logger;
153
        }
165
        }
154
        
166
        
155
        public void processResult (GitMergeResult result) {
167
        public void processResult (GitMergeResult result) {
168
            String revision = context.getRevision();
156
            StringBuilder sb = new StringBuilder(NbBundle.getMessage(MergeRevisionAction.class, "MSG_MergeRevisionAction.result", result.getMergeStatus().toString())); //NOI18N
169
            StringBuilder sb = new StringBuilder(NbBundle.getMessage(MergeRevisionAction.class, "MSG_MergeRevisionAction.result", result.getMergeStatus().toString())); //NOI18N
157
            GitRevisionInfo info = null;
170
            GitRevisionInfo info = null;
158
            if (result.getNewHead() != null) {
171
            if (result.getNewHead() != null) {
Lines 163-168 Link Here
163
                }
176
                }
164
            }
177
            }
165
            boolean logActions = false;
178
            boolean logActions = false;
179
            final Action openAction = logger.getOpenOutputAction();
166
            switch (result.getMergeStatus()) {
180
            switch (result.getMergeStatus()) {
167
                case ALREADY_UP_TO_DATE:
181
                case ALREADY_UP_TO_DATE:
168
                    sb.append(NbBundle.getMessage(MergeRevisionAction.class, "MSG_MergeRevisionAction.result.alreadyUpToDate", revision)); //NOI18N
182
                    sb.append(NbBundle.getMessage(MergeRevisionAction.class, "MSG_MergeRevisionAction.result.alreadyUpToDate", revision)); //NOI18N
Lines 183-189 Link Here
183
                    resolveConflicts(result.getConflicts());
197
                    resolveConflicts(result.getConflicts());
184
                    break;
198
                    break;
185
                case FAILED:
199
                case FAILED:
186
                    final Action openAction = logger.getOpenOutputAction();
187
                    if (openAction != null) {
200
                    if (openAction != null) {
188
                        try {
201
                        try {
189
                            EventQueue.invokeAndWait(new Runnable() {
202
                            EventQueue.invokeAndWait(new Runnable() {
Lines 201-206 Link Here
201
                    DialogDisplayer.getDefault().notifyLater(new NotifyDescriptor.Message(
214
                    DialogDisplayer.getDefault().notifyLater(new NotifyDescriptor.Message(
202
                            NbBundle.getMessage(MergeRevisionAction.class, "MSG_MergeRevisionAction.result.failed", revision), NotifyDescriptor.ERROR_MESSAGE)); //NOI18N
215
                            NbBundle.getMessage(MergeRevisionAction.class, "MSG_MergeRevisionAction.result.failed", revision), NotifyDescriptor.ERROR_MESSAGE)); //NOI18N
203
                    break;
216
                    break;
217
                case ABORTED:
218
                    Object o = DialogDisplayer.getDefault().notify(new NotifyDescriptor(Bundle.MSG_Merge_failed_aborted_text(),
219
                            Bundle.LBL_Merge_failed_title(), NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE,
220
                            new Object[] { NotifyDescriptor.YES_OPTION, NotifyDescriptor.NO_OPTION },
221
                            NotifyDescriptor.NO_OPTION));
222
                    if (o == NotifyDescriptor.YES_OPTION) {
223
                        context.setFFOption(FastForwardOption.FAST_FORWARD);
224
                        context.setContinue(true);
225
                    } else {
226
                        if (openAction != null) {
227
                            try {
228
                                EventQueue.invokeAndWait(new Runnable() {
229
                                    @Override
230
                                    public void run () {
231
                                        openAction.actionPerformed(new ActionEvent(MergeResultProcessor.this, ActionEvent.ACTION_PERFORMED, null));
232
                                    }
233
                                });
234
                            } catch (InterruptedException | InvocationTargetException ex) {
235
                            }
236
                        }
237
                    }
238
                    sb.append(NbBundle.getMessage(MergeRevisionAction.class, "MSG_MergeRevisionAction.result.aborted", revision)); //NOI18N
239
                    break;
204
                case NOT_SUPPORTED:
240
                case NOT_SUPPORTED:
205
                    sb.append(NbBundle.getMessage(MergeRevisionAction.class, "MSG_MergeRevisionAction.result.unsupported")); //NOI18N
241
                    sb.append(NbBundle.getMessage(MergeRevisionAction.class, "MSG_MergeRevisionAction.result.unsupported")); //NOI18N
206
                    DialogDisplayer.getDefault().notifyLater(new NotifyDescriptor.Message(
242
                    DialogDisplayer.getDefault().notifyLater(new NotifyDescriptor.Message(
Lines 216-219 Link Here
216
            }
252
            }
217
        }
253
        }
218
    }
254
    }
255
256
    public static class MergeContext {
257
        private FastForwardOption ffOption;
258
        private final String revision;
259
        private boolean cont;
260
261
        public MergeContext (String revision, FastForwardOption ffOption) {
262
            this.revision = revision;
263
            this.ffOption = ffOption;
264
        }
265
266
        public String getRevision () {
267
            return revision;
268
        }
269
270
        public FastForwardOption getFFOption () {
271
            return ffOption;
272
        }
273
274
        private void setFFOption (FastForwardOption ffOption) {
275
            this.ffOption = ffOption;
276
        }
277
278
        public void setContinue (boolean cont) {
279
            this.cont = cont;
280
        }
281
        
282
        public boolean isContinue () {
283
            return cont;
284
        }
285
        
286
    }
219
}
287
}
(-)git/src/org/netbeans/modules/git/ui/merge/MergeRevisionPanel.form (-6 / +100 lines)
Lines 1-11 Link Here
1
<?xml version="1.1" encoding="UTF-8" ?>
1
<?xml version="1.0" encoding="UTF-8" ?>
2
2
3
<Form version="1.4" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
3
<Form version="1.4" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <NonVisualComponents>
5
    <Component class="javax.swing.ButtonGroup" name="rbFFOptions">
6
    </Component>
7
  </NonVisualComponents>
4
  <AuxValues>
8
  <AuxValues>
5
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
9
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
6
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
10
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
7
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
11
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
8
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
12
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
9
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
13
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
10
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
14
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
11
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
15
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
Lines 16-27 Link Here
16
  <Layout>
20
  <Layout>
17
    <DimensionLayout dim="0">
21
    <DimensionLayout dim="0">
18
      <Group type="103" groupAlignment="0" attributes="0">
22
      <Group type="103" groupAlignment="0" attributes="0">
23
          <Component id="revisionPickerDialog1" alignment="1" max="32767" attributes="0"/>
19
          <Group type="102" attributes="0">
24
          <Group type="102" attributes="0">
20
              <EmptySpace max="-2" attributes="0"/>
25
              <EmptySpace max="-2" attributes="0"/>
21
              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
26
              <Group type="103" groupAlignment="0" attributes="0">
22
              <EmptySpace pref="106" max="32767" attributes="0"/>
27
                  <Group type="102" attributes="0">
28
                      <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
29
                      <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
30
                  </Group>
31
                  <Component id="jPanel1" max="32767" attributes="0"/>
32
              </Group>
33
              <EmptySpace max="-2" attributes="0"/>
23
          </Group>
34
          </Group>
24
          <Component id="revisionPickerDialog1" alignment="1" pref="376" max="32767" attributes="0"/>
25
      </Group>
35
      </Group>
26
    </DimensionLayout>
36
    </DimensionLayout>
27
    <DimensionLayout dim="1">
37
    <DimensionLayout dim="1">
Lines 30-36 Link Here
30
              <EmptySpace max="-2" attributes="0"/>
40
              <EmptySpace max="-2" attributes="0"/>
31
              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
41
              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
32
              <EmptySpace max="-2" attributes="0"/>
42
              <EmptySpace max="-2" attributes="0"/>
33
              <Component id="revisionPickerDialog1" pref="186" max="32767" attributes="0"/>
43
              <Component id="revisionPickerDialog1" pref="187" max="32767" attributes="0"/>
44
              <EmptySpace max="-2" attributes="0"/>
45
              <Component id="jPanel1" max="-2" attributes="0"/>
46
              <EmptySpace max="-2" attributes="0"/>
34
          </Group>
47
          </Group>
35
      </Group>
48
      </Group>
36
    </DimensionLayout>
49
    </DimensionLayout>
Lines 50-54 Link Here
50
        </Property>
63
        </Property>
51
      </Properties>
64
      </Properties>
52
    </Component>
65
    </Component>
66
    <Container class="javax.swing.JPanel" name="jPanel1">
67
      <Properties>
68
        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
69
          <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
70
            <TitledBorder title="Select Fast-Forward mode">
71
              <ResourceString PropertyName="titleX" bundle="org/netbeans/modules/git/ui/merge/Bundle.properties" key="MergeRevisionPanel.ffModePanel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
72
            </TitledBorder>
73
          </Border>
74
        </Property>
75
      </Properties>
76
77
      <Layout>
78
        <DimensionLayout dim="0">
79
          <Group type="103" groupAlignment="0" attributes="0">
80
              <Group type="102" attributes="0">
81
                  <EmptySpace max="-2" attributes="0"/>
82
                  <Group type="103" groupAlignment="0" attributes="0">
83
                      <Component id="rbFFOptionNever" min="-2" max="-2" attributes="0"/>
84
                      <Component id="rbFFOptionOnly" min="-2" max="-2" attributes="0"/>
85
                      <Component id="rbFFOption" min="-2" max="-2" attributes="0"/>
86
                  </Group>
87
                  <EmptySpace max="32767" attributes="0"/>
88
              </Group>
89
          </Group>
90
        </DimensionLayout>
91
        <DimensionLayout dim="1">
92
          <Group type="103" groupAlignment="0" attributes="0">
93
              <Group type="102" attributes="0">
94
                  <EmptySpace max="-2" attributes="0"/>
95
                  <Component id="rbFFOption" min="-2" max="-2" attributes="0"/>
96
                  <EmptySpace type="unrelated" max="-2" attributes="0"/>
97
                  <Component id="rbFFOptionOnly" min="-2" max="-2" attributes="0"/>
98
                  <EmptySpace type="unrelated" max="-2" attributes="0"/>
99
                  <Component id="rbFFOptionNever" min="-2" max="-2" attributes="0"/>
100
                  <EmptySpace max="-2" attributes="0"/>
101
              </Group>
102
          </Group>
103
        </DimensionLayout>
104
      </Layout>
105
      <SubComponents>
106
        <Component class="javax.swing.JRadioButton" name="rbFFOption">
107
          <Properties>
108
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
109
              <ResourceString bundle="org/netbeans/modules/git/ui/merge/Bundle.properties" key="MergeRevision.ffoption.ff" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
110
            </Property>
111
            <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
112
              <ResourceString bundle="org/netbeans/modules/git/ui/merge/Bundle.properties" key="MergeRevision.ffoption.ff.tt" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
113
            </Property>
114
          </Properties>
115
          <AuxValues>
116
            <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="16"/>
117
          </AuxValues>
118
        </Component>
119
        <Component class="javax.swing.JRadioButton" name="rbFFOptionNever">
120
          <Properties>
121
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
122
              <ResourceString bundle="org/netbeans/modules/git/ui/merge/Bundle.properties" key="MergeRevision.ffoption.noff" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
123
            </Property>
124
            <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
125
              <ResourceString bundle="org/netbeans/modules/git/ui/merge/Bundle.properties" key="MergeRevision.ffoption.noff.tt" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
126
            </Property>
127
          </Properties>
128
          <AuxValues>
129
            <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="16"/>
130
          </AuxValues>
131
        </Component>
132
        <Component class="javax.swing.JRadioButton" name="rbFFOptionOnly">
133
          <Properties>
134
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
135
              <ResourceString bundle="org/netbeans/modules/git/ui/merge/Bundle.properties" key="MergeRevision.ffoption.ffonly" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
136
            </Property>
137
            <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
138
              <ResourceString bundle="org/netbeans/modules/git/ui/merge/Bundle.properties" key="MergeRevision.ffoption.ffonly.tt" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
139
            </Property>
140
          </Properties>
141
          <AuxValues>
142
            <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="16"/>
143
          </AuxValues>
144
        </Component>
145
      </SubComponents>
146
    </Container>
53
  </SubComponents>
147
  </SubComponents>
54
</Form>
148
</Form>
(-)git/src/org/netbeans/modules/git/ui/merge/MergeRevisionPanel.java (-5 / +54 lines)
Lines 72-91 Link Here
72
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
72
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
73
    private void initComponents() {
73
    private void initComponents() {
74
74
75
        rbFFOptions = new javax.swing.ButtonGroup();
75
        org.netbeans.modules.git.ui.repository.RevisionDialog revisionPickerDialog1 = this.revisionPanel;
76
        org.netbeans.modules.git.ui.repository.RevisionDialog revisionPickerDialog1 = this.revisionPanel;
76
        jLabel1 = new javax.swing.JLabel();
77
        jLabel1 = new javax.swing.JLabel();
78
        jPanel1 = new javax.swing.JPanel();
77
79
78
        jLabel1.setText(org.openide.util.NbBundle.getMessage(MergeRevisionPanel.class, "MergeRevisionPanel.jLabel1.text")); // NOI18N
80
        org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(MergeRevisionPanel.class, "MergeRevisionPanel.jLabel1.text")); // NOI18N
79
81
82
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(MergeRevisionPanel.class, "MergeRevisionPanel.ffModePanel.text"))); // NOI18N
83
84
        org.openide.awt.Mnemonics.setLocalizedText(rbFFOption, org.openide.util.NbBundle.getMessage(MergeRevisionPanel.class, "MergeRevision.ffoption.ff")); // NOI18N
85
        rbFFOption.setToolTipText(org.openide.util.NbBundle.getMessage(MergeRevisionPanel.class, "MergeRevision.ffoption.ff.tt")); // NOI18N
86
87
        org.openide.awt.Mnemonics.setLocalizedText(rbFFOptionNever, org.openide.util.NbBundle.getMessage(MergeRevisionPanel.class, "MergeRevision.ffoption.noff")); // NOI18N
88
        rbFFOptionNever.setToolTipText(org.openide.util.NbBundle.getMessage(MergeRevisionPanel.class, "MergeRevision.ffoption.noff.tt")); // NOI18N
89
90
        org.openide.awt.Mnemonics.setLocalizedText(rbFFOptionOnly, org.openide.util.NbBundle.getMessage(MergeRevisionPanel.class, "MergeRevision.ffoption.ffonly")); // NOI18N
91
        rbFFOptionOnly.setToolTipText(org.openide.util.NbBundle.getMessage(MergeRevisionPanel.class, "MergeRevision.ffoption.ffonly.tt")); // NOI18N
92
93
        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
94
        jPanel1.setLayout(jPanel1Layout);
95
        jPanel1Layout.setHorizontalGroup(
96
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
97
            .addGroup(jPanel1Layout.createSequentialGroup()
98
                .addContainerGap()
99
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
100
                    .addComponent(rbFFOptionNever)
101
                    .addComponent(rbFFOptionOnly)
102
                    .addComponent(rbFFOption))
103
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
104
        );
105
        jPanel1Layout.setVerticalGroup(
106
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
107
            .addGroup(jPanel1Layout.createSequentialGroup()
108
                .addContainerGap()
109
                .addComponent(rbFFOption)
110
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
111
                .addComponent(rbFFOptionOnly)
112
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
113
                .addComponent(rbFFOptionNever)
114
                .addContainerGap())
115
        );
116
80
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
117
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
81
        this.setLayout(layout);
118
        this.setLayout(layout);
82
        layout.setHorizontalGroup(
119
        layout.setHorizontalGroup(
83
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
120
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
121
            .addComponent(revisionPickerDialog1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
84
            .addGroup(layout.createSequentialGroup()
122
            .addGroup(layout.createSequentialGroup()
85
                .addContainerGap()
123
                .addContainerGap()
86
                .addComponent(jLabel1)
124
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
87
                .addContainerGap(106, Short.MAX_VALUE))
125
                    .addGroup(layout.createSequentialGroup()
88
            .addComponent(revisionPickerDialog1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
126
                        .addComponent(jLabel1)
127
                        .addGap(0, 0, Short.MAX_VALUE))
128
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
129
                .addContainerGap())
89
        );
130
        );
90
        layout.setVerticalGroup(
131
        layout.setVerticalGroup(
91
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
132
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
Lines 93-105 Link Here
93
                .addContainerGap()
134
                .addContainerGap()
94
                .addComponent(jLabel1)
135
                .addComponent(jLabel1)
95
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
136
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
96
                .addComponent(revisionPickerDialog1, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE))
137
                .addComponent(revisionPickerDialog1, javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE)
138
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
139
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
140
                .addContainerGap())
97
        );
141
        );
98
    }// </editor-fold>//GEN-END:initComponents
142
    }// </editor-fold>//GEN-END:initComponents
99
143
100
144
101
    // Variables declaration - do not modify//GEN-BEGIN:variables
145
    // Variables declaration - do not modify//GEN-BEGIN:variables
102
    private javax.swing.JLabel jLabel1;
146
    private javax.swing.JLabel jLabel1;
147
    private javax.swing.JPanel jPanel1;
148
    final javax.swing.JRadioButton rbFFOption = new javax.swing.JRadioButton();
149
    final javax.swing.JRadioButton rbFFOptionNever = new javax.swing.JRadioButton();
150
    final javax.swing.JRadioButton rbFFOptionOnly = new javax.swing.JRadioButton();
151
    private javax.swing.ButtonGroup rbFFOptions;
103
    // End of variables declaration//GEN-END:variables
152
    // End of variables declaration//GEN-END:variables
104
153
105
}
154
}

Return to bug 245236