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 127182
Collapse All | Expand All

(-)a/mercurial/src/org/netbeans/modules/mercurial/HgProgressSupport.java (-1 / +10 lines)
Lines 63-68 public abstract class HgProgressSupport Link Here
63
    private ProgressHandle progressHandle = null;    
63
    private ProgressHandle progressHandle = null;    
64
    private String displayName = ""; // NOI18N
64
    private String displayName = ""; // NOI18N
65
    private String originalDisplayName = ""; // NOI18N
65
    private String originalDisplayName = ""; // NOI18N
66
    private OutputLogger logger;
66
    private String repositoryRoot;
67
    private String repositoryRoot;
67
    private RequestProcessor.Task task;
68
    private RequestProcessor.Task task;
68
    
69
    
Lines 82-87 public abstract class HgProgressSupport Link Here
82
83
83
    public void setRepositoryRoot(String repositoryRoot) {
84
    public void setRepositoryRoot(String repositoryRoot) {
84
        this.repositoryRoot = repositoryRoot;
85
        this.repositoryRoot = repositoryRoot;
86
        logger = null;
85
    }
87
    }
86
88
87
    public void run() {        
89
    public void run() {        
Lines 98-103 public abstract class HgProgressSupport Link Here
98
            Mercurial.LOG.log(Level.FINE, "End - {0}", displayName); // NOI18N
100
            Mercurial.LOG.log(Level.FINE, "End - {0}", displayName); // NOI18N
99
        } finally {            
101
        } finally {            
100
            finnishProgress();
102
            finnishProgress();
103
            if (logger != null) logger.closeLog();
101
        }
104
        }
102
    }
105
    }
103
106
Lines 166-172 public abstract class HgProgressSupport Link Here
166
        getProgressHandle().finish();
169
        getProgressHandle().finish();
167
    }
170
    }
168
    
171
    
169
    
172
    public OutputLogger getLogger() {
173
        if (logger == null) {
174
            logger = Mercurial.getInstance().getLogger(repositoryRoot);
175
        }
176
        return logger;
177
    }
178
170
    public void annotate(HgException ex) {        
179
    public void annotate(HgException ex) {        
171
        ExceptionHandler eh = new ExceptionHandler(ex);
180
        ExceptionHandler eh = new ExceptionHandler(ex);
172
        if(isCanceled()) {
181
        if(isCanceled()) {
(-)a/mercurial/src/org/netbeans/modules/mercurial/Mercurial.java (-3 / +16 lines)
Lines 163-184 public class Mercurial { Link Here
163
                        NbBundle.getMessage(Mercurial.class, "MSG_VERSION_CONFIRM_QUERY", version), // NOI18N
163
                        NbBundle.getMessage(Mercurial.class, "MSG_VERSION_CONFIRM_QUERY", version), // NOI18N
164
                        NbBundle.getMessage(Mercurial.class, "MSG_VERSION_CONFIRM"), // NOI18N
164
                        NbBundle.getMessage(Mercurial.class, "MSG_VERSION_CONFIRM"), // NOI18N
165
                        JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
165
                        JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
166
                OutputLogger logger = getLogger(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE);
166
                if (response == JOptionPane.YES_OPTION) {
167
                if (response == JOptionPane.YES_OPTION) {
167
                    goodVersion = true;
168
                    goodVersion = true;
168
                    prefs.put(HgModuleConfig.PROP_RUN_VERSION, version);
169
                    prefs.put(HgModuleConfig.PROP_RUN_VERSION, version);
169
                    HgUtils.outputMercurialTabInRed(NbBundle.getMessage(Mercurial.class, "MSG_USING_VERSION_MSG", version)); // NOI18N);
170
                    logger.outputInRed(NbBundle.getMessage(Mercurial.class, "MSG_USING_VERSION_MSG", version)); // NOI18N);
170
                } else {
171
                } else {
171
                    prefs.remove(HgModuleConfig.PROP_RUN_VERSION);
172
                    prefs.remove(HgModuleConfig.PROP_RUN_VERSION);
172
                    HgUtils.outputMercurialTabInRed(NbBundle.getMessage(Mercurial.class, "MSG_NOT_USING_VERSION_MSG", version)); // NOI18N);
173
                    logger.outputInRed(NbBundle.getMessage(Mercurial.class, "MSG_NOT_USING_VERSION_MSG", version)); // NOI18N);
173
                }
174
                }
175
                logger.closeLog();
174
            } else {
176
            } else {
175
                goodVersion = true;
177
                goodVersion = true;
176
            }
178
            }
177
        } else if (version == null) {
179
        } else if (version == null) {
178
            Preferences prefs = HgModuleConfig.getDefault().getPreferences();
180
            Preferences prefs = HgModuleConfig.getDefault().getPreferences();
179
            prefs.remove(HgModuleConfig.PROP_RUN_VERSION);
181
            prefs.remove(HgModuleConfig.PROP_RUN_VERSION);
180
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(Mercurial.class, "MSG_VERSION_NONE_OUTPUT_MSG")); // NOI18N);
182
            OutputLogger logger = getLogger(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE);
183
            logger.outputInRed(NbBundle.getMessage(Mercurial.class, "MSG_VERSION_NONE_OUTPUT_MSG")); // NOI18N);
181
            HgUtils.warningDialog(Mercurial.class, "MSG_VERSION_NONE_TITLE", "MSG_VERSION_NONE_MSG");// NOI18N
184
            HgUtils.warningDialog(Mercurial.class, "MSG_VERSION_NONE_TITLE", "MSG_VERSION_NONE_MSG");// NOI18N
185
            logger.closeLog();
182
        }
186
        }
183
    }
187
    }
184
188
Lines 362-365 public class Mercurial { Link Here
362
        }
366
        }
363
    }
367
    }
364
368
369
    /**
370
     *
371
     * @param repositoryRoot String of Mercurial repository so that logger writes to correct output tab. Can be null
372
     * in which case the logger will not print anything
373
     * @return OutputLogger logger to write to
374
     */
375
    public OutputLogger getLogger(String repositoryRoot) {
376
        return OutputLogger.getLogger(repositoryRoot);
377
    }
365
}
378
}
(-)a/mercurial/src/org/netbeans/modules/mercurial/MercurialInterceptor.java (-6 / +9 lines)
Lines 129-135 public class MercurialInterceptor extend Link Here
129
                HgProgressSupport support = new HgProgressSupport() {
129
                HgProgressSupport support = new HgProgressSupport() {
130
                    public void perform() {
130
                    public void perform() {
131
                        try {
131
                        try {
132
                            HgCommand.doRemove(root, file);
132
                            HgCommand.doRemove(root, file, this.getLogger());
133
                            // We need to cache the status of all deleted files
133
                            // We need to cache the status of all deleted files
134
                            Map<File, FileInformation> interestingFiles = HgCommand.getInterestingStatus(root, file);
134
                            Map<File, FileInformation> interestingFiles = HgCommand.getInterestingStatus(root, file);
135
                            if (!interestingFiles.isEmpty()){
135
                            if (!interestingFiles.isEmpty()){
Lines 173-179 public class MercurialInterceptor extend Link Here
173
                HgProgressSupport support = new HgProgressSupport() {
173
                HgProgressSupport support = new HgProgressSupport() {
174
                    public void perform() {
174
                    public void perform() {
175
                        try {
175
                        try {
176
                            HgCommand.doRemove(root, file);
176
                            HgCommand.doRemove(root, file, this.getLogger());
177
                            cache.refresh(file, FileStatusCache.REPOSITORY_STATUS_UNKNOWN);
177
                            cache.refresh(file, FileStatusCache.REPOSITORY_STATUS_UNKNOWN);
178
                        } catch (HgException ex) {
178
                        } catch (HgException ex) {
179
                            Mercurial.LOG.log(Level.FINE, "fileDeletedImpl(): File: {0} {1}", new Object[] {file.getAbsolutePath(), ex.toString()}); // NOI18N
179
                            Mercurial.LOG.log(Level.FINE, "fileDeletedImpl(): File: {0} {1}", new Object[] {file.getAbsolutePath(), ex.toString()}); // NOI18N
Lines 245-253 public class MercurialInterceptor extend Link Here
245
        srcFile.renameTo(dstFile);
245
        srcFile.renameTo(dstFile);
246
        Runnable moveImpl = new Runnable() {
246
        Runnable moveImpl = new Runnable() {
247
            public void run() {
247
            public void run() {
248
                OutputLogger logger = OutputLogger.getLogger(root.getAbsolutePath());
248
                try {
249
                try {
249
                    if (dstFile.isDirectory()) {
250
                    if (dstFile.isDirectory()) {
250
                        HgCommand.doRenameAfter(root, srcFile, dstFile);
251
                        HgCommand.doRenameAfter(root, srcFile, dstFile, logger);
251
                        return;
252
                        return;
252
                    }
253
                    }
253
                    int status = HgCommand.getSingleStatus(root, srcFile.getParent(), srcFile.getName()).getStatus();
254
                    int status = HgCommand.getSingleStatus(root, srcFile.getParent(), srcFile.getName()).getStatus();
Lines 255-267 public class MercurialInterceptor extend Link Here
255
                    if (status == FileInformation.STATUS_NOTVERSIONED_NEWLOCALLY ||
256
                    if (status == FileInformation.STATUS_NOTVERSIONED_NEWLOCALLY ||
256
                        status == FileInformation.STATUS_NOTVERSIONED_EXCLUDED) {
257
                        status == FileInformation.STATUS_NOTVERSIONED_EXCLUDED) {
257
                    } else if (status == FileInformation.STATUS_VERSIONED_ADDEDLOCALLY) {
258
                    } else if (status == FileInformation.STATUS_VERSIONED_ADDEDLOCALLY) {
258
                        HgCommand.doRemove(root, srcFile);
259
                        HgCommand.doRemove(root, srcFile, logger);
259
                        HgCommand.doAdd(root, dstFile);
260
                        HgCommand.doAdd(root, dstFile, logger);
260
                    } else {
261
                    } else {
261
                        HgCommand.doRenameAfter(root, srcFile, dstFile);
262
                        HgCommand.doRenameAfter(root, srcFile, dstFile, logger);
262
                    }
263
                    }
263
                } catch (HgException e) {
264
                } catch (HgException e) {
264
                    Mercurial.LOG.log(Level.FINE, "Mercurial failed to rename: File: {0} {1}", new Object[] {srcFile.getAbsolutePath(), dstFile.getAbsolutePath()}); // NOI18N
265
                    Mercurial.LOG.log(Level.FINE, "Mercurial failed to rename: File: {0} {1}", new Object[] {srcFile.getAbsolutePath(), dstFile.getAbsolutePath()}); // NOI18N
266
                } finally {
267
                    logger.closeLog();
265
                }
268
                }
266
            }
269
            }
267
        };
270
        };
(-)c174e5a9390d (+258 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * Contributor(s):
25
 *
26
 * The Original Software is NetBeans. The Initial Developer of the Original
27
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
28
 * Microsystems, Inc. All Rights Reserved.
29
 *
30
 * If you wish your version of this file to be governed by only the CDDL
31
 * or only the GPL Version 2, indicate your decision by adding
32
 * "[Contributor] elects to include this software in this distribution
33
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
34
 * single choice of license, a recipient has the option to distribute
35
 * your version of this file under either the CDDL, the GPL Version 2 or
36
 * to extend the choice of license to its licensees as provided above.
37
 * However, if you add GPL Version 2 code and therefore, elected the GPL
38
 * Version 2 license, then the option applies only if the new code is
39
 * made subject to such option by the copyright holder.
40
 */
41
42
package org.netbeans.modules.mercurial;
43
44
import java.io.File;
45
import java.io.IOException;
46
import java.util.logging.Level;
47
import java.util.List;
48
import java.net.URL;
49
import org.openide.awt.HtmlBrowser;
50
import org.openide.util.RequestProcessor;
51
import org.openide.windows.IOProvider;
52
import org.openide.windows.InputOutput;
53
import org.openide.windows.OutputEvent;
54
import org.openide.windows.OutputWriter;
55
import org.openide.windows.OutputListener;
56
57
/**
58
 *
59
 * @author Tomas Stupka
60
 */
61
public class OutputLogger {
62
63
    private InputOutput log;
64
    private boolean ignoreCommand = false;
65
    private String repositoryRootString;
66
    private static final RequestProcessor rp = new RequestProcessor("MercurialOutput", 1);
67
    public static final int MAX_LINES_TO_PRINT = 500;
68
69
    private static final String MSG_TOO_MANY_LINES = "The number of output lines is greater than 500; see message log for complete output";
70
71
72
    public static OutputLogger getLogger(String repositoryRoot) {
73
        if (repositoryRoot != null) {
74
            return new OutputLogger(repositoryRoot);
75
        } else {
76
            return new NullLogger();
77
        }
78
    }
79
    
80
    private OutputLogger(String repositoryRoot) {
81
        repositoryRootString = repositoryRoot;
82
        log = IOProvider.getDefault().getIO(repositoryRootString, false);
83
    }
84
85
    private OutputLogger() {
86
    }
87
    
88
    public void closeLog() {
89
        rp.post(new Runnable() {
90
            public void run() {
91
                log.getOut().flush();
92
                log.getOut().close();        
93
                log.getErr().flush();
94
                log.getErr().close();        
95
            }
96
        });
97
    }
98
99
    public void flushLog() {
100
        rp.post(new Runnable() {
101
            public void run() {        
102
                log.getOut().flush();
103
                log.getErr().flush();
104
            }
105
        });        
106
    }
107
    
108
    /**
109
     * Print contents of list to OutputLogger's tab
110
     *
111
     * @param list to print out
112
     * 
113
     */
114
     public void output(final List<String> list){
115
        if( list.isEmpty()) return;
116
117
        rp.post(new Runnable() {
118
            public void run() {                
119
                log.select();
120
                OutputWriter out = log.getOut();
121
 
122
                int lines = list.size();
123
                if (lines > MAX_LINES_TO_PRINT) {
124
                    out.println(list.get(1));
125
                    out.println(list.get(2));
126
                    out.println(list.get(3));
127
                    out.println("...");
128
                    out.println(list.get(list.size() -1));
129
                    out.println(MSG_TOO_MANY_LINES);
130
                    for (String s : list){
131
                        Mercurial.LOG.log(Level.WARNING, s);
132
                    }
133
                } else {
134
                    for (String s : list){
135
                        out.println(s);
136
            	    }
137
            	}
138
                out.flush();
139
            }
140
        });
141
    }
142
143
    /**
144
     * Print msg to OutputLogger's tab
145
     *
146
     * @param String msg to print out
147
     * 
148
     */
149
    public void output(final String msg){
150
        if( msg == null) return;
151
152
        rp.post(new Runnable() {
153
            public void run() {                
154
                log.select();
155
156
                log.getOut().println(msg);
157
                log.getOut().flush();
158
            }
159
        });
160
    }
161
162
    /**
163
     * Print msg to OutputLogger's tab in Red
164
     *
165
     * @param String msg to print out
166
     * 
167
     */
168
    public void outputInRed(final String msg){
169
        if( msg == null) return;
170
171
        rp.post(new Runnable() {
172
            public void run() {                
173
                log.select();
174
                log.getErr().println(msg);
175
                log.getErr().flush();
176
            }
177
        });
178
    }
179
180
    /**
181
     * Print URL to OutputLogger's tab as an active Hyperlink
182
     *
183
     * @param String sURL to print out
184
     * 
185
     */
186
    public void outputLink(final String sURL){
187
        if (sURL == null) return;
188
         
189
        rp.post(new Runnable() {
190
            public void run() {                
191
                log.select();
192
                try {
193
                    OutputWriter out = log.getOut();
194
195
                    OutputListener listener = new OutputListener() {
196
                        public void outputLineAction(OutputEvent ev) {
197
                            try {
198
                                HtmlBrowser.URLDisplayer.getDefault().showURL(new URL(sURL));
199
                            } catch (IOException ex) {
200
                            // Ignore
201
                            }
202
                        }
203
                        public void outputLineSelected(OutputEvent ev) {}
204
                        public void outputLineCleared(OutputEvent ev) {}
205
                    };
206
                    out.println(sURL, listener, true);
207
                    out.flush();
208
                } catch (IOException ex) {
209
                // Ignore
210
                }
211
            }
212
        });
213
    }
214
215
    /**
216
     * Select and Clear OutputLogger's tab
217
     *
218
     * @param list to print out
219
     * 
220
     */
221
    public void clearOutput(){
222
        rp.post(new Runnable() {
223
            public void run() {                
224
                log.select();
225
                OutputWriter out = log.getOut();
226
         
227
                try {
228
                    out.reset();
229
                } catch (IOException ex) {
230
                    // Ignore Exception
231
                }
232
                out.flush();
233
            }
234
        });
235
    }
236
     
237
    private static class NullLogger extends OutputLogger {
238
239
        public void closeLog() {
240
        }
241
242
        public void flushLog() {
243
        }
244
245
        public void output(List<String> list){
246
        }
247
248
        public void output(String msg){
249
        }
250
        public void outputInRed(String msg){
251
        }
252
        public void outputLink(final String sURL){
253
        }
254
        public void clearOutput(){
255
        }
256
    }
257
258
}
(-)a/mercurial/src/org/netbeans/modules/mercurial/VersionsCache.java (-4 / +8 lines)
Lines 75-105 public class VersionsCache { Link Here
75
    public File getFileRevision(File base, String revision) throws IOException {
75
    public File getFileRevision(File base, String revision) throws IOException {
76
        if(revision.equals("-1")) return null; // NOI18N
76
        if(revision.equals("-1")) return null; // NOI18N
77
        
77
        
78
        File repository = Mercurial.getInstance().getTopmostManagedParent(base);
79
        OutputLogger logger = OutputLogger.getLogger(repository.getAbsolutePath());
78
        if (Setup.REVISION_BASE.equals(revision)) {
80
        if (Setup.REVISION_BASE.equals(revision)) {
79
            try {
81
            try {
80
                File tempFile = File.createTempFile("tmp", "-" + base.getName()); //NOI18N
82
                File tempFile = File.createTempFile("tmp", "-" + base.getName()); //NOI18N
81
                File repository = Mercurial.getInstance().getTopmostManagedParent(base);
83
                HgCommand.doCat(repository, base, tempFile, logger);
82
                HgCommand.doCat(repository, base, tempFile);
83
                if (tempFile.length() == 0) return null;
84
                if (tempFile.length() == 0) return null;
84
                return tempFile;
85
                return tempFile;
85
            } catch (HgException e) {
86
            } catch (HgException e) {
86
                IOException ioe = new IOException();
87
                IOException ioe = new IOException();
87
                ioe.initCause(e);
88
                ioe.initCause(e);
88
                throw ioe;
89
                throw ioe;
90
            } finally {
91
                logger.closeLog();
89
            }
92
            }
90
        } else if (Setup.REVISION_CURRENT.equals(revision)) {
93
        } else if (Setup.REVISION_CURRENT.equals(revision)) {
91
            return base;
94
            return base;
92
        } else {
95
        } else {
93
            try {
96
            try {
94
                File tempFile = File.createTempFile("tmp", "-" + base.getName()); //NOI18N
97
                File tempFile = File.createTempFile("tmp", "-" + base.getName()); //NOI18N
95
                File repository = Mercurial.getInstance().getTopmostManagedParent(base);
98
                HgCommand.doCat(repository, base, tempFile, revision, logger);
96
                HgCommand.doCat(repository, base, tempFile, revision);
97
                if (tempFile.length() == 0) return null;
99
                if (tempFile.length() == 0) return null;
98
                return tempFile;
100
                return tempFile;
99
            } catch (HgException e) {
101
            } catch (HgException e) {
100
                IOException ioe = new IOException();
102
                IOException ioe = new IOException();
101
                ioe.initCause(e);
103
                ioe.initCause(e);
102
                throw ioe;
104
                throw ioe;
105
            } finally {
106
                logger.closeLog();
103
            }
107
            }
104
        }
108
        }
105
    }
109
    }
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/annotate/AnnotateAction.java (-6 / +8 lines)
Lines 54-59 import org.netbeans.modules.mercurial.Hg Link Here
54
import org.netbeans.modules.mercurial.HgException;
54
import org.netbeans.modules.mercurial.HgException;
55
import org.netbeans.modules.mercurial.HgProgressSupport;
55
import org.netbeans.modules.mercurial.HgProgressSupport;
56
import org.netbeans.modules.mercurial.Mercurial;
56
import org.netbeans.modules.mercurial.Mercurial;
57
import org.netbeans.modules.mercurial.OutputLogger;
57
import org.netbeans.modules.mercurial.FileStatusCache;
58
import org.netbeans.modules.mercurial.FileStatusCache;
58
import org.netbeans.modules.mercurial.FileInformation;
59
import org.netbeans.modules.mercurial.FileInformation;
59
import org.netbeans.modules.mercurial.util.HgUtils;
60
import org.netbeans.modules.mercurial.util.HgUtils;
Lines 138-152 public class AnnotateAction extends Cont Link Here
138
            RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(repository);
139
            RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(repository);
139
            HgProgressSupport support = new HgProgressSupport() {
140
            HgProgressSupport support = new HgProgressSupport() {
140
                public void perform() {
141
                public void perform() {
141
                    HgUtils.outputMercurialTabInRed(
142
                    OutputLogger logger = getLogger();
143
                    logger.outputInRed(
142
                            NbBundle.getMessage(AnnotateAction.class,
144
                            NbBundle.getMessage(AnnotateAction.class,
143
                            "MSG_ANNOTATE_TITLE")); // NOI18N
145
                            "MSG_ANNOTATE_TITLE")); // NOI18N
144
                    HgUtils.outputMercurialTabInRed(
146
                    logger.outputInRed(
145
                            NbBundle.getMessage(AnnotateAction.class,
147
                            NbBundle.getMessage(AnnotateAction.class,
146
                            "MSG_ANNOTATE_TITLE_SEP")); // NOI18N
148
                            "MSG_ANNOTATE_TITLE_SEP")); // NOI18N
147
                    computeAnnotations(repository, file, this, ab);
149
                    computeAnnotations(repository, file, this, ab);
148
                    HgUtils.outputMercurialTab("\t" + file.getAbsolutePath()); // NOI18N
150
                    logger.output("\t" + file.getAbsolutePath()); // NOI18N
149
                    HgUtils.outputMercurialTabInRed(
151
                    logger.outputInRed(
150
                            NbBundle.getMessage(AnnotateAction.class,
152
                            NbBundle.getMessage(AnnotateAction.class,
151
                            "MSG_ANNOTATE_DONE")); // NOI18N
153
                            "MSG_ANNOTATE_DONE")); // NOI18N
152
                }
154
                }
Lines 158-164 public class AnnotateAction extends Cont Link Here
158
    private void computeAnnotations(File repository, File file, HgProgressSupport progress, AnnotationBar ab) {
160
    private void computeAnnotations(File repository, File file, HgProgressSupport progress, AnnotationBar ab) {
159
        List<String> list = null;
161
        List<String> list = null;
160
        try {
162
        try {
161
             list = HgCommand.doAnnotate(repository, file);
163
             list = HgCommand.doAnnotate(repository, file, progress.getLogger());
162
        } catch (HgException ex) {
164
        } catch (HgException ex) {
163
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
165
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
164
            DialogDisplayer.getDefault().notifyLater(e);
166
            DialogDisplayer.getDefault().notifyLater(e);
Lines 170-176 public class AnnotateAction extends Cont Link Here
170
        if (list == null) return;
172
        if (list == null) return;
171
        AnnotateLine [] lines = toAnnotateLines(list);
173
        AnnotateLine [] lines = toAnnotateLines(list);
172
        try {
174
        try {
173
             list = HgCommand.doLogShort(repository, file);
175
             list = HgCommand.doLogShort(repository, file, progress.getLogger());
174
        } catch (HgException ex) {
176
        } catch (HgException ex) {
175
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
177
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
176
            DialogDisplayer.getDefault().notifyLater(e);
178
            DialogDisplayer.getDefault().notifyLater(e);
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/annotate/AnnotationBar.java (-1 / +1 lines)
Lines 433-439 final class AnnotationBar extends JCompo Link Here
433
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root);
433
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root);
434
        HgProgressSupport support = new HgProgressSupport() {
434
        HgProgressSupport support = new HgProgressSupport() {
435
            public void perform() {                 
435
            public void perform() {                 
436
                RevertModificationsAction.performRevert(root, revStr, file, doBackup);
436
                RevertModificationsAction.performRevert(root, revStr, file, doBackup, this.getLogger());
437
            }
437
            }
438
        };
438
        };
439
        support.start(rp, root.getAbsolutePath(), NbBundle.getMessage(AnnotationBar.class, "MSG_Revert_Progress")); // NOI18N
439
        support.start(rp, root.getAbsolutePath(), NbBundle.getMessage(AnnotationBar.class, "MSG_Revert_Progress")); // NOI18N
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/clone/CloneAction.java (-14 / +17 lines)
Lines 55-60 import org.netbeans.modules.mercurial.Hg Link Here
55
import org.netbeans.modules.mercurial.HgException;
55
import org.netbeans.modules.mercurial.HgException;
56
import org.netbeans.modules.mercurial.HgProgressSupport;
56
import org.netbeans.modules.mercurial.HgProgressSupport;
57
import org.netbeans.modules.mercurial.Mercurial;
57
import org.netbeans.modules.mercurial.Mercurial;
58
import org.netbeans.modules.mercurial.OutputLogger;
58
import org.netbeans.modules.mercurial.HgModuleConfig;
59
import org.netbeans.modules.mercurial.HgModuleConfig;
59
import org.netbeans.modules.mercurial.config.HgConfigFiles;
60
import org.netbeans.modules.mercurial.config.HgConfigFiles;
60
import org.netbeans.modules.mercurial.util.HgCommand;
61
import org.netbeans.modules.mercurial.util.HgCommand;
Lines 144-149 public class CloneAction extends Context Link Here
144
            Runnable doOpenProject = new Runnable () {
145
            Runnable doOpenProject = new Runnable () {
145
                public void run()  {
146
                public void run()  {
146
                    // Open and set focus on the cloned project if possible
147
                    // Open and set focus on the cloned project if possible
148
                    OutputLogger logger = getLogger();
147
                    try {
149
                    try {
148
                        FileObject cloneProj = FileUtil.toFileObject(clonePrjFile);
150
                        FileObject cloneProj = FileUtil.toFileObject(clonePrjFile);
149
                        Project prj = null;
151
                        Project prj = null;
Lines 154-160 public class CloneAction extends Context Link Here
154
                            hg.versionedFilesChanged();
156
                            hg.versionedFilesChanged();
155
                            hg.refreshAllAnnotations();
157
                            hg.refreshAllAnnotations();
156
                        }else{
158
                        }else{
157
                            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(CloneAction.class,
159
                            logger.outputInRed( NbBundle.getMessage(CloneAction.class,
158
                                    "MSG_EXTERNAL_CLONE_PRJ_NOT_FOUND_CANT_SETASMAIN")); // NOI18N
160
                                    "MSG_EXTERNAL_CLONE_PRJ_NOT_FOUND_CANT_SETASMAIN")); // NOI18N
159
                        }
161
                        }
160
            
162
            
Lines 162-204 public class CloneAction extends Context Link Here
162
                        NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(new HgException(ex.toString()));
164
                        NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(new HgException(ex.toString()));
163
                        DialogDisplayer.getDefault().notifyLater(e);
165
                        DialogDisplayer.getDefault().notifyLater(e);
164
                    } finally{
166
                    } finally{
165
                       HgUtils.outputMercurialTabInRed(NbBundle.getMessage(CloneAction.class, "MSG_CLONE_DONE")); // NOI18N
167
                       logger.outputInRed(NbBundle.getMessage(CloneAction.class, "MSG_CLONE_DONE")); // NOI18N
166
                       HgUtils.outputMercurialTab(""); // NOI18N
168
                       logger.output(""); // NOI18N
167
                    }
169
                    }
168
                }
170
                }
169
            };
171
            };
170
            public void perform() {
172
            public void perform() {
173
                OutputLogger logger = getLogger();
171
                try {
174
                try {
172
                    // TODO: We need to annotate the cloned project 
175
                    // TODO: We need to annotate the cloned project 
173
                    // See http://qa.netbeans.org/issues/show_bug.cgi?id=112870
176
                    // See http://qa.netbeans.org/issues/show_bug.cgi?id=112870
174
                    HgUtils.outputMercurialTabInRed(
177
                    logger.outputInRed(
175
                            NbBundle.getMessage(CloneAction.class,
178
                            NbBundle.getMessage(CloneAction.class,
176
                            "MSG_CLONE_TITLE")); // NOI18N
179
                            "MSG_CLONE_TITLE")); // NOI18N
177
                    HgUtils.outputMercurialTabInRed(
180
                    logger.outputInRed(
178
                            NbBundle.getMessage(CloneAction.class,
181
                            NbBundle.getMessage(CloneAction.class,
179
                            "MSG_CLONE_TITLE_SEP")); // NOI18N
182
                            "MSG_CLONE_TITLE_SEP")); // NOI18N
180
                    List<String> list = HgCommand.doClone(source, target);
183
                    List<String> list = HgCommand.doClone(source, target, logger);
181
                    if(list != null && !list.isEmpty()){
184
                    if(list != null && !list.isEmpty()){
182
                        HgUtils.createIgnored(cloneFolder);
185
                        HgUtils.createIgnored(cloneFolder);
183
                        HgUtils.outputMercurialTab(list);
186
                        logger.output(list);
184
               
187
               
185
                        if (prjName != null) {
188
                        if (prjName != null) {
186
                            HgUtils.outputMercurialTabInRed(
189
                            logger.outputInRed(
187
                                    NbBundle.getMessage(CloneAction.class,
190
                                    NbBundle.getMessage(CloneAction.class,
188
                                    "MSG_CLONE_FROM", prjName, source)); // NOI18N
191
                                    "MSG_CLONE_FROM", prjName, source)); // NOI18N
189
                            HgUtils.outputMercurialTabInRed(
192
                            logger.outputInRed(
190
                                    NbBundle.getMessage(CloneAction.class,
193
                                    NbBundle.getMessage(CloneAction.class,
191
                                    "MSG_CLONE_TO", prjName, target)); // NOI18N
194
                                    "MSG_CLONE_TO", prjName, target)); // NOI18N
192
                        } else {
195
                        } else {
193
                            HgUtils.outputMercurialTabInRed(
196
                            logger.outputInRed(
194
                                    NbBundle.getMessage(CloneAction.class,
197
                                    NbBundle.getMessage(CloneAction.class,
195
                                    "MSG_EXTERNAL_CLONE_FROM", source)); // NOI18N
198
                                    "MSG_EXTERNAL_CLONE_FROM", source)); // NOI18N
196
                            HgUtils.outputMercurialTabInRed(
199
                            logger.outputInRed(
197
                                    NbBundle.getMessage(CloneAction.class,
200
                                    NbBundle.getMessage(CloneAction.class,
198
                                    "MSG_EXTERNAL_CLONE_TO", target)); // NOI18N
201
                                    "MSG_EXTERNAL_CLONE_TO", target)); // NOI18N
199
202
200
                        }
203
                        }
201
                        HgUtils.outputMercurialTab(""); // NOI18N
204
                        logger.output(""); // NOI18N
202
205
203
                        if (isLocalClone){
206
                        if (isLocalClone){
204
                            SwingUtilities.invokeLater(doOpenProject);
207
                            SwingUtilities.invokeLater(doOpenProject);
Lines 231-238 public class CloneAction extends Context Link Here
231
                        fixLocalPullPushPathsOnWindows(cloneFolder.getAbsolutePath(), defaultPull, defaultPush);
234
                        fixLocalPullPushPathsOnWindows(cloneFolder.getAbsolutePath(), defaultPull, defaultPush);
232
                    }
235
                    }
233
                    if(!isLocalClone){
236
                    if(!isLocalClone){
234
                        HgUtils.outputMercurialTabInRed(NbBundle.getMessage(CloneAction.class, "MSG_CLONE_DONE")); // NOI18N
237
                        logger.outputInRed(NbBundle.getMessage(CloneAction.class, "MSG_CLONE_DONE")); // NOI18N
235
                        HgUtils.outputMercurialTab(""); // NOI18N
238
                        logger.output(""); // NOI18N
236
                    }
239
                    }
237
                }
240
                }
238
            }
241
            }
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/commit/CommitAction.java (-17 / +21 lines)
Lines 46-51 import org.netbeans.modules.versioning.s Link Here
46
import org.netbeans.modules.versioning.spi.VCSContext;
46
import org.netbeans.modules.versioning.spi.VCSContext;
47
import org.netbeans.modules.versioning.util.Utils;
47
import org.netbeans.modules.versioning.util.Utils;
48
import org.netbeans.modules.mercurial.Mercurial;
48
import org.netbeans.modules.mercurial.Mercurial;
49
import org.netbeans.modules.mercurial.OutputLogger;
49
import org.netbeans.modules.mercurial.FileStatusCache;
50
import org.netbeans.modules.mercurial.FileStatusCache;
50
import org.netbeans.modules.mercurial.FileInformation;
51
import org.netbeans.modules.mercurial.FileInformation;
51
import org.netbeans.modules.mercurial.HgFileNode;
52
import org.netbeans.modules.mercurial.HgFileNode;
Lines 105-115 public class CommitAction extends Contex Link Here
105
    public void performAction(ActionEvent e) {
106
    public void performAction(ActionEvent e) {
106
        final File root = HgUtils.getRootFile(context);
107
        final File root = HgUtils.getRootFile(context);
107
        if (root == null) {
108
        if (root == null) {
108
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(CommitAction.class,"MSG_COMMIT_TITLE")); // NOI18N
109
            OutputLogger logger = OutputLogger.getLogger(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE);
109
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(CommitAction.class,"MSG_COMMIT_TITLE_SEP")); // NOI18N
110
            logger.outputInRed( NbBundle.getMessage(CommitAction.class,"MSG_COMMIT_TITLE")); // NOI18N
110
            HgUtils.outputMercurialTabInRed(
111
            logger.outputInRed( NbBundle.getMessage(CommitAction.class,"MSG_COMMIT_TITLE_SEP")); // NOI18N
112
            logger.outputInRed(
111
                    NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
113
                    NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
112
            HgUtils.outputMercurialTab(""); // NOI18N
114
            logger.output(""); // NOI18N
115
            logger.closeLog();
113
            JOptionPane.showMessageDialog(null,
116
            JOptionPane.showMessageDialog(null,
114
                    NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_NOT_SUPPORTED_INVIEW"),// NOI18N
117
                    NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_NOT_SUPPORTED_INVIEW"),// NOI18N
115
                    NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
118
                    NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
Lines 230-236 public class CommitAction extends Contex Link Here
230
            RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(repository.getAbsolutePath());
233
            RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(repository.getAbsolutePath());
231
            HgProgressSupport support = new HgProgressSupport() {
234
            HgProgressSupport support = new HgProgressSupport() {
232
                public void perform() {
235
                public void perform() {
233
                    performCommit(message, commitFiles, ctx, this, prjName);
236
                    OutputLogger logger = getLogger();
237
                    performCommit(message, commitFiles, ctx, this, prjName, logger);
234
                }
238
                }
235
            };
239
            };
236
            support.start(rp, repository.getAbsolutePath(), org.openide.util.NbBundle.getMessage(CommitAction.class, "LBL_Commit_Progress")); // NOI18N
240
            support.start(rp, repository.getAbsolutePath(), org.openide.util.NbBundle.getMessage(CommitAction.class, "LBL_Commit_Progress")); // NOI18N
Lines 314-320 public class CommitAction extends Contex Link Here
314
    }
318
    }
315
    
319
    
316
    private static void performCommit(String message, Map<HgFileNode, CommitOptions> commitFiles, 
320
    private static void performCommit(String message, Map<HgFileNode, CommitOptions> commitFiles, 
317
            VCSContext ctx, HgProgressSupport support, String prjName) {
321
            VCSContext ctx, HgProgressSupport support, String prjName, OutputLogger logger) {
318
        FileStatusCache cache = Mercurial.getInstance().getFileStatusCache();
322
        FileStatusCache cache = Mercurial.getInstance().getFileStatusCache();
319
        final File repository = HgUtils.getRootFile(ctx);
323
        final File repository = HgUtils.getRootFile(ctx);
320
        List<File> addCandidates = new ArrayList<File>();
324
        List<File> addCandidates = new ArrayList<File>();
Lines 351-391 public class CommitAction extends Contex Link Here
351
        }
355
        }
352
        
356
        
353
        try {
357
        try {
354
            HgUtils.outputMercurialTabInRed(
358
            logger.outputInRed(
355
                    NbBundle.getMessage(CommitAction.class,
359
                    NbBundle.getMessage(CommitAction.class,
356
                    "MSG_COMMIT_TITLE")); // NOI18N
360
                    "MSG_COMMIT_TITLE")); // NOI18N
357
            HgUtils.outputMercurialTabInRed(
361
            logger.outputInRed(
358
                    NbBundle.getMessage(CommitAction.class,
362
                    NbBundle.getMessage(CommitAction.class,
359
                    "MSG_COMMIT_TITLE_SEP")); // NOI18N
363
                    "MSG_COMMIT_TITLE_SEP")); // NOI18N
360
            HgUtils.outputMercurialTab(message); // NOI18N
364
            logger.output(message); // NOI18N
361
            if (addCandidates.size() > 0 ) {
365
            if (addCandidates.size() > 0 ) {
362
                HgCommand.doAdd(repository, addCandidates);
366
                HgCommand.doAdd(repository, addCandidates, logger);
363
                for (File f : addCandidates) {
367
                for (File f : addCandidates) {
364
                    HgUtils.outputMercurialTab("hg add " + f.getName()); //NOI18N
368
                    logger.output("hg add " + f.getName()); //NOI18N
365
                }
369
                }
366
            }
370
            }
367
            HgCommand.doCommit(repository, commitCandidates, message);
371
            HgCommand.doCommit(repository, commitCandidates, message, logger);
368
            HgRepositoryContextCache.setHasHistory(ctx);
372
            HgRepositoryContextCache.setHasHistory(ctx);
369
373
370
            if (commitCandidates.size() == 1) {
374
            if (commitCandidates.size() == 1) {
371
                HgUtils.outputMercurialTab(
375
                logger.output(
372
                        NbBundle.getMessage(CommitAction.class,
376
                        NbBundle.getMessage(CommitAction.class,
373
                        "MSG_COMMIT_INIT_SEP_ONE", commitCandidates.size(), prjName)); // NOI18N
377
                        "MSG_COMMIT_INIT_SEP_ONE", commitCandidates.size(), prjName)); // NOI18N
374
            } else {
378
            } else {
375
                HgUtils.outputMercurialTab(
379
                logger.output(
376
                        NbBundle.getMessage(CommitAction.class,
380
                        NbBundle.getMessage(CommitAction.class,
377
                        "MSG_COMMIT_INIT_SEP", commitCandidates.size(), prjName)); // NOI18N
381
                        "MSG_COMMIT_INIT_SEP", commitCandidates.size(), prjName)); // NOI18N
378
            }
382
            }
379
            for (File f : commitCandidates) {
383
            for (File f : commitCandidates) {
380
                HgUtils.outputMercurialTab("\t" + f.getAbsolutePath()); // NOI18N
384
                logger.output("\t" + f.getAbsolutePath()); // NOI18N
381
            }
385
            }
382
        } catch (HgException ex) {
386
        } catch (HgException ex) {
383
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
387
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
384
            DialogDisplayer.getDefault().notifyLater(e);
388
            DialogDisplayer.getDefault().notifyLater(e);
385
        } finally {
389
        } finally {
386
            cache.refreshCached(ctx);
390
            cache.refreshCached(ctx);
387
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_DONE")); // NOI18N
391
            logger.outputInRed(NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_DONE")); // NOI18N
388
            HgUtils.outputMercurialTab(""); // NOI18N
392
            logger.output(""); // NOI18N
389
        }
393
        }
390
    }
394
    }
391
}
395
}
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/create/CreateAction.java (-20 / +25 lines)
Lines 45-50 import java.util.logging.Level; Link Here
45
import java.util.logging.Level;
45
import java.util.logging.Level;
46
import org.netbeans.modules.mercurial.HgException;
46
import org.netbeans.modules.mercurial.HgException;
47
import org.netbeans.modules.mercurial.Mercurial;
47
import org.netbeans.modules.mercurial.Mercurial;
48
import org.netbeans.modules.mercurial.OutputLogger;
48
import org.netbeans.modules.mercurial.util.HgUtils;
49
import org.netbeans.modules.mercurial.util.HgUtils;
49
import org.netbeans.modules.versioning.spi.VCSContext;
50
import org.netbeans.modules.versioning.spi.VCSContext;
50
import org.netbeans.modules.versioning.util.Utils;
51
import org.netbeans.modules.versioning.util.Utils;
Lines 149-163 public class CreateAction extends Contex Link Here
149
        File projFile = HgUtils.getProjectFile(proj);
150
        File projFile = HgUtils.getProjectFile(proj);
150
        
151
        
151
        if (projFile == null) {
152
        if (projFile == null) {
152
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(CreateAction.class,"MSG_CREATE_TITLE")); // NOI18N
153
            OutputLogger logger = OutputLogger.getLogger(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE);
153
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(CreateAction.class,"MSG_CREATE_TITLE_SEP")); // NOI18N
154
            logger.outputInRed( NbBundle.getMessage(CreateAction.class,"MSG_CREATE_TITLE")); // NOI18N
154
            HgUtils.outputMercurialTabInRed(
155
            logger.outputInRed( NbBundle.getMessage(CreateAction.class,"MSG_CREATE_TITLE_SEP")); // NOI18N
156
            logger.outputInRed(
155
                    NbBundle.getMessage(CreateAction.class, "MSG_CREATE_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
157
                    NbBundle.getMessage(CreateAction.class, "MSG_CREATE_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
156
            HgUtils.outputMercurialTab(""); // NOI18N
158
            logger.output(""); // NOI18N
157
            JOptionPane.showMessageDialog(null,
159
            JOptionPane.showMessageDialog(null,
158
                    NbBundle.getMessage(CreateAction.class, "MSG_CREATE_NOT_SUPPORTED_INVIEW"),// NOI18N
160
                    NbBundle.getMessage(CreateAction.class, "MSG_CREATE_NOT_SUPPORTED_INVIEW"),// NOI18N
159
                    NbBundle.getMessage(CreateAction.class, "MSG_CREATE_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
161
                    NbBundle.getMessage(CreateAction.class, "MSG_CREATE_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
160
                    JOptionPane.INFORMATION_MESSAGE);
162
                    JOptionPane.INFORMATION_MESSAGE);
163
            logger.closeLog();
161
            return;
164
            return;
162
        }
165
        }
163
        String projName = HgProjectUtils.getProjectName(projFile);
166
        String projName = HgProjectUtils.getProjectName(projFile);
Lines 166-178 public class CreateAction extends Contex Link Here
166
        root = getCommonAncestor(files);
169
        root = getCommonAncestor(files);
167
        root = getCommonAncestor(root, projFile);
170
        root = getCommonAncestor(root, projFile);
168
        if (root == null) return;
171
        if (root == null) return;
169
        
170
        HgUtils.outputMercurialTabInRed(
171
                NbBundle.getMessage(CreateAction.class,
172
                "MSG_CREATE_TITLE")); // NOI18N
173
        HgUtils.outputMercurialTabInRed(
174
                NbBundle.getMessage(CreateAction.class,
175
                "MSG_CREATE_TITLE_SEP")); // NOI18N
176
        
172
        
177
        final File rootToManage = root;
173
        final File rootToManage = root;
178
        final String prjName = projName;
174
        final String prjName = projName;
Lines 183-192 public class CreateAction extends Contex Link Here
183
            public void perform() {
179
            public void perform() {
184
                
180
                
185
                try {
181
                try {
186
                    HgUtils.outputMercurialTab(
182
                    OutputLogger logger = getLogger();
183
                    logger.outputInRed(
184
                            NbBundle.getMessage(CreateAction.class,
185
                            "MSG_CREATE_TITLE")); // NOI18N
186
                    logger.outputInRed(
187
                            NbBundle.getMessage(CreateAction.class,
188
                            "MSG_CREATE_TITLE_SEP")); // NOI18N
189
        
190
                    logger.output(
187
                            NbBundle.getMessage(CreateAction.class,
191
                            NbBundle.getMessage(CreateAction.class,
188
                            "MSG_CREATE_INIT", prjName, rootToManage)); // NOI18N
192
                            "MSG_CREATE_INIT", prjName, rootToManage)); // NOI18N
189
                    HgCommand.doCreate(rootToManage);
193
                    HgCommand.doCreate(rootToManage, logger);
190
                    hg.versionedFilesChanged();
194
                    hg.versionedFilesChanged();
191
                    hg.refreshAllAnnotations();      
195
                    hg.refreshAllAnnotations();      
192
                } catch (HgException ex) {
196
                } catch (HgException ex) {
Lines 201-206 public class CreateAction extends Contex Link Here
201
        
205
        
202
        HgProgressSupport supportAdd = new HgProgressSupport() {
206
        HgProgressSupport supportAdd = new HgProgressSupport() {
203
            public void perform() {
207
            public void perform() {
208
                OutputLogger logger = getLogger();
204
                try {
209
                try {
205
                    File[] files = HgUtils.getProjectRootFiles(proj);
210
                    File[] files = HgUtils.getProjectRootFiles(proj);
206
                    FileStatusCache cache = hg.getFileStatusCache();
211
                    FileStatusCache cache = hg.getFileStatusCache();
Lines 212-238 public class CreateAction extends Contex Link Here
212
                        repositoryFiles = HgCommand.getUnknownStatus(rootToManage, rootFile);
217
                        repositoryFiles = HgCommand.getUnknownStatus(rootToManage, rootFile);
213
                        Calendar end = Calendar.getInstance();
218
                        Calendar end = Calendar.getInstance();
214
                        Mercurial.LOG.log(Level.FINE, "getUnknownStatus took {0} millisecs", end.getTimeInMillis() - start.getTimeInMillis()); // NOI18N
219
                        Mercurial.LOG.log(Level.FINE, "getUnknownStatus took {0} millisecs", end.getTimeInMillis() - start.getTimeInMillis()); // NOI18N
215
                        HgUtils.outputMercurialTab(
220
                        logger.output(
216
                                NbBundle.getMessage(CreateAction.class,
221
                                NbBundle.getMessage(CreateAction.class,
217
                                "MSG_CREATE_ADD", repositoryFiles.keySet().size(), rootFile.getAbsolutePath())); // NOI18N
222
                                "MSG_CREATE_ADD", repositoryFiles.keySet().size(), rootFile.getAbsolutePath())); // NOI18N
218
                        start = Calendar.getInstance(); cache.addToCache(repositoryFiles.keySet());
223
                        start = Calendar.getInstance(); cache.addToCache(repositoryFiles.keySet());
219
                        end = Calendar.getInstance();
224
                        end = Calendar.getInstance();
220
                        Mercurial.LOG.log(Level.FINE, "addUnknownsToCache took {0} millisecs", end.getTimeInMillis() - start.getTimeInMillis()); // NOI18N
225
                        Mercurial.LOG.log(Level.FINE, "addUnknownsToCache took {0} millisecs", end.getTimeInMillis() - start.getTimeInMillis()); // NOI18N
221
                        if (repositoryFiles.keySet().size() < HgUtils.MAX_LINES_TO_PRINT) {
226
                        if (repositoryFiles.keySet().size() < OutputLogger.MAX_LINES_TO_PRINT) {
222
                            for(File f: repositoryFiles.keySet()){
227
                            for(File f: repositoryFiles.keySet()){
223
                                HgUtils.outputMercurialTab("\t" + f.getAbsolutePath()); // NOI18N
228
                                logger.output("\t" + f.getAbsolutePath()); // NOI18N
224
                            }
229
                            }
225
                        }
230
                        }
226
                    }
231
                    }
227
                    HgUtils.createIgnored(rootToManage);
232
                    HgUtils.createIgnored(rootToManage);
228
                    HgUtils.outputMercurialTab(""); // NOI18N
233
                    logger.output(""); // NOI18N
229
                    HgUtils.outputMercurialTabInRed(NbBundle.getMessage(CreateAction.class, "MSG_CREATE_DONE_WARNING")); // NOI18N
234
                    logger.outputInRed(NbBundle.getMessage(CreateAction.class, "MSG_CREATE_DONE_WARNING")); // NOI18N
230
                } catch (HgException ex) {
235
                } catch (HgException ex) {
231
                    NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
236
                    NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
232
                    DialogDisplayer.getDefault().notifyLater(e);
237
                    DialogDisplayer.getDefault().notifyLater(e);
233
                } finally {
238
                } finally {
234
                    HgUtils.outputMercurialTabInRed(NbBundle.getMessage(CreateAction.class, "MSG_CREATE_DONE")); // NOI18N
239
                    logger.outputInRed(NbBundle.getMessage(CreateAction.class, "MSG_CREATE_DONE")); // NOI18N
235
                    HgUtils.outputMercurialTab(""); // NOI18N
240
                    logger.output(""); // NOI18N
236
                }
241
                }
237
            }
242
            }
238
        };
243
        };
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/diff/DiffAction.java (-4 / +7 lines)
Lines 50-55 import org.netbeans.modules.mercurial.Fi Link Here
50
import org.netbeans.modules.mercurial.FileInformation;
50
import org.netbeans.modules.mercurial.FileInformation;
51
import org.netbeans.modules.mercurial.FileStatusCache;
51
import org.netbeans.modules.mercurial.FileStatusCache;
52
import org.netbeans.modules.mercurial.Mercurial;
52
import org.netbeans.modules.mercurial.Mercurial;
53
import org.netbeans.modules.mercurial.OutputLogger;
53
import org.netbeans.modules.mercurial.util.HgUtils;
54
import org.netbeans.modules.mercurial.util.HgUtils;
54
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
55
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
55
import org.openide.nodes.Node;
56
import org.openide.nodes.Node;
Lines 78-88 public class DiffAction extends ContextA Link Here
78
        boolean bNotManaged = (root == null) || ( files == null || files.length == 0);
79
        boolean bNotManaged = (root == null) || ( files == null || files.length == 0);
79
80
80
        if (bNotManaged) {
81
        if (bNotManaged) {
81
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(DiffAction.class,"MSG_DIFF_TITLE")); // NOI18N
82
            OutputLogger logger = OutputLogger.getLogger(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE);
82
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(DiffAction.class,"MSG_DIFF_TITLE_SEP")); // NOI18N
83
            logger.outputInRed( NbBundle.getMessage(DiffAction.class,"MSG_DIFF_TITLE")); // NOI18N
83
            HgUtils.outputMercurialTabInRed(
84
            logger.outputInRed( NbBundle.getMessage(DiffAction.class,"MSG_DIFF_TITLE_SEP")); // NOI18N
85
            logger.outputInRed(
84
                    NbBundle.getMessage(DiffAction.class, "MSG_DIFF_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
86
                    NbBundle.getMessage(DiffAction.class, "MSG_DIFF_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
85
            HgUtils.outputMercurialTab(""); // NOI18N
87
            logger.output(""); // NOI18N
88
            logger.closeLog();
86
            JOptionPane.showMessageDialog(null,
89
            JOptionPane.showMessageDialog(null,
87
                    NbBundle.getMessage(DiffAction.class, "MSG_DIFF_NOT_SUPPORTED_INVIEW"),// NOI18N
90
                    NbBundle.getMessage(DiffAction.class, "MSG_DIFF_NOT_SUPPORTED_INVIEW"),// NOI18N
88
                    NbBundle.getMessage(DiffAction.class, "MSG_DIFF_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
91
                    NbBundle.getMessage(DiffAction.class, "MSG_DIFF_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/diff/ExportDiffAction.java (-9 / +11 lines)
Lines 50-55 import org.netbeans.modules.mercurial.Hg Link Here
50
import org.netbeans.modules.mercurial.HgException;
50
import org.netbeans.modules.mercurial.HgException;
51
import org.netbeans.modules.mercurial.HgProgressSupport;
51
import org.netbeans.modules.mercurial.HgProgressSupport;
52
import org.netbeans.modules.mercurial.Mercurial;
52
import org.netbeans.modules.mercurial.Mercurial;
53
import org.netbeans.modules.mercurial.OutputLogger;
53
import org.netbeans.modules.mercurial.HgModuleConfig;
54
import org.netbeans.modules.mercurial.HgModuleConfig;
54
import org.netbeans.modules.mercurial.util.HgUtils;
55
import org.netbeans.modules.mercurial.util.HgUtils;
55
import org.netbeans.modules.mercurial.util.HgCommand;
56
import org.netbeans.modules.mercurial.util.HgCommand;
Lines 104-132 public class ExportDiffAction extends Co Link Here
104
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root.getAbsolutePath());
105
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root.getAbsolutePath());
105
        HgProgressSupport support = new HgProgressSupport() {
106
        HgProgressSupport support = new HgProgressSupport() {
106
            public void perform() {
107
            public void perform() {
107
                performExport(root, revStr, outputFileName);
108
                OutputLogger logger = getLogger();
109
                performExport(root, revStr, outputFileName, logger);
108
            }
110
            }
109
        };
111
        };
110
        support.start(rp, root.getAbsolutePath(), org.openide.util.NbBundle.getMessage(ExportDiffAction.class, "LBL_ExportDiff_Progress")); // NOI18N
112
        support.start(rp, root.getAbsolutePath(), org.openide.util.NbBundle.getMessage(ExportDiffAction.class, "LBL_ExportDiff_Progress")); // NOI18N
111
    }
113
    }
112
114
113
    private static void performExport(File repository, String revStr, String outputFileName) {
115
    private static void performExport(File repository, String revStr, String outputFileName, OutputLogger logger) {
114
    try {
116
    try {
115
        HgUtils.outputMercurialTabInRed(
117
        logger.outputInRed(
116
                NbBundle.getMessage(ExportDiffAction.class,
118
                NbBundle.getMessage(ExportDiffAction.class,
117
                "MSG_EXPORT_TITLE")); // NOI18N
119
                "MSG_EXPORT_TITLE")); // NOI18N
118
        HgUtils.outputMercurialTabInRed(
120
        logger.outputInRed(
119
                NbBundle.getMessage(ExportDiffAction.class,
121
                NbBundle.getMessage(ExportDiffAction.class,
120
                "MSG_EXPORT_TITLE_SEP")); // NOI18N
122
                "MSG_EXPORT_TITLE_SEP")); // NOI18N
121
        
123
        
122
        if (NbBundle.getMessage(ExportDiffAction.class,
124
        if (NbBundle.getMessage(ExportDiffAction.class,
123
                "MSG_Revision_Default").startsWith(revStr)) {
125
                "MSG_Revision_Default").startsWith(revStr)) {
124
            HgUtils.outputMercurialTab(
126
            logger.output(
125
                    NbBundle.getMessage(ExportDiffAction.class,
127
                    NbBundle.getMessage(ExportDiffAction.class,
126
                    "MSG_EXPORT_NOTHING")); // NOI18N
128
                    "MSG_EXPORT_NOTHING")); // NOI18N
127
        } else {
129
        } else {
128
            List<String> list = HgCommand.doExport(repository, revStr, outputFileName);
130
            List<String> list = HgCommand.doExport(repository, revStr, outputFileName, logger);
129
            HgUtils.outputMercurialTab(list); // NOI18N
131
            logger.output(list); // NOI18N
130
            if (!list.isEmpty() && list.size() > 1) {
132
            if (!list.isEmpty() && list.size() > 1) {
131
                File outFile = new File(list.get(1));
133
                File outFile = new File(list.get(1));
132
                if (outFile != null && outFile.canRead()) {
134
                if (outFile != null && outFile.canRead()) {
Lines 138-145 public class ExportDiffAction extends Co Link Here
138
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
140
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
139
            DialogDisplayer.getDefault().notifyLater(e);
141
            DialogDisplayer.getDefault().notifyLater(e);
140
        } finally {
142
        } finally {
141
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(ExportDiffAction.class, "MSG_EXPORT_DONE")); // NOI18N
143
            logger.outputInRed(NbBundle.getMessage(ExportDiffAction.class, "MSG_EXPORT_DONE")); // NOI18N
142
            HgUtils.outputMercurialTab(""); // NOI18N
144
            logger.output(""); // NOI18N
143
        }
145
        }
144
    }
146
    }
145
}
147
}
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/diff/ImportDiffAction.java (-8 / +10 lines)
Lines 50-55 import org.netbeans.modules.mercurial.Hg Link Here
50
import org.netbeans.modules.mercurial.HgException;
50
import org.netbeans.modules.mercurial.HgException;
51
import org.netbeans.modules.mercurial.HgProgressSupport;
51
import org.netbeans.modules.mercurial.HgProgressSupport;
52
import org.netbeans.modules.mercurial.Mercurial;
52
import org.netbeans.modules.mercurial.Mercurial;
53
import org.netbeans.modules.mercurial.OutputLogger;
53
import org.netbeans.modules.mercurial.HgModuleConfig;
54
import org.netbeans.modules.mercurial.HgModuleConfig;
54
import org.netbeans.modules.mercurial.util.HgUtils;
55
import org.netbeans.modules.mercurial.util.HgUtils;
55
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
56
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
Lines 107-113 public class ImportDiffAction extends Co Link Here
107
                RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root.getAbsolutePath());
108
                RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root.getAbsolutePath());
108
                HgProgressSupport support = new HgProgressSupport() {
109
                HgProgressSupport support = new HgProgressSupport() {
109
                    public void perform() {
110
                    public void perform() {
110
                        performImport(root, patchFile);
111
                        OutputLogger logger = getLogger();
112
                        performImport(root, patchFile, logger);
111
                    }
113
                    }
112
                };
114
                };
113
                support.start(rp, root.getAbsolutePath(), org.openide.util.NbBundle.getMessage(ImportDiffAction.class, "LBL_ImportDiff_Progress")); // NOI18N
115
                support.start(rp, root.getAbsolutePath(), org.openide.util.NbBundle.getMessage(ImportDiffAction.class, "LBL_ImportDiff_Progress")); // NOI18N
Lines 115-139 public class ImportDiffAction extends Co Link Here
115
        }
117
        }
116
    }
118
    }
117
119
118
    private static void performImport(File repository, File patchFile) {
120
    private static void performImport(File repository, File patchFile, OutputLogger logger) {
119
    try {
121
    try {
120
        HgUtils.outputMercurialTabInRed(
122
        logger.outputInRed(
121
                NbBundle.getMessage(ImportDiffAction.class,
123
                NbBundle.getMessage(ImportDiffAction.class,
122
                "MSG_IMPORT_TITLE")); // NOI18N
124
                "MSG_IMPORT_TITLE")); // NOI18N
123
        HgUtils.outputMercurialTabInRed(
125
        logger.outputInRed(
124
                NbBundle.getMessage(ImportDiffAction.class,
126
                NbBundle.getMessage(ImportDiffAction.class,
125
                "MSG_IMPORT_TITLE_SEP")); // NOI18N
127
                "MSG_IMPORT_TITLE_SEP")); // NOI18N
126
128
127
        List<String> list = HgCommand.doImport(repository, patchFile);
129
        List<String> list = HgCommand.doImport(repository, patchFile, logger);
128
        Mercurial.getInstance().changesetChanged(repository);
130
        Mercurial.getInstance().changesetChanged(repository);
129
        HgUtils.outputMercurialTab(list); // NOI18N
131
        logger.output(list); // NOI18N
130
132
131
        } catch (HgException ex) {
133
        } catch (HgException ex) {
132
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
134
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
133
            DialogDisplayer.getDefault().notifyLater(e);
135
            DialogDisplayer.getDefault().notifyLater(e);
134
        } finally {
136
        } finally {
135
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(ImportDiffAction.class, "MSG_IMPORT_DONE")); // NOI18N
137
            logger.outputInRed(NbBundle.getMessage(ImportDiffAction.class, "MSG_IMPORT_DONE")); // NOI18N
136
            HgUtils.outputMercurialTab(""); // NOI18N
138
            logger.output(""); // NOI18N
137
        }
139
        }
138
    }
140
    }
139
}
141
}
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/ignore/IgnoreAction.java (-15 / +16 lines)
Lines 134-174 public class IgnoreAction extends Contex Link Here
134
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(repository.getAbsolutePath());
134
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(repository.getAbsolutePath());
135
        HgProgressSupport support = new HgProgressSupport() {
135
        HgProgressSupport support = new HgProgressSupport() {
136
            public void perform() {
136
            public void perform() {
137
                OutputLogger logger = getLogger();
137
                try {
138
                try {
138
                    mActionStatus = getActionStatus(files);
139
                    mActionStatus = getActionStatus(files);
139
                    if (mActionStatus == UNDEFINED) {
140
                    if (mActionStatus == UNDEFINED) {
140
                        HgUtils.outputMercurialTabInRed(
141
                        logger.outputInRed(
141
                                NbBundle.getMessage(IgnoreAction.class, "MSG_IGNORE_TITLE")); // NOI18N
142
                                NbBundle.getMessage(IgnoreAction.class, "MSG_IGNORE_TITLE")); // NOI18N
142
                        HgUtils.outputMercurialTabInRed(
143
                        logger.outputInRed(
143
                                NbBundle.getMessage(IgnoreAction.class, "MSG_IGNORE_TITLE_SEP")); // NOI18N
144
                                NbBundle.getMessage(IgnoreAction.class, "MSG_IGNORE_TITLE_SEP")); // NOI18N
144
                        HgUtils.outputMercurialTab(
145
                        logger.output(
145
                                NbBundle.getMessage(IgnoreAction.class, "MSG_IGNORE_ONLY_LOCALLY_NEW")); // NOI18N
146
                                NbBundle.getMessage(IgnoreAction.class, "MSG_IGNORE_ONLY_LOCALLY_NEW")); // NOI18N
146
                        HgUtils.outputMercurialTabInRed(
147
                        logger.outputInRed(
147
                                NbBundle.getMessage(IgnoreAction.class, "MSG_IGNORE_DONE")); // NOI18N
148
                                NbBundle.getMessage(IgnoreAction.class, "MSG_IGNORE_DONE")); // NOI18N
148
                        HgUtils.outputMercurialTab(""); // NOI18N
149
                        logger.output(""); // NOI18N
149
                        return;
150
                        return;
150
                    }
151
                    }
151
        
152
        
152
                    if (mActionStatus == IGNORING) {
153
                    if (mActionStatus == IGNORING) {
153
                        HgUtils.addIgnored(repository, files);
154
                        HgUtils.addIgnored(repository, files);
154
                        HgUtils.outputMercurialTabInRed(
155
                        logger.outputInRed(
155
                                NbBundle.getMessage(IgnoreAction.class,
156
                                NbBundle.getMessage(IgnoreAction.class,
156
                                "MSG_IGNORE_TITLE")); // NOI18N
157
                                "MSG_IGNORE_TITLE")); // NOI18N
157
                        HgUtils.outputMercurialTabInRed(
158
                        logger.outputInRed(
158
                                NbBundle.getMessage(IgnoreAction.class,
159
                                NbBundle.getMessage(IgnoreAction.class,
159
                                "MSG_IGNORE_TITLE_SEP")); // NOI18N
160
                                "MSG_IGNORE_TITLE_SEP")); // NOI18N
160
                        HgUtils.outputMercurialTab(
161
                        logger.output(
161
                                NbBundle.getMessage(IgnoreAction.class,
162
                                NbBundle.getMessage(IgnoreAction.class,
162
                                "MSG_IGNORE_INIT_SEP", repository.getName())); // NOI18N                          
163
                                "MSG_IGNORE_INIT_SEP", repository.getName())); // NOI18N                          
163
                    } else {
164
                    } else {
164
                        HgUtils.removeIgnored(repository, files);
165
                        HgUtils.removeIgnored(repository, files);
165
                        HgUtils.outputMercurialTabInRed(
166
                        logger.outputInRed(
166
                                NbBundle.getMessage(IgnoreAction.class,
167
                                NbBundle.getMessage(IgnoreAction.class,
167
                                "MSG_UNIGNORE_TITLE")); // NOI18N
168
                                "MSG_UNIGNORE_TITLE")); // NOI18N
168
                        HgUtils.outputMercurialTabInRed(
169
                        logger.outputInRed(
169
                                NbBundle.getMessage(IgnoreAction.class,
170
                                NbBundle.getMessage(IgnoreAction.class,
170
                                "MSG_UNIGNORE_TITLE_SEP")); // NOI18N
171
                                "MSG_UNIGNORE_TITLE_SEP")); // NOI18N
171
                        HgUtils.outputMercurialTab(
172
                        logger.output(
172
                                NbBundle.getMessage(IgnoreAction.class,
173
                                NbBundle.getMessage(IgnoreAction.class,
173
                                "MSG_UNIGNORE_INIT_SEP", repository.getName())); // NOI18N
174
                                "MSG_UNIGNORE_INIT_SEP", repository.getName())); // NOI18N
174
                    }
175
                    }
Lines 179-196 public class IgnoreAction extends Contex Link Here
179
                // refresh files manually
180
                // refresh files manually
180
                for (File file : files) {
181
                for (File file : files) {
181
                    Mercurial.getInstance().getFileStatusCache().refresh(file, FileStatusCache.REPOSITORY_STATUS_UNKNOWN);
182
                    Mercurial.getInstance().getFileStatusCache().refresh(file, FileStatusCache.REPOSITORY_STATUS_UNKNOWN);
182
                    HgUtils.outputMercurialTab("\t" + file.getAbsolutePath()); // NOI18N
183
                    logger.output("\t" + file.getAbsolutePath()); // NOI18N
183
                }
184
                }
184
                if (mActionStatus == IGNORING) {
185
                if (mActionStatus == IGNORING) {
185
                    HgUtils.outputMercurialTabInRed(
186
                    logger.outputInRed(
186
                            NbBundle.getMessage(IgnoreAction.class,
187
                            NbBundle.getMessage(IgnoreAction.class,
187
                            "MSG_IGNORE_DONE")); // NOI18N
188
                            "MSG_IGNORE_DONE")); // NOI18N
188
                } else {
189
                } else {
189
                    HgUtils.outputMercurialTabInRed(
190
                    logger.outputInRed(
190
                            NbBundle.getMessage(IgnoreAction.class,
191
                            NbBundle.getMessage(IgnoreAction.class,
191
                            "MSG_UNIGNORE_DONE")); // NOI18N
192
                            "MSG_UNIGNORE_DONE")); // NOI18N
192
                }
193
                }
193
                HgUtils.outputMercurialTab(""); // NOI18N
194
                logger.output(""); // NOI18N
194
            }
195
            }
195
        };
196
        };
196
        support.start(rp, repository.getAbsolutePath(), org.openide.util.NbBundle.getMessage(IgnoreAction.class, "LBL_Ignore_Progress")); // NOI18N
197
        support.start(rp, repository.getAbsolutePath(), org.openide.util.NbBundle.getMessage(IgnoreAction.class, "LBL_Ignore_Progress")); // NOI18N
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/log/HgLogMessage.java (-2 / +5 lines)
Lines 46-51 import org.netbeans.modules.mercurial.Fi Link Here
46
import org.netbeans.modules.mercurial.FileInformation;
46
import org.netbeans.modules.mercurial.FileInformation;
47
import org.netbeans.modules.mercurial.FileStatus;
47
import org.netbeans.modules.mercurial.FileStatus;
48
import org.netbeans.modules.mercurial.Mercurial;
48
import org.netbeans.modules.mercurial.Mercurial;
49
import org.netbeans.modules.mercurial.OutputLogger;
49
import org.netbeans.modules.mercurial.util.HgUtils;
50
import org.netbeans.modules.mercurial.util.HgUtils;
50
51
51
/**
52
/**
Lines 120-127 public class HgLogMessage { Link Here
120
        FileInformation fi = Mercurial.getInstance().getFileStatusCache().getStatus(file);
121
        FileInformation fi = Mercurial.getInstance().getFileStatusCache().getStatus(file);
121
        FileStatus fs = fi != null? fi.getStatus(file): null;
122
        FileStatus fs = fi != null? fi.getStatus(file): null;
122
        if (fs != null && fs.isCopied()) {
123
        if (fs != null && fs.isCopied()) {
123
            HgUtils.outputMercurialTabInRed("*** Copied: " + s + " : " +
124
            OutputLogger logger = OutputLogger.getLogger(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE);
124
                    fs.getFile() != null ? fs.getFile().getAbsolutePath() : "no filepath");
125
            
126
            logger.outputInRed("*** Copied: " + s + " : " + fs.getFile() != null ? fs.getFile().getAbsolutePath() : "no filepath");
127
            logger.closeLog();
125
        }
128
        }
126
    }
129
    }
127
    
130
    
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/log/SearchExecutor.java (-8 / +10 lines)
Lines 49-54 import java.io.File; Link Here
49
import java.io.File;
49
import java.io.File;
50
import org.netbeans.modules.mercurial.HgProgressSupport;
50
import org.netbeans.modules.mercurial.HgProgressSupport;
51
import org.netbeans.modules.mercurial.Mercurial;
51
import org.netbeans.modules.mercurial.Mercurial;
52
import org.netbeans.modules.mercurial.OutputLogger;
52
import org.netbeans.modules.mercurial.util.HgCommand;
53
import org.netbeans.modules.mercurial.util.HgCommand;
53
import org.netbeans.modules.mercurial.util.HgUtils;
54
import org.netbeans.modules.mercurial.util.HgUtils;
54
55
Lines 86-110 class SearchExecutor implements Runnable Link Here
86
        filterUsername = criteria.getUsername() != null;
87
        filterUsername = criteria.getUsername() != null;
87
        filterMessage = criteria.getCommitMessage() != null;
88
        filterMessage = criteria.getCommitMessage() != null;
88
        
89
        
90
        OutputLogger logger = OutputLogger.getLogger(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE);
89
        if (master.isIncomingSearch()) {
91
        if (master.isIncomingSearch()) {
90
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(SearchHistoryAction.class,
92
            logger.outputInRed( NbBundle.getMessage(SearchHistoryAction.class,
91
                "MSG_LogIncoming_Title")); // NOI18N
93
                "MSG_LogIncoming_Title")); // NOI18N
92
        }else if (master.isOutSearch()) {
94
        }else if (master.isOutSearch()) {
93
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(SearchHistoryAction.class,
95
            logger.outputInRed( NbBundle.getMessage(SearchHistoryAction.class,
94
                "MSG_LogOut_Title")); // NOI18N
96
                "MSG_LogOut_Title")); // NOI18N
95
        } else {
97
        } else {
96
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(SearchHistoryAction.class,
98
            logger.outputInRed( NbBundle.getMessage(SearchHistoryAction.class,
97
                "MSG_Log_Title")); // NOI18N
99
                "MSG_Log_Title")); // NOI18N
98
        }
100
        }
99
        HgUtils.outputMercurialTabInRed( NbBundle.getMessage(SearchHistoryAction.class,
101
        logger.outputInRed( NbBundle.getMessage(SearchHistoryAction.class,
100
                "MSG_Log_Title_Sep")); // NOI18N
102
                "MSG_Log_Title_Sep")); // NOI18N
101
        HgUtils.outputMercurialTab( NbBundle.getMessage(SearchHistoryAction.class,
103
        logger.output( NbBundle.getMessage(SearchHistoryAction.class,
102
                "MSG_LOG_EXEC_CONTEXT_SEP")); // NOI18N
104
                "MSG_LOG_EXEC_CONTEXT_SEP")); // NOI18N
103
        pathToRoot = new HashMap<String, File>(); 
105
        pathToRoot = new HashMap<String, File>(); 
104
        if (searchingUrl()) {
106
        if (searchingUrl()) {
105
            String rootPath = Mercurial.getInstance().getTopmostManagedParent(master.getRoots()[0]).toString();
107
            String rootPath = Mercurial.getInstance().getTopmostManagedParent(master.getRoots()[0]).toString();
106
            pathToRoot.put(rootPath, master.getRoots()[0]);
108
            pathToRoot.put(rootPath, master.getRoots()[0]);
107
            HgUtils.outputMercurialTab(rootPath);
109
            logger.output(rootPath);
108
        } else {
110
        } else {
109
             workFiles = new HashMap<String, Set<File>>();
111
             workFiles = new HashMap<String, Set<File>>();
110
            for (File file : master.getRoots()) {
112
            for (File file : master.getRoots()) {
Lines 116-125 class SearchExecutor implements Runnable Link Here
116
                    workFiles.put(rootPath, set);
118
                    workFiles.put(rootPath, set);
117
                }
119
                }
118
                set.add(file);
120
                set.add(file);
119
                HgUtils.outputMercurialTab(file.getAbsolutePath());
121
                logger.output(file.getAbsolutePath());
120
            }
122
            }
121
        } 
123
        } 
122
        HgUtils.outputMercurialTab(""); // NOI18N
124
        logger.output(""); // NOI18N
123
125
124
    }    
126
    }    
125
        
127
        
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/log/SearchHistoryAction.java (-6 / +10 lines)
Lines 49-54 import java.io.File; Link Here
49
import java.io.File;
49
import java.io.File;
50
import java.util.*;
50
import java.util.*;
51
import org.netbeans.modules.mercurial.FileInformation;
51
import org.netbeans.modules.mercurial.FileInformation;
52
import org.netbeans.modules.mercurial.OutputLogger;
52
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
53
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
53
import org.netbeans.modules.mercurial.util.HgUtils;
54
import org.netbeans.modules.mercurial.util.HgUtils;
54
import org.netbeans.modules.versioning.spi.VCSContext;
55
import org.netbeans.modules.versioning.spi.VCSContext;
Lines 94-114 public class SearchHistoryAction extends Link Here
94
        SwingUtilities.invokeLater(new Runnable() {
95
        SwingUtilities.invokeLater(new Runnable() {
95
            public void run() {
96
            public void run() {
96
                if (context == null) return;
97
                if (context == null) return;
97
                HgUtils.outputMercurialTabInRed(
98
                File root = HgUtils.getRootFile(context);
99
                OutputLogger logger = OutputLogger.getLogger(root.getAbsolutePath());
100
                logger.outputInRed(
98
                        NbBundle.getMessage(SearchHistoryAction.class,
101
                        NbBundle.getMessage(SearchHistoryAction.class,
99
                        "MSG_Log_Title")); // NOI18N
102
                        "MSG_Log_Title")); // NOI18N
100
                HgUtils.outputMercurialTabInRed(
103
                logger.outputInRed(
101
                        NbBundle.getMessage(SearchHistoryAction.class,
104
                        NbBundle.getMessage(SearchHistoryAction.class,
102
                        "MSG_Log_Title_Sep")); // NOI18N
105
                        "MSG_Log_Title_Sep")); // NOI18N
103
                File[] files = context.getFiles().toArray(new File[0]);
106
                File[] files = context.getFiles().toArray(new File[0]);
104
                HgUtils.outputMercurialTab(
107
                logger.output(
105
                        NbBundle.getMessage(SearchHistoryAction.class,
108
                        NbBundle.getMessage(SearchHistoryAction.class,
106
                        "MSG_LOG_CONTEXT_SEP")); // NOI18N
109
                        "MSG_LOG_CONTEXT_SEP")); // NOI18N
107
                for(File f: files){
110
                for(File f: files){
108
                    HgUtils.outputMercurialTab(f.getAbsolutePath());
111
                    logger.output(f.getAbsolutePath());
109
                }
112
                }
110
                HgUtils.outputMercurialTabInRed(""); // NOI18N
113
                logger.outputInRed(""); // NOI18N
111
                 SearchHistoryTopComponent tc = new SearchHistoryTopComponent(context);
114
                logger.closeLog();
115
                SearchHistoryTopComponent tc = new SearchHistoryTopComponent(context);
112
                tc.setDisplayName(title);
116
                tc.setDisplayName(title);
113
                tc.open();
117
                tc.open();
114
                tc.requestActive();
118
                tc.requestActive();
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/log/SummaryView.java (-2 / +2 lines)
Lines 437-443 class SummaryView implements MouseListen Link Here
437
                revertFiles.add(event.getFile());
437
                revertFiles.add(event.getFile());
438
            }
438
            }
439
            RevertModificationsAction.performRevert(
439
            RevertModificationsAction.performRevert(
440
                        root, revision.getLog().getRevision(), revertFiles, doBackup);
440
                        root, revision.getLog().getRevision(), revertFiles, doBackup, progress.getLogger());
441
            revertFiles.clear();
441
            revertFiles.clear();
442
        }
442
        }
443
        
443
        
Lines 467-473 class SummaryView implements MouseListen Link Here
467
                if(revEvents != null && !revEvents.isEmpty()){
467
                if(revEvents != null && !revEvents.isEmpty()){
468
                    // Assuming all files in a given repository reverting to same revision
468
                    // Assuming all files in a given repository reverting to same revision
469
                    RevertModificationsAction.performRevert(
469
                    RevertModificationsAction.performRevert(
470
                        root, revEvents.get(0).getLogInfoHeader().getLog().getRevision(), revertFiles, doBackup);
470
                        root, revEvents.get(0).getLogInfoHeader().getLog().getRevision(), revertFiles, doBackup, progress.getLogger());
471
                }
471
                }
472
            }                       
472
            }                       
473
        }
473
        }
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/merge/MergeAction.java (-43 / +31 lines)
Lines 44-49 import java.util.List; Link Here
44
import java.util.List;
44
import java.util.List;
45
import org.netbeans.modules.mercurial.HgException;
45
import org.netbeans.modules.mercurial.HgException;
46
import org.netbeans.modules.mercurial.Mercurial;
46
import org.netbeans.modules.mercurial.Mercurial;
47
import org.netbeans.modules.mercurial.OutputLogger;
47
import org.netbeans.modules.versioning.spi.VCSContext;
48
import org.netbeans.modules.versioning.spi.VCSContext;
48
import javax.swing.*;
49
import javax.swing.*;
49
import java.awt.event.ActionEvent;
50
import java.awt.event.ActionEvent;
Lines 85-95 public class MergeAction extends Context Link Here
85
    public void performAction(ActionEvent ev) {
86
    public void performAction(ActionEvent ev) {
86
        final File root = HgUtils.getRootFile(context);
87
        final File root = HgUtils.getRootFile(context);
87
        if (root == null) {
88
        if (root == null) {
88
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(MergeAction.class,"MSG_MERGE_TITLE")); // NOI18N
89
            OutputLogger logger = OutputLogger.getLogger(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE);
89
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(MergeAction.class,"MSG_MERGE_TITLE_SEP")); // NOI18N
90
            logger.outputInRed( NbBundle.getMessage(MergeAction.class,"MSG_MERGE_TITLE")); // NOI18N
90
            HgUtils.outputMercurialTabInRed(
91
            logger.outputInRed( NbBundle.getMessage(MergeAction.class,"MSG_MERGE_TITLE_SEP")); // NOI18N
92
            logger.outputInRed(
91
                    NbBundle.getMessage(MergeAction.class, "MSG_MERGE_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
93
                    NbBundle.getMessage(MergeAction.class, "MSG_MERGE_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
92
            HgUtils.outputMercurialTab(""); // NOI18N
94
            logger.output(""); // NOI18N
95
            logger.closeLog();
93
            JOptionPane.showMessageDialog(null,
96
            JOptionPane.showMessageDialog(null,
94
                    NbBundle.getMessage(MergeAction.class, "MSG_MERGE_NOT_SUPPORTED_INVIEW"),// NOI18N
97
                    NbBundle.getMessage(MergeAction.class, "MSG_MERGE_NOT_SUPPORTED_INVIEW"),// NOI18N
95
                    NbBundle.getMessage(MergeAction.class, "MSG_MERGE_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
98
                    NbBundle.getMessage(MergeAction.class, "MSG_MERGE_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
Lines 100-114 public class MergeAction extends Context Link Here
100
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(repository);
103
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(repository);
101
        HgProgressSupport support = new HgProgressSupport() {
104
        HgProgressSupport support = new HgProgressSupport() {
102
            public void perform() {
105
            public void perform() {
106
                OutputLogger logger = getLogger();
103
                try {
107
                try {
104
                    List<String> headList = HgCommand.getHeadRevisions(root);
108
                    List<String> headList = HgCommand.getHeadRevisions(root);
105
                    String revStr = null;
109
                    String revStr = null;
106
                    if (headList.size() <= 1) {
110
                    if (headList.size() <= 1) {
107
                        HgUtils.outputMercurialTabInRed( NbBundle.getMessage(MergeAction.class,"MSG_MERGE_TITLE")); // NOI18N
111
                        logger.outputInRed( NbBundle.getMessage(MergeAction.class,"MSG_MERGE_TITLE")); // NOI18N
108
                        HgUtils.outputMercurialTabInRed( NbBundle.getMessage(MergeAction.class,"MSG_MERGE_TITLE_SEP")); // NOI18N
112
                        logger.outputInRed( NbBundle.getMessage(MergeAction.class,"MSG_MERGE_TITLE_SEP")); // NOI18N
109
                        HgUtils.outputMercurialTab( NbBundle.getMessage(MergeAction.class,"MSG_NOTHING_TO_MERGE")); // NOI18N
113
                        logger.output( NbBundle.getMessage(MergeAction.class,"MSG_NOTHING_TO_MERGE")); // NOI18N
110
                        HgUtils.outputMercurialTabInRed( NbBundle.getMessage(MergeAction.class, "MSG_MERGE_DONE")); // NOI18N
114
                        logger.outputInRed( NbBundle.getMessage(MergeAction.class, "MSG_MERGE_DONE")); // NOI18N
111
                        HgUtils.outputMercurialTab(""); // NOI18N
115
                        logger.output(""); // NOI18N
112
                        JOptionPane.showMessageDialog(null,
116
                        JOptionPane.showMessageDialog(null,
113
                            NbBundle.getMessage(MergeAction.class,"MSG_NOTHING_TO_MERGE"),// NOI18N
117
                            NbBundle.getMessage(MergeAction.class,"MSG_NOTHING_TO_MERGE"),// NOI18N
114
                            NbBundle.getMessage(MergeAction.class,"MSG_MERGE_TITLE"),// NOI18N
118
                            NbBundle.getMessage(MergeAction.class,"MSG_MERGE_TITLE"),// NOI18N
Lines 121-133 public class MergeAction extends Context Link Here
121
                        }
125
                        }
122
                        revStr = mergeDlg.getSelectionRevision();               
126
                        revStr = mergeDlg.getSelectionRevision();               
123
                    }
127
                    }
124
                    HgUtils.outputMercurialTabInRed(
128
                    logger.outputInRed(
125
                            NbBundle.getMessage(MergeAction.class, "MSG_MERGE_TITLE")); // NOI18N
129
                            NbBundle.getMessage(MergeAction.class, "MSG_MERGE_TITLE")); // NOI18N
126
                    HgUtils.outputMercurialTabInRed(
130
                    logger.outputInRed(
127
                            NbBundle.getMessage(MergeAction.class, "MSG_MERGE_TITLE_SEP")); // NOI18N
131
                            NbBundle.getMessage(MergeAction.class, "MSG_MERGE_TITLE_SEP")); // NOI18N
128
                    doMergeAction(root, revStr);
132
                    doMergeAction(root, revStr, logger);
129
                    HgUtils.forceStatusRefreshProject(context);
133
                    HgUtils.forceStatusRefreshProject(context);
130
                    HgUtils.outputMercurialTab(""); // NOI18N
134
                    logger.output(""); // NOI18N
131
                } catch (HgException ex) {
135
                } catch (HgException ex) {
132
                    NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
136
                    NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
133
                    DialogDisplayer.getDefault().notifyLater(e);
137
                    DialogDisplayer.getDefault().notifyLater(e);
Lines 137-153 public class MergeAction extends Context Link Here
137
        support.start(rp, repository, NbBundle.getMessage(MergeAction.class, "MSG_MERGE_PROGRESS")); // NOI18N
141
        support.start(rp, repository, NbBundle.getMessage(MergeAction.class, "MSG_MERGE_PROGRESS")); // NOI18N
138
    }
142
    }
139
143
140
    public static boolean doMergeAction(File root, String revStr) throws HgException {
144
    public static boolean doMergeAction(File root, String revStr, OutputLogger logger) throws HgException {
141
        List<String> listMerge = HgCommand.doMerge(root, revStr);
145
        List<String> listMerge = HgCommand.doMerge(root, revStr);
142
        Boolean bConflicts = false;
146
        Boolean bConflicts = false;
143
        Boolean bMergeFailed = false;
147
        Boolean bMergeFailed = false;
144
        
148
        
145
        if (listMerge != null && !listMerge.isEmpty()) {
149
        if (listMerge != null && !listMerge.isEmpty()) {
146
            HgUtils.outputMercurialTab(listMerge);          
150
            logger.output(listMerge);
147
            for (String line : listMerge) {
151
            for (String line : listMerge) {
148
                if (HgCommand.isMergeAbortUncommittedMsg(line)){ 
152
                if (HgCommand.isMergeAbortUncommittedMsg(line)){ 
149
                    bMergeFailed = true;
153
                    bMergeFailed = true;
150
                    HgUtils.outputMercurialTabInRed(NbBundle.getMessage(MergeAction.class,
154
                    logger.outputInRed(NbBundle.getMessage(MergeAction.class,
151
                            "MSG_MERGE_FAILED")); // NOI18N
155
                            "MSG_MERGE_FAILED")); // NOI18N
152
                    JOptionPane.showMessageDialog(null,
156
                    JOptionPane.showMessageDialog(null,
153
                        NbBundle.getMessage(MergeAction.class,"MSG_MERGE_UNCOMMITTED"), // NOI18N
157
                        NbBundle.getMessage(MergeAction.class,"MSG_MERGE_UNCOMMITTED"), // NOI18N
Lines 158-164 public class MergeAction extends Context Link Here
158
162
159
                if (HgCommand.isMergeAbortMultipleHeadsMsg(line)){ 
163
                if (HgCommand.isMergeAbortMultipleHeadsMsg(line)){ 
160
                    bMergeFailed = true;
164
                    bMergeFailed = true;
161
                    HgUtils.outputMercurialTabInRed(NbBundle.getMessage(MergeAction.class,
165
                    logger.outputInRed(NbBundle.getMessage(MergeAction.class,
162
                            "MSG_MERGE_FAILED")); // NOI18N
166
                            "MSG_MERGE_FAILED")); // NOI18N
163
                    break;
167
                    break;
164
                }
168
                }
Lines 174-180 public class MergeAction extends Context Link Here
174
                    }else{
178
                    }else{
175
                        filepath = line.substring(HgCommand.HG_MERGE_CONFLICT_ERR.length());
179
                        filepath = line.substring(HgCommand.HG_MERGE_CONFLICT_ERR.length());
176
                    }
180
                    }
177
                    HgUtils.outputMercurialTabInRed(NbBundle.getMessage(MergeAction.class, "MSG_MERGE_CONFLICT", filepath)); // NOI18N
181
                    logger.outputInRed(NbBundle.getMessage(MergeAction.class, "MSG_MERGE_CONFLICT", filepath)); // NOI18N
178
                    HgCommand.createConflictFile(filepath);
182
                    HgCommand.createConflictFile(filepath);
179
                }
183
                }
180
                
184
                
Lines 183-235 public class MergeAction extends Context Link Here
183
                                NbBundle.getMessage(MergeAction.class, "MSG_MERGE_UNAVAILABLE"), // NOI18N
187
                                NbBundle.getMessage(MergeAction.class, "MSG_MERGE_UNAVAILABLE"), // NOI18N
184
                                NbBundle.getMessage(MergeAction.class, "MSG_MERGE_TITLE"), // NOI18N
188
                                NbBundle.getMessage(MergeAction.class, "MSG_MERGE_TITLE"), // NOI18N
185
                                JOptionPane.WARNING_MESSAGE);
189
                                JOptionPane.WARNING_MESSAGE);
186
                        HgUtils.outputMercurialTabInRed(
190
                        logger.outputInRed(
187
                                NbBundle.getMessage(MergeAction.class, "MSG_MERGE_INFO"));// NOI18N            
191
                                NbBundle.getMessage(MergeAction.class, "MSG_MERGE_INFO"));// NOI18N            
188
                        HgUtils.outputMercurialTabLink(
192
                        logger.outputLink(
189
                                NbBundle.getMessage(MergeAction.class, "MSG_MERGE_INFO_URL")); // NOI18N 
193
                                NbBundle.getMessage(MergeAction.class, "MSG_MERGE_INFO_URL")); // NOI18N 
190
                }            
194
                }            
191
            }
195
            }
192
                  
196
                  
193
            if (bConflicts) {
197
            if (bConflicts) {
194
                HgUtils.outputMercurialTabInRed(NbBundle.getMessage(MergeAction.class, 
198
                logger.outputInRed(NbBundle.getMessage(MergeAction.class, 
195
                        "MSG_MERGE_DONE_CONFLICTS")); // NOI18N
199
                        "MSG_MERGE_DONE_CONFLICTS")); // NOI18N
196
            }
200
            }
197
            if (!bMergeFailed && !bConflicts) {
201
            if (!bMergeFailed && !bConflicts) {
198
                HgUtils.outputMercurialTabInRed(NbBundle.getMessage(MergeAction.class, 
202
                logger.outputInRed(NbBundle.getMessage(MergeAction.class, 
199
                        "MSG_MERGE_DONE")); // NOI18N
203
                        "MSG_MERGE_DONE")); // NOI18N
200
            }
204
            }
201
        }
205
        }
202
        return true;
206
        return true;
203
    }
207
    }
204
    
208
    
205
    public static void printMergeWarning(OutputWriter outRed, List<String> list){
209
    public static void printMergeWarning(List<String> list, OutputLogger logger){
206
        if(list == null || list.isEmpty() || list.size() <= 1) return;
210
        if(list == null || list.isEmpty() || list.size() <= 1) return;
207
        
211
        
208
        if (list.size() == 2) {
212
        if (list.size() == 2) {
209
            outRed.println(NbBundle.getMessage(MergeAction.class, 
213
            logger.outputInRed(NbBundle.getMessage(MergeAction.class, 
210
                    "MSG_MERGE_WARN_NEEDED", list)); // NOI18N
214
                    "MSG_MERGE_WARN_NEEDED", list)); // NOI18N
211
            outRed.println(NbBundle.getMessage(MergeAction.class, 
215
            logger.outputInRed(NbBundle.getMessage(MergeAction.class, 
212
                    "MSG_MERGE_DO_NEEDED")); // NOI18N
216
                    "MSG_MERGE_DO_NEEDED")); // NOI18N
213
        } else {
217
        } else {
214
            outRed.println(NbBundle.getMessage(MergeAction.class, 
218
            logger.outputInRed(NbBundle.getMessage(MergeAction.class, 
215
                    "MSG_MERGE_WARN_MULTIPLE_HEADS", list.size(), list)); // NOI18N
219
                    "MSG_MERGE_WARN_MULTIPLE_HEADS", list.size(), list)); // NOI18N
216
            outRed.println(NbBundle.getMessage(MergeAction.class, 
220
            logger.outputInRed(NbBundle.getMessage(MergeAction.class, 
217
                    "MSG_MERGE_DONE_MULTIPLE_HEADS")); // NOI18N
218
        }
219
    }
220
    
221
    public static void printMergeWarning(List<String> list){
222
        if(list == null || list.isEmpty() || list.size() <= 1) return;
223
        
224
        if (list.size() == 2) {
225
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(MergeAction.class, 
226
                    "MSG_MERGE_WARN_NEEDED", list)); // NOI18N
227
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(MergeAction.class, 
228
                    "MSG_MERGE_DO_NEEDED")); // NOI18N
229
        } else {
230
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(MergeAction.class, 
231
                    "MSG_MERGE_WARN_MULTIPLE_HEADS", list.size(), list)); // NOI18N
232
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(MergeAction.class, 
233
                    "MSG_MERGE_DONE_MULTIPLE_HEADS")); // NOI18N
221
                    "MSG_MERGE_DONE_MULTIPLE_HEADS")); // NOI18N
234
        }
222
        }
235
    }
223
    }
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/pull/FetchAction.java (-9 / +11 lines)
Lines 43-48 import org.netbeans.modules.mercurial.ui Link Here
43
import org.netbeans.modules.mercurial.ui.view.*;
43
import org.netbeans.modules.mercurial.ui.view.*;
44
import org.netbeans.modules.versioning.spi.VCSContext;
44
import org.netbeans.modules.versioning.spi.VCSContext;
45
import org.netbeans.modules.mercurial.Mercurial;
45
import org.netbeans.modules.mercurial.Mercurial;
46
import org.netbeans.modules.mercurial.OutputLogger;
46
import org.netbeans.modules.mercurial.HgException;
47
import org.netbeans.modules.mercurial.HgException;
47
import org.netbeans.modules.mercurial.util.HgCommand;
48
import org.netbeans.modules.mercurial.util.HgCommand;
48
import org.netbeans.modules.mercurial.util.HgUtils;
49
import org.netbeans.modules.mercurial.util.HgUtils;
Lines 87-117 public class FetchAction extends Context Link Here
87
        
88
        
88
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root);
89
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root);
89
        HgProgressSupport support = new HgProgressSupport() {
90
        HgProgressSupport support = new HgProgressSupport() {
90
            public void perform() { performFetch(root); } };
91
            OutputLogger logger = getLogger();
92
            public void perform() { performFetch(root, logger); } };
91
93
92
        support.start(rp, root.getAbsolutePath(), org.openide.util.NbBundle.getMessage(FetchAction.class, "MSG_FETCH_PROGRESS")); // NOI18N
94
        support.start(rp, root.getAbsolutePath(), org.openide.util.NbBundle.getMessage(FetchAction.class, "MSG_FETCH_PROGRESS")); // NOI18N
93
    }
95
    }
94
96
95
    static void performFetch(File root) {
97
    static void performFetch(File root, OutputLogger logger) {
96
        try {
98
        try {
97
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(FetchAction.class, "MSG_FETCH_TITLE")); // NOI18N
99
            logger.outputInRed(NbBundle.getMessage(FetchAction.class, "MSG_FETCH_TITLE")); // NOI18N
98
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(FetchAction.class, "MSG_FETCH_TITLE_SEP")); // NOI18N
100
            logger.outputInRed(NbBundle.getMessage(FetchAction.class, "MSG_FETCH_TITLE_SEP")); // NOI18N
99
            
101
            
100
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(FetchAction.class, 
102
            logger.outputInRed(NbBundle.getMessage(FetchAction.class, 
101
                    "MSG_FETCH_LAUNCH_INFO", root.getAbsolutePath())); // NOI18N
103
                    "MSG_FETCH_LAUNCH_INFO", root.getAbsolutePath())); // NOI18N
102
            
104
            
103
            List<String> list;
105
            List<String> list;
104
            list = HgCommand.doFetch(root);
106
            list = HgCommand.doFetch(root, logger);
105
            
107
            
106
            if (list != null && !list.isEmpty()) {
108
            if (list != null && !list.isEmpty()) {
107
                HgUtils.outputMercurialTab(HgUtils.replaceHttpPassword(list));
109
                logger.output(HgUtils.replaceHttpPassword(list));
108
            }
110
            }
109
        } catch (HgException ex) {
111
        } catch (HgException ex) {
110
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
112
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
111
            DialogDisplayer.getDefault().notifyLater(e);
113
            DialogDisplayer.getDefault().notifyLater(e);
112
        }finally{
114
        }finally{
113
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(FetchAction.class, "MSG_FETCH_DONE")); // NOI18N
115
            logger.outputInRed(NbBundle.getMessage(FetchAction.class, "MSG_FETCH_DONE")); // NOI18N
114
            HgUtils.outputMercurialTab(""); // NOI18N
116
            logger.output(""); // NOI18N
115
        }
117
        }
116
    }
118
    }
117
119
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/pull/PullAction.java (-36 / +39 lines)
Lines 53-58 import org.netbeans.modules.mercurial.Hg Link Here
53
import org.netbeans.modules.mercurial.HgException;
53
import org.netbeans.modules.mercurial.HgException;
54
import org.netbeans.modules.mercurial.HgProgressSupport;
54
import org.netbeans.modules.mercurial.HgProgressSupport;
55
import org.netbeans.modules.mercurial.Mercurial;
55
import org.netbeans.modules.mercurial.Mercurial;
56
import org.netbeans.modules.mercurial.OutputLogger;
56
import org.netbeans.modules.mercurial.ui.merge.MergeAction;
57
import org.netbeans.modules.mercurial.ui.merge.MergeAction;
57
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
58
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
58
import org.netbeans.modules.mercurial.util.HgCommand;
59
import org.netbeans.modules.mercurial.util.HgCommand;
Lines 96-117 public class PullAction extends ContextA Link Here
96
    public void performAction(ActionEvent e) {
97
    public void performAction(ActionEvent e) {
97
        final File root = HgUtils.getRootFile(context);
98
        final File root = HgUtils.getRootFile(context);
98
        if (root == null) {
99
        if (root == null) {
99
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(PullAction.class,"MSG_PULL_TITLE")); // NOI18N
100
            OutputLogger logger = OutputLogger.getLogger(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE);
100
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(PullAction.class,"MSG_PULL_TITLE_SEP")); // NOI18N
101
            logger.outputInRed( NbBundle.getMessage(PullAction.class,"MSG_PULL_TITLE")); // NOI18N
101
            HgUtils.outputMercurialTabInRed(
102
            logger.outputInRed( NbBundle.getMessage(PullAction.class,"MSG_PULL_TITLE_SEP")); // NOI18N
103
            logger.outputInRed(
102
                    NbBundle.getMessage(PullAction.class, "MSG_PULL_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
104
                    NbBundle.getMessage(PullAction.class, "MSG_PULL_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
103
            HgUtils.outputMercurialTab(""); // NOI18N
105
            logger.output(""); // NOI18N
104
            JOptionPane.showMessageDialog(null,
106
            JOptionPane.showMessageDialog(null,
105
                    NbBundle.getMessage(PullAction.class, "MSG_PULL_NOT_SUPPORTED_INVIEW"),// NOI18N
107
                    NbBundle.getMessage(PullAction.class, "MSG_PULL_NOT_SUPPORTED_INVIEW"),// NOI18N
106
                    NbBundle.getMessage(PullAction.class, "MSG_PULL_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
108
                    NbBundle.getMessage(PullAction.class, "MSG_PULL_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
107
                    JOptionPane.INFORMATION_MESSAGE);
109
                    JOptionPane.INFORMATION_MESSAGE);
110
            logger.closeLog();
108
            return;
111
            return;
109
        }
112
        }
110
        pull(context);
113
        pull(context);
111
    }
114
    }
112
115
113
    public static boolean confirmWithLocalChanges(File rootFile, Class bundleLocation, String title, String query, 
116
    public static boolean confirmWithLocalChanges(File rootFile, Class bundleLocation, String title, String query, 
114
            List<String> listIncoming) {
117
            List<String> listIncoming, OutputLogger logger) {
115
        FileStatusCache cache = Mercurial.getInstance().getFileStatusCache();
118
        FileStatusCache cache = Mercurial.getInstance().getFileStatusCache();
116
        File[] roots = new File[1];
119
        File[] roots = new File[1];
117
        roots[0] = rootFile;
120
        roots[0] = rootFile;
Lines 144-151 public class PullAction extends ContextA Link Here
144
        }
147
        }
145
148
146
        if (listIncomingAndLocalMod != null && listIncomingAndLocalMod.size() > 0) {
149
        if (listIncomingAndLocalMod != null && listIncomingAndLocalMod.size() > 0) {
147
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(PullAction.class, "MSG_PULL_OVERWRITE_LOCAL")); // NOI18N
150
            logger.outputInRed(NbBundle.getMessage(PullAction.class, "MSG_PULL_OVERWRITE_LOCAL")); // NOI18N
148
            HgUtils.outputMercurialTab(listIncomingAndLocalMod);
151
            logger.output(listIncomingAndLocalMod);
149
            int response = JOptionPane.showOptionDialog(null, 
152
            int response = JOptionPane.showOptionDialog(null, 
150
                    NbBundle.getMessage(bundleLocation, query), NbBundle.getMessage(bundleLocation, title), 
153
                    NbBundle.getMessage(bundleLocation, query), NbBundle.getMessage(bundleLocation, title), 
151
                    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
154
                    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
Lines 183-189 public class PullAction extends ContextA Link Here
183
186
184
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(repository);
187
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(repository);
185
        HgProgressSupport support = new HgProgressSupport() {
188
        HgProgressSupport support = new HgProgressSupport() {
186
            public void perform() { getDefaultAndPerformPull(ctx, root); } };
189
            public void perform() { getDefaultAndPerformPull(ctx, root, this.getLogger()); } };
187
190
188
        support.start(rp, repository, org.openide.util.NbBundle.getMessage(PullAction.class, "MSG_PULL_PROGRESS")); // NOI18N
191
        support.start(rp, repository, org.openide.util.NbBundle.getMessage(PullAction.class, "MSG_PULL_PROGRESS")); // NOI18N
189
    }
192
    }
Lines 192-206 public class PullAction extends ContextA Link Here
192
        return HgUtils.getRootFile(context) != null;
195
        return HgUtils.getRootFile(context) != null;
193
    }
196
    }
194
197
195
    static void getDefaultAndPerformPull(VCSContext ctx, File root) {
198
    static void getDefaultAndPerformPull(VCSContext ctx, File root, OutputLogger logger) {
196
        final String pullPath = HgCommand.getPullDefault(root);
199
        final String pullPath = HgCommand.getPullDefault(root);
197
        // If the repository has no default pull path then inform user
200
        // If the repository has no default pull path then inform user
198
        if(pullPath == null) {
201
        if(pullPath == null) {
199
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(PullAction.class,"MSG_PULL_TITLE")); // NOI18N
202
            logger.outputInRed( NbBundle.getMessage(PullAction.class,"MSG_PULL_TITLE")); // NOI18N
200
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(PullAction.class,"MSG_PULL_TITLE_SEP")); // NOI18N
203
            logger.outputInRed( NbBundle.getMessage(PullAction.class,"MSG_PULL_TITLE_SEP")); // NOI18N
201
            HgUtils.outputMercurialTab(NbBundle.getMessage(PullAction.class, "MSG_NO_DEFAULT_PULL_SET_MSG")); // NOI18N
204
            logger.output(NbBundle.getMessage(PullAction.class, "MSG_NO_DEFAULT_PULL_SET_MSG")); // NOI18N
202
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(PullAction.class, "MSG_PULL_DONE")); // NOI18N
205
            logger.outputInRed(NbBundle.getMessage(PullAction.class, "MSG_PULL_DONE")); // NOI18N
203
            HgUtils.outputMercurialTab(""); // NOI18N
206
            logger.output(""); // NOI18N
204
            JOptionPane.showMessageDialog(null,
207
            JOptionPane.showMessageDialog(null,
205
                NbBundle.getMessage(PullAction.class,"MSG_NO_DEFAULT_PULL_SET"),
208
                NbBundle.getMessage(PullAction.class,"MSG_NO_DEFAULT_PULL_SET"),
206
                NbBundle.getMessage(PullAction.class,"MSG_PULL_TITLE"),
209
                NbBundle.getMessage(PullAction.class,"MSG_PULL_TITLE"),
Lines 213-232 public class PullAction extends ContextA Link Here
213
        final String fromPrjName = HgProjectUtils.getProjectName(new File(pullPath));
216
        final String fromPrjName = HgProjectUtils.getProjectName(new File(pullPath));
214
        Project proj = HgUtils.getProject(ctx);
217
        Project proj = HgUtils.getProject(ctx);
215
        final String toPrjName = HgProjectUtils.getProjectName(proj);
218
        final String toPrjName = HgProjectUtils.getProjectName(proj);
216
        performPull(fromPrjName != null ? PullType.LOCAL : PullType.OTHER, ctx, root, pullPath, fromPrjName, toPrjName);
219
        performPull(fromPrjName != null ? PullType.LOCAL : PullType.OTHER, ctx, root, pullPath, fromPrjName, toPrjName, logger);
217
    }
220
    }
218
221
219
    static void performPull(PullType type, VCSContext ctx, File root, String pullPath, String fromPrjName, String toPrjName) {
222
    static void performPull(PullType type, VCSContext ctx, File root, String pullPath, String fromPrjName, String toPrjName, OutputLogger logger) {
220
        if(root == null || pullPath == null) return;
223
        if(root == null || pullPath == null) return;
221
        File bundleFile = null; 
224
        File bundleFile = null; 
222
        
225
        
223
        try {
226
        try {
224
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(PullAction.class, "MSG_PULL_TITLE")); // NOI18N
227
            logger.outputInRed(NbBundle.getMessage(PullAction.class, "MSG_PULL_TITLE")); // NOI18N
225
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(PullAction.class, "MSG_PULL_TITLE_SEP")); // NOI18N
228
            logger.outputInRed(NbBundle.getMessage(PullAction.class, "MSG_PULL_TITLE_SEP")); // NOI18N
226
            
229
            
227
            List<String> listIncoming;
230
            List<String> listIncoming;
228
            if(type == PullType.LOCAL){
231
            if(type == PullType.LOCAL){
229
                listIncoming = HgCommand.doIncoming(root);
232
                listIncoming = HgCommand.doIncoming(root, logger);
230
            }else{
233
            }else{
231
                for (int i = 0; i < 10000; i++) {
234
                for (int i = 0; i < 10000; i++) {
232
                    if (!new File(root.getParentFile(), root.getName() + "_bundle" + i).exists()) { // NOI18N
235
                    if (!new File(root.getParentFile(), root.getName() + "_bundle" + i).exists()) { // NOI18N
Lines 234-249 public class PullAction extends ContextA Link Here
234
                        break;
237
                        break;
235
                    }
238
                    }
236
                }
239
                }
237
                listIncoming = HgCommand.doIncoming(root, pullPath, bundleFile);
240
                listIncoming = HgCommand.doIncoming(root, pullPath, bundleFile, logger);
238
            }
241
            }
239
            if (listIncoming == null || listIncoming.isEmpty()) return;
242
            if (listIncoming == null || listIncoming.isEmpty()) return;
240
            
243
            
241
            boolean bNoChanges = HgCommand.isNoChanges(listIncoming.get(listIncoming.size() - 1));
244
            boolean bNoChanges = HgCommand.isNoChanges(listIncoming.get(listIncoming.size() - 1));
242
245
243
            // Warn User when there are Local Changes present that Pull will overwrite
246
            // Warn User when there are Local Changes present that Pull will overwrite
244
            if (!bNoChanges && !confirmWithLocalChanges(root, PullAction.class, "MSG_PULL_LOCALMODS_CONFIRM_TITLE", "MSG_PULL_LOCALMODS_CONFIRM_QUERY", listIncoming)) { // NOI18N
247
            if (!bNoChanges && !confirmWithLocalChanges(root, PullAction.class, "MSG_PULL_LOCALMODS_CONFIRM_TITLE", "MSG_PULL_LOCALMODS_CONFIRM_QUERY", listIncoming, logger)) { // NOI18N
245
                HgUtils.outputMercurialTabInRed(NbBundle.getMessage(PullAction.class, "MSG_PULL_LOCALMODS_CANCEL")); // NOI18N
248
                logger.outputInRed(NbBundle.getMessage(PullAction.class, "MSG_PULL_LOCALMODS_CANCEL")); // NOI18N
246
                HgUtils.outputMercurialTab(""); // NOI18N
249
                logger.output(""); // NOI18N
247
                return;
250
                return;
248
            }
251
            }
249
252
Lines 253-261 public class PullAction extends ContextA Link Here
253
                list = listIncoming;
256
                list = listIncoming;
254
            } else {
257
            } else {
255
                if(type == PullType.LOCAL){
258
                if(type == PullType.LOCAL){
256
                    list = HgCommand.doPull(root);
259
                    list = HgCommand.doPull(root, logger);
257
                }else{
260
                }else{
258
                    list = HgCommand.doUnbundle(root, bundleFile);
261
                    list = HgCommand.doUnbundle(root, bundleFile, logger);
259
                }
262
                }
260
            }            
263
            }            
261
                       
264
                       
Lines 265-283 public class PullAction extends ContextA Link Here
265
                    annotateChangeSets(HgUtils.replaceHttpPassword(listIncoming), PullAction.class, "MSG_CHANGESETS_TO_PULL"); // NOI18N
268
                    annotateChangeSets(HgUtils.replaceHttpPassword(listIncoming), PullAction.class, "MSG_CHANGESETS_TO_PULL"); // NOI18N
266
                }
269
                }
267
270
268
                HgUtils.outputMercurialTab(HgUtils.replaceHttpPassword(list));
271
                logger.output(HgUtils.replaceHttpPassword(list));
269
                if (fromPrjName != null) {
272
                if (fromPrjName != null) {
270
                    HgUtils.outputMercurialTabInRed(NbBundle.getMessage(
273
                    logger.outputInRed(NbBundle.getMessage(
271
                            PullAction.class, "MSG_PULL_FROM", fromPrjName, HgUtils.stripDoubleSlash(HgUtils.replaceHttpPassword(pullPath)))); // NOI18N
274
                            PullAction.class, "MSG_PULL_FROM", fromPrjName, HgUtils.stripDoubleSlash(HgUtils.replaceHttpPassword(pullPath)))); // NOI18N
272
                } else {
275
                } else {
273
                    HgUtils.outputMercurialTabInRed(NbBundle.getMessage(
276
                    logger.outputInRed(NbBundle.getMessage(
274
                            PullAction.class, "MSG_PULL_FROM_NONAME", HgUtils.stripDoubleSlash(HgUtils.replaceHttpPassword(pullPath)))); // NOI18N
277
                            PullAction.class, "MSG_PULL_FROM_NONAME", HgUtils.stripDoubleSlash(HgUtils.replaceHttpPassword(pullPath)))); // NOI18N
275
                }
278
                }
276
                if (toPrjName != null) {
279
                if (toPrjName != null) {
277
                    HgUtils.outputMercurialTabInRed(NbBundle.getMessage(
280
                    logger.outputInRed(NbBundle.getMessage(
278
                            PullAction.class, "MSG_PULL_TO", toPrjName, root)); // NOI18N
281
                            PullAction.class, "MSG_PULL_TO", toPrjName, root)); // NOI18N
279
                } else {
282
                } else {
280
                    HgUtils.outputMercurialTabInRed(NbBundle.getMessage(
283
                    logger.outputInRed(NbBundle.getMessage(
281
                            PullAction.class, "MSG_PULL_TO_NONAME", root)); // NOI18N
284
                            PullAction.class, "MSG_PULL_TO_NONAME", root)); // NOI18N
282
                }
285
                }
283
286
Lines 295-307 public class PullAction extends ContextA Link Here
295
                    }
298
                    }
296
                }
299
                }
297
                if (bConfirmMerge) {
300
                if (bConfirmMerge) {
298
                    HgUtils.outputMercurialTab(""); // NOI18N
301
                    logger.output(""); // NOI18N
299
                    HgUtils.outputMercurialTabInRed(NbBundle.getMessage(PullAction.class, "MSG_PULL_MERGE_DO")); // NOI18N
302
                    logger.outputInRed(NbBundle.getMessage(PullAction.class, "MSG_PULL_MERGE_DO")); // NOI18N
300
                    MergeAction.doMergeAction(root, null);
303
                    MergeAction.doMergeAction(root, null, logger);
301
                } else {
304
                } else {
302
                    List<String> headRevList = HgCommand.getHeadRevisions(root);
305
                    List<String> headRevList = HgCommand.getHeadRevisions(root);
303
                    if (headRevList != null && headRevList.size() > 1){
306
                    if (headRevList != null && headRevList.size() > 1){
304
                        MergeAction.printMergeWarning(headRevList);
307
                        MergeAction.printMergeWarning(headRevList, logger);
305
                    }
308
                    }
306
                }
309
                }
307
            }
310
            }
Lines 323-330 public class PullAction extends ContextA Link Here
323
            if (bundleFile != null) {
326
            if (bundleFile != null) {
324
                bundleFile.delete();
327
                bundleFile.delete();
325
            }
328
            }
326
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(PullAction.class, "MSG_PULL_DONE")); // NOI18N
329
            logger.outputInRed(NbBundle.getMessage(PullAction.class, "MSG_PULL_DONE")); // NOI18N
327
            HgUtils.outputMercurialTab(""); // NOI18N
330
            logger.output(""); // NOI18N
328
        }
331
        }
329
    }
332
    }
330
}
333
}
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/pull/PullOtherAction.java (-1 / +1 lines)
Lines 126-132 public class PullOtherAction extends Con Link Here
126
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root);
126
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root);
127
        HgProgressSupport support = new HgProgressSupport() {
127
        HgProgressSupport support = new HgProgressSupport() {
128
                        public void perform() { 
128
                        public void perform() { 
129
                            PullAction.performPull(PullAction.PullType.OTHER, ctx, root, pullPath, fromPrjName, toPrjName); } };
129
                            PullAction.performPull(PullAction.PullType.OTHER, ctx, root, pullPath, fromPrjName, toPrjName, this.getLogger()); } };
130
130
131
        support.start(rp, repository, 
131
        support.start(rp, repository, 
132
                org.openide.util.NbBundle.getMessage(PullAction.class, "MSG_PULL_PROGRESS")); // NOI18N
132
                org.openide.util.NbBundle.getMessage(PullAction.class, "MSG_PULL_PROGRESS")); // NOI18N
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/push/PushAction.java (-47 / +44 lines)
Lines 51-56 import org.netbeans.modules.mercurial.Hg Link Here
51
import org.netbeans.modules.mercurial.HgException;
51
import org.netbeans.modules.mercurial.HgException;
52
import org.netbeans.modules.mercurial.HgProgressSupport;
52
import org.netbeans.modules.mercurial.HgProgressSupport;
53
import org.netbeans.modules.mercurial.Mercurial;
53
import org.netbeans.modules.mercurial.Mercurial;
54
import org.netbeans.modules.mercurial.OutputLogger;
54
import org.netbeans.modules.mercurial.ui.merge.MergeAction;
55
import org.netbeans.modules.mercurial.ui.merge.MergeAction;
55
import org.netbeans.modules.mercurial.ui.pull.PullAction;
56
import org.netbeans.modules.mercurial.ui.pull.PullAction;
56
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
57
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
Lines 86-100 public class PushAction extends ContextA Link Here
86
    public void performAction(ActionEvent e) {
87
    public void performAction(ActionEvent e) {
87
        final File root = HgUtils.getRootFile(context);
88
        final File root = HgUtils.getRootFile(context);
88
        if (root == null) {
89
        if (root == null) {
89
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(PushAction.class,"MSG_PUSH_TITLE")); // NOI18N
90
            OutputLogger logger = OutputLogger.getLogger(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE);
90
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(PushAction.class,"MSG_PUSH_TITLE_SEP")); // NOI18N
91
            logger.outputInRed( NbBundle.getMessage(PushAction.class,"MSG_PUSH_TITLE")); // NOI18N
91
            HgUtils.outputMercurialTabInRed(
92
            logger.outputInRed( NbBundle.getMessage(PushAction.class,"MSG_PUSH_TITLE_SEP")); // NOI18N
93
            logger.outputInRed(
92
                    NbBundle.getMessage(PushAction.class, "MSG_PUSH_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
94
                    NbBundle.getMessage(PushAction.class, "MSG_PUSH_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
93
            HgUtils.outputMercurialTab(""); // NOI18N
95
            logger.output(""); // NOI18N
94
            JOptionPane.showMessageDialog(null,
96
            JOptionPane.showMessageDialog(null,
95
                    NbBundle.getMessage(PushAction.class, "MSG_PUSH_NOT_SUPPORTED_INVIEW"),// NOI18N
97
                    NbBundle.getMessage(PushAction.class, "MSG_PUSH_NOT_SUPPORTED_INVIEW"),// NOI18N
96
                    NbBundle.getMessage(PushAction.class, "MSG_PUSH_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
98
                    NbBundle.getMessage(PushAction.class, "MSG_PUSH_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
97
                    JOptionPane.INFORMATION_MESSAGE);
99
                    JOptionPane.INFORMATION_MESSAGE);
100
            logger.closeLog();
98
            return;
101
            return;
99
        }
102
        }
100
103
Lines 114-137 public class PushAction extends ContextA Link Here
114
117
115
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(repository);
118
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(repository);
116
        HgProgressSupport support = new HgProgressSupport() {
119
        HgProgressSupport support = new HgProgressSupport() {
117
            public void perform() { getDefaultAndPerformPush(ctx, root); } };
120
            public void perform() { getDefaultAndPerformPush(ctx, root, this.getLogger()); } };
118
        support.start(rp, repository, 
121
        support.start(rp, repository, 
119
                org.openide.util.NbBundle.getMessage(PushAction.class, "MSG_PUSH_PROGRESS")); // NOI18N
122
                org.openide.util.NbBundle.getMessage(PushAction.class, "MSG_PUSH_PROGRESS")); // NOI18N
120
        
123
        
121
    }
124
    }
122
                
125
                
123
    static void getDefaultAndPerformPush(VCSContext ctx, File root) {
126
    static void getDefaultAndPerformPush(VCSContext ctx, File root, OutputLogger logger) {
124
        // If the repository has no default pull path then inform user
127
        // If the repository has no default pull path then inform user
125
        String tmpPushPath = HgRepositoryContextCache.getPushDefault(ctx);
128
        String tmpPushPath = HgRepositoryContextCache.getPushDefault(ctx);
126
        if(tmpPushPath == null) {
129
        if(tmpPushPath == null) {
127
            tmpPushPath = HgRepositoryContextCache.getPullDefault(ctx);
130
            tmpPushPath = HgRepositoryContextCache.getPullDefault(ctx);
128
        }
131
        }
129
        if(tmpPushPath == null) {
132
        if(tmpPushPath == null) {
130
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(PushAction.class,"MSG_PUSH_TITLE")); // NOI18N
133
            logger.outputInRed( NbBundle.getMessage(PushAction.class,"MSG_PUSH_TITLE")); // NOI18N
131
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(PushAction.class,"MSG_PUSH_TITLE_SEP")); // NOI18N
134
            logger.outputInRed( NbBundle.getMessage(PushAction.class,"MSG_PUSH_TITLE_SEP")); // NOI18N
132
            HgUtils.outputMercurialTab(NbBundle.getMessage(PushAction.class, "MSG_NO_DEFAULT_PUSH_SET_MSG")); // NOI18N
135
            logger.output(NbBundle.getMessage(PushAction.class, "MSG_NO_DEFAULT_PUSH_SET_MSG")); // NOI18N
133
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(PushAction.class, "MSG_PUSH_DONE")); // NOI18N
136
            logger.outputInRed(NbBundle.getMessage(PushAction.class, "MSG_PUSH_DONE")); // NOI18N
134
            HgUtils.outputMercurialTab(""); // NOI18N
137
            logger.output(""); // NOI18N
135
            JOptionPane.showMessageDialog(null,
138
            JOptionPane.showMessageDialog(null,
136
                NbBundle.getMessage(PushAction.class,"MSG_NO_DEFAULT_PUSH_SET"),
139
                NbBundle.getMessage(PushAction.class,"MSG_NO_DEFAULT_PUSH_SET"),
137
                NbBundle.getMessage(PushAction.class,"MSG_PUSH_TITLE"),
140
                NbBundle.getMessage(PushAction.class,"MSG_PUSH_TITLE"),
Lines 141-155 public class PushAction extends ContextA Link Here
141
        final String pushPath = tmpPushPath;
144
        final String pushPath = tmpPushPath;
142
        final String fromPrjName = HgProjectUtils.getProjectName(root);
145
        final String fromPrjName = HgProjectUtils.getProjectName(root);
143
        final String toPrjName = HgProjectUtils.getProjectName(new File(pushPath));
146
        final String toPrjName = HgProjectUtils.getProjectName(new File(pushPath));
144
        performPush(root, pushPath, fromPrjName, toPrjName);
147
        performPush(root, pushPath, fromPrjName, toPrjName, logger);
145
148
146
    }
149
    }
147
    static void performPush(File root, String pushPath, String fromPrjName, String toPrjName) {
150
    static void performPush(File root, String pushPath, String fromPrjName, String toPrjName, OutputLogger logger) {
148
        try {
151
        try {
149
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(PushAction.class, "MSG_PUSH_TITLE")); // NOI18N
152
            logger.outputInRed(NbBundle.getMessage(PushAction.class, "MSG_PUSH_TITLE")); // NOI18N
150
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(PushAction.class, "MSG_PUSH_TITLE_SEP")); // NOI18N
153
            logger.outputInRed(NbBundle.getMessage(PushAction.class, "MSG_PUSH_TITLE_SEP")); // NOI18N
151
154
152
            List<String> listOutgoing = HgCommand.doOutgoing(root, pushPath);
155
            List<String> listOutgoing = HgCommand.doOutgoing(root, pushPath, logger);
153
            if ((listOutgoing == null) || listOutgoing.isEmpty()) {
156
            if ((listOutgoing == null) || listOutgoing.isEmpty()) {
154
                return;
157
                return;
155
            }
158
            }
Lines 161-169 public class PushAction extends ContextA Link Here
161
            if (bLocalPush) {
164
            if (bLocalPush) {
162
                // Warn user if there are local changes which Push will overwrite
165
                // Warn user if there are local changes which Push will overwrite
163
                if (!bNoChanges && !PullAction.confirmWithLocalChanges(pushFile, PushAction.class,
166
                if (!bNoChanges && !PullAction.confirmWithLocalChanges(pushFile, PushAction.class,
164
                        "MSG_PUSH_LOCALMODS_CONFIRM_TITLE", "MSG_PUSH_LOCALMODS_CONFIRM_QUERY", listOutgoing)) { // NOI18N
167
                        "MSG_PUSH_LOCALMODS_CONFIRM_TITLE", "MSG_PUSH_LOCALMODS_CONFIRM_QUERY", listOutgoing, logger)) { // NOI18N
165
                    HgUtils.outputMercurialTabInRed(NbBundle.getMessage(PushAction.class, "MSG_PUSH_LOCALMODS_CANCEL")); // NOI18N
168
                    logger.outputInRed(NbBundle.getMessage(PushAction.class, "MSG_PUSH_LOCALMODS_CANCEL")); // NOI18N
166
                    HgUtils.outputMercurialTab(""); // NOI18N
169
                    logger.output(""); // NOI18N
167
                    return;
170
                    return;
168
                }
171
                }
169
            }
172
            }
Lines 172-227 public class PushAction extends ContextA Link Here
172
            if (bNoChanges) {
175
            if (bNoChanges) {
173
                list = listOutgoing;
176
                list = listOutgoing;
174
            } else {
177
            } else {
175
                list = HgCommand.doPush(root, pushPath);
178
                list = HgCommand.doPush(root, pushPath, logger);
176
            }
179
            }
177
            if (!list.isEmpty() &&
180
            if (!list.isEmpty() &&
178
                    HgCommand.isErrorAbortPush(list.get(list.size() - 1))) {
181
                    HgCommand.isErrorAbortPush(list.get(list.size() - 1))) {
179
                HgUtils.outputMercurialTab(list);
182
                logger.output(list);
180
                HgUtils.outputMercurialTab("");
183
                logger.output("");
181
                HgUtils.warningDialog(PushAction.class,
184
                HgUtils.warningDialog(PushAction.class,
182
                        "MSG_PUSH_ERROR_TITLE", "MSG_PUSH_ERROR_QUERY"); // NOI18N 
185
                        "MSG_PUSH_ERROR_TITLE", "MSG_PUSH_ERROR_QUERY"); // NOI18N 
183
                HgUtils.outputMercurialTabInRed(NbBundle.getMessage(PushAction.class, "MSG_PUSH_ERROR_CANCELED")); // NOI18N
186
                logger.outputInRed(NbBundle.getMessage(PushAction.class, "MSG_PUSH_ERROR_CANCELED")); // NOI18N
184
                return;
187
                return;
185
            }
188
            }
186
189
187
            if (list != null && !list.isEmpty()) {
190
            if (list != null && !list.isEmpty()) {
188
191
189
                if (!HgCommand.isNoChanges(listOutgoing.get(listOutgoing.size() - 1))) {
192
                if (!HgCommand.isNoChanges(listOutgoing.get(listOutgoing.size() - 1))) {
190
                    InputOutput io = IOProvider.getDefault().getIO(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE, false);
193
                    logger.outputInRed(NbBundle.getMessage(PushAction.class, "MSG_CHANGESETS_TO_PUSH")); // NOI18N
191
                    io.select();
192
                    OutputWriter out = io.getOut();
193
                    OutputWriter outRed = io.getErr();
194
                    outRed.println(NbBundle.getMessage(PushAction.class, "MSG_CHANGESETS_TO_PUSH")); // NOI18N
195
                    for (String s : listOutgoing) {
194
                    for (String s : listOutgoing) {
196
                        if (s.indexOf(Mercurial.CHANGESET_STR) == 0) {
195
                        if (s.indexOf(Mercurial.CHANGESET_STR) == 0) {
197
                            outRed.println(s);
196
                            logger.outputInRed(s);
198
                        } else if (!s.equals("")) { // NOI18N
197
                        } else if (!s.equals("")) { // NOI18N
199
                            out.println(HgUtils.replaceHttpPassword(s));
198
                            logger.output(HgUtils.replaceHttpPassword(s));
200
                        }
199
                        }
201
                    }
200
                    }
202
                    out.println(""); // NOI18N
201
                    logger.output(""); // NOI18N
203
                    out.close();
204
                    outRed.close();
205
                }
202
                }
206
203
207
                HgUtils.outputMercurialTab(HgUtils.replaceHttpPassword(list));
204
                logger.output(HgUtils.replaceHttpPassword(list));
208
205
209
                if (toPrjName == null) { 
206
                if (toPrjName == null) { 
210
                    HgUtils.outputMercurialTabInRed(
207
                    logger.outputInRed(
211
                            NbBundle.getMessage(PushAction.class,
208
                            NbBundle.getMessage(PushAction.class,
212
                            "MSG_PUSH_TO_NONAME", bLocalPush ? HgUtils.stripDoubleSlash(pushPath) : HgUtils.replaceHttpPassword(pushPath))); // NOI18N
209
                            "MSG_PUSH_TO_NONAME", bLocalPush ? HgUtils.stripDoubleSlash(pushPath) : HgUtils.replaceHttpPassword(pushPath))); // NOI18N
213
                } else {
210
                } else {
214
                    HgUtils.outputMercurialTabInRed(
211
                    logger.outputInRed(
215
                            NbBundle.getMessage(PushAction.class,
212
                            NbBundle.getMessage(PushAction.class,
216
                            "MSG_PUSH_TO", toPrjName, bLocalPush ? HgUtils.stripDoubleSlash(pushPath) : HgUtils.replaceHttpPassword(pushPath))); // NOI18N
213
                            "MSG_PUSH_TO", toPrjName, bLocalPush ? HgUtils.stripDoubleSlash(pushPath) : HgUtils.replaceHttpPassword(pushPath))); // NOI18N
217
                }
214
                }
218
215
219
                if (fromPrjName == null ){
216
                if (fromPrjName == null ){
220
                    HgUtils.outputMercurialTabInRed(
217
                    logger.outputInRed(
221
                            NbBundle.getMessage(PushAction.class,
218
                            NbBundle.getMessage(PushAction.class,
222
                            "MSG_PUSH_FROM_NONAME", root)); // NOI18N
219
                            "MSG_PUSH_FROM_NONAME", root)); // NOI18N
223
                } else {
220
                } else {
224
                    HgUtils.outputMercurialTabInRed(
221
                    logger.outputInRed(
225
                            NbBundle.getMessage(PushAction.class,
222
                            NbBundle.getMessage(PushAction.class,
226
                            "MSG_PUSH_FROM", fromPrjName, root)); // NOI18N
223
                            "MSG_PUSH_FROM", fromPrjName, root)); // NOI18N
227
                }
224
                }
Lines 235-247 public class PushAction extends ContextA Link Here
235
                    }
232
                    }
236
                    if (bLocalPush) {
233
                    if (bLocalPush) {
237
                        list = HgCommand.doUpdateAll(pushFile, false, null, false);
234
                        list = HgCommand.doUpdateAll(pushFile, false, null, false);
238
                        HgUtils.outputMercurialTab(list);
235
                        logger.output(list);
239
                        if (toPrjName != null) {
236
                        if (toPrjName != null) {
240
                            HgUtils.outputMercurialTabInRed(
237
                            logger.outputInRed(
241
                                    NbBundle.getMessage(PushAction.class,
238
                                    NbBundle.getMessage(PushAction.class,
242
                                    "MSG_PUSH_UPDATE_DONE", toPrjName, HgUtils.stripDoubleSlash(pushPath))); // NOI18N
239
                                    "MSG_PUSH_UPDATE_DONE", toPrjName, HgUtils.stripDoubleSlash(pushPath))); // NOI18N
243
                        } else {
240
                        } else {
244
                            HgUtils.outputMercurialTabInRed(
241
                            logger.outputInRed(
245
                                    NbBundle.getMessage(PushAction.class,
242
                                    NbBundle.getMessage(PushAction.class,
246
                                    "MSG_PUSH_UPDATE_DONE_NONAME", HgUtils.stripDoubleSlash(pushPath))); // NOI18N
243
                                    "MSG_PUSH_UPDATE_DONE_NONAME", HgUtils.stripDoubleSlash(pushPath))); // NOI18N
247
                        }
244
                        }
Lines 255-269 public class PushAction extends ContextA Link Here
255
                }
252
                }
256
253
257
                if (bConfirmMerge) {
254
                if (bConfirmMerge) {
258
                    HgUtils.outputMercurialTab(""); // NOI18N
255
                    logger.output(""); // NOI18N
259
                    HgUtils.outputMercurialTabInRed(
256
                    logger.outputInRed(
260
                            NbBundle.getMessage(PushAction.class,
257
                            NbBundle.getMessage(PushAction.class,
261
                            "MSG_PUSH_MERGE_DO")); // NOI18N
258
                            "MSG_PUSH_MERGE_DO")); // NOI18N
262
                    MergeAction.doMergeAction(pushFile, null);
259
                    MergeAction.doMergeAction(pushFile, null, logger);
263
                } else {
260
                } else {
264
                    List<String> headRevList = HgCommand.getHeadRevisions(pushPath);
261
                    List<String> headRevList = HgCommand.getHeadRevisions(pushPath);
265
                    if (headRevList != null && headRevList.size() > 1) {
262
                    if (headRevList != null && headRevList.size() > 1) {
266
                        MergeAction.printMergeWarning(headRevList);
263
                        MergeAction.printMergeWarning(headRevList, logger);
267
                    }
264
                    }
268
                }
265
                }
269
            }
266
            }
Lines 280-287 public class PushAction extends ContextA Link Here
280
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
277
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
281
            DialogDisplayer.getDefault().notifyLater(e);
278
            DialogDisplayer.getDefault().notifyLater(e);
282
        } finally {
279
        } finally {
283
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(PushAction.class, "MSG_PUSH_DONE")); // NOI18N
280
            logger.outputInRed(NbBundle.getMessage(PushAction.class, "MSG_PUSH_DONE")); // NOI18N
284
            HgUtils.outputMercurialTab(""); // NOI18N
281
            logger.output(""); // NOI18N
285
        }
282
        }
286
    }
283
    }
287
    
284
    
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/push/PushOtherAction.java (-1 / +1 lines)
Lines 127-133 public class PushOtherAction extends Con Link Here
127
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root);
127
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root);
128
        HgProgressSupport support = new HgProgressSupport() {
128
        HgProgressSupport support = new HgProgressSupport() {
129
            public void perform() { 
129
            public void perform() { 
130
               PushAction.performPush(root, pushPath, fromPrjName, toPrjName); 
130
               PushAction.performPush(root, pushPath, fromPrjName, toPrjName, this.getLogger()); 
131
            } 
131
            } 
132
        };
132
        };
133
133
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/rollback/BackoutAction.java (-14 / +16 lines)
Lines 50-55 import org.netbeans.modules.mercurial.Hg Link Here
50
import org.netbeans.modules.mercurial.HgException;
50
import org.netbeans.modules.mercurial.HgException;
51
import org.netbeans.modules.mercurial.HgProgressSupport;
51
import org.netbeans.modules.mercurial.HgProgressSupport;
52
import org.netbeans.modules.mercurial.Mercurial;
52
import org.netbeans.modules.mercurial.Mercurial;
53
import org.netbeans.modules.mercurial.OutputLogger;
53
import org.netbeans.modules.mercurial.util.HgCommand;
54
import org.netbeans.modules.mercurial.util.HgCommand;
54
import org.netbeans.modules.mercurial.util.HgUtils;
55
import org.netbeans.modules.mercurial.util.HgUtils;
55
import org.netbeans.modules.mercurial.FileStatusCache;
56
import org.netbeans.modules.mercurial.FileStatusCache;
Lines 107-123 public class BackoutAction extends Conte Link Here
107
        HgProgressSupport support = new HgProgressSupport() {
108
        HgProgressSupport support = new HgProgressSupport() {
108
            public void perform() {
109
            public void perform() {
109
                
110
                
111
                OutputLogger logger = getLogger();
110
                try {
112
                try {
111
                    HgUtils.outputMercurialTabInRed(
113
                    logger.outputInRed(
112
                                NbBundle.getMessage(BackoutAction.class,
114
                                NbBundle.getMessage(BackoutAction.class,
113
                                "MSG_BACKOUT_TITLE")); // NOI18N
115
                                "MSG_BACKOUT_TITLE")); // NOI18N
114
                    HgUtils.outputMercurialTabInRed(
116
                    logger.outputInRed(
115
                                NbBundle.getMessage(BackoutAction.class,
117
                                NbBundle.getMessage(BackoutAction.class,
116
                                "MSG_BACKOUT_TITLE_SEP")); // NOI18N
118
                                "MSG_BACKOUT_TITLE_SEP")); // NOI18N
117
                    HgUtils.outputMercurialTab(
119
                    logger.output(
118
                                NbBundle.getMessage(BackoutAction.class,
120
                                NbBundle.getMessage(BackoutAction.class,
119
                                "MSG_BACKOUT_INFO_SEP", revStr, root.getAbsolutePath())); // NOI18N
121
                                "MSG_BACKOUT_INFO_SEP", revStr, root.getAbsolutePath())); // NOI18N
120
                    List<String> list = HgCommand.doBackout(root, revStr, doMerge, commitMsgStr);
122
                    List<String> list = HgCommand.doBackout(root, revStr, doMerge, commitMsgStr, logger);
121
                    
123
                    
122
                    if(list != null && !list.isEmpty()){ 
124
                    if(list != null && !list.isEmpty()){ 
123
                        boolean bMergeNeededDueToBackout = HgCommand.isBackoutMergeNeededMsg(list.get(list.size() - 1));
125
                        boolean bMergeNeededDueToBackout = HgCommand.isBackoutMergeNeededMsg(list.get(list.size() - 1));
Lines 125-144 public class BackoutAction extends Conte Link Here
125
                            list.remove(list.size() - 1);
127
                            list.remove(list.size() - 1);
126
                            list.remove(list.size() - 1);
128
                            list.remove(list.size() - 1);
127
                        }
129
                        }
128
                        HgUtils.outputMercurialTab(list);                            
130
                        logger.output(list);                            
129
                        
131
                        
130
                        if(HgCommand.isUncommittedChangesBackout(list.get(0))){
132
                        if(HgCommand.isUncommittedChangesBackout(list.get(0))){
131
                            HgUtils.outputMercurialTabInRed(
133
                            logger.outputInRed(
132
                                    NbBundle.getMessage(BackoutAction.class,
134
                                    NbBundle.getMessage(BackoutAction.class,
133
                                    "MSG_UNCOMMITTED_CHANGES_BACKOUT"));     // NOI18N           
135
                                    "MSG_UNCOMMITTED_CHANGES_BACKOUT"));     // NOI18N           
134
                            return;
136
                            return;
135
                        } else if(HgCommand.isMergeChangesetBackout(list.get(0))){
137
                        } else if(HgCommand.isMergeChangesetBackout(list.get(0))){
136
                            HgUtils.outputMercurialTabInRed(
138
                            logger.outputInRed(
137
                                    NbBundle.getMessage(BackoutAction.class,
139
                                    NbBundle.getMessage(BackoutAction.class,
138
                                    "MSG_MERGE_CSET_BACKOUT",revStr));     // NOI18N        
140
                                    "MSG_MERGE_CSET_BACKOUT",revStr));     // NOI18N        
139
                            return;
141
                            return;
140
                        } else if(HgCommand.isNoRevStrip(list.get(0))){
142
                        } else if(HgCommand.isNoRevStrip(list.get(0))){
141
                            HgUtils.outputMercurialTabInRed(
143
                            logger.outputInRed(
142
                                    NbBundle.getMessage(BackoutAction.class,
144
                                    NbBundle.getMessage(BackoutAction.class,
143
                                    "MSG_NO_REV_BACKOUT",revStr));     // NOI18N        
145
                                    "MSG_NO_REV_BACKOUT",revStr));     // NOI18N        
144
                            return;
146
                            return;
Lines 151-163 public class BackoutAction extends Conte Link Here
151
                                    BackoutAction.class, "MSG_BACKOUT_MERGE_CONFIRM_TITLE", "MSG_BACKOUT_MERGE_CONFIRM_QUERY"); // NOI18N
153
                                    BackoutAction.class, "MSG_BACKOUT_MERGE_CONFIRM_TITLE", "MSG_BACKOUT_MERGE_CONFIRM_QUERY"); // NOI18N
152
                        }
154
                        }
153
                        if (bConfirmMerge) {
155
                        if (bConfirmMerge) {
154
                            HgUtils.outputMercurialTab(""); // NOI18N
156
                            logger.output(""); // NOI18N
155
                            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(BackoutAction.class, "MSG_BACKOUT_MERGE_DO")); // NOI18N
157
                            logger.outputInRed(NbBundle.getMessage(BackoutAction.class, "MSG_BACKOUT_MERGE_DO")); // NOI18N
156
                            MergeAction.doMergeAction(root, null);
158
                            MergeAction.doMergeAction(root, null, logger);
157
                        } else {
159
                        } else {
158
                            List<String> headRevList = HgCommand.getHeadRevisions(root);
160
                            List<String> headRevList = HgCommand.getHeadRevisions(root);
159
                            if (headRevList != null && headRevList.size() > 1) {
161
                            if (headRevList != null && headRevList.size() > 1) {
160
                                MergeAction.printMergeWarning(headRevList);
162
                                MergeAction.printMergeWarning(headRevList, logger);
161
                            }
163
                            }
162
                        }  
164
                        }  
163
                        HgUtils.forceStatusRefreshProject(ctx);
165
                        HgUtils.forceStatusRefreshProject(ctx);
Lines 172-181 public class BackoutAction extends Conte Link Here
172
                    NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
174
                    NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
173
                    DialogDisplayer.getDefault().notifyLater(e);
175
                    DialogDisplayer.getDefault().notifyLater(e);
174
                } finally {
176
                } finally {
175
                    HgUtils.outputMercurialTabInRed(
177
                    logger.outputInRed(
176
                                NbBundle.getMessage(BackoutAction.class,
178
                                NbBundle.getMessage(BackoutAction.class,
177
                                "MSG_BACKOUT_DONE")); // NOI18N
179
                                "MSG_BACKOUT_DONE")); // NOI18N
178
                    HgUtils.outputMercurialTab(""); // NOI18N
180
                    logger.output(""); // NOI18N
179
                }
181
                }
180
            }
182
            }
181
        };
183
        };
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/rollback/RollbackAction.java (-13 / +15 lines)
Lines 50-55 import org.netbeans.modules.mercurial.Hg Link Here
50
import org.netbeans.modules.mercurial.HgException;
50
import org.netbeans.modules.mercurial.HgException;
51
import org.netbeans.modules.mercurial.HgProgressSupport;
51
import org.netbeans.modules.mercurial.HgProgressSupport;
52
import org.netbeans.modules.mercurial.Mercurial;
52
import org.netbeans.modules.mercurial.Mercurial;
53
import org.netbeans.modules.mercurial.OutputLogger;
53
import org.netbeans.modules.mercurial.util.HgCommand;
54
import org.netbeans.modules.mercurial.util.HgCommand;
54
import org.netbeans.modules.mercurial.util.HgUtils;
55
import org.netbeans.modules.mercurial.util.HgUtils;
55
import org.netbeans.modules.mercurial.FileStatusCache;
56
import org.netbeans.modules.mercurial.FileStatusCache;
Lines 88-101 public class RollbackAction extends Cont Link Here
88
        HgProgressSupport support = new HgProgressSupport() {
89
        HgProgressSupport support = new HgProgressSupport() {
89
            public void perform() {
90
            public void perform() {
90
                
91
                
92
                OutputLogger logger = getLogger();
91
                try {
93
                try {
92
                    HgUtils.outputMercurialTabInRed(
94
                    logger.outputInRed(
93
                                NbBundle.getMessage(RollbackAction.class,
95
                                NbBundle.getMessage(RollbackAction.class,
94
                                "MSG_ROLLBACK_TITLE")); // NOI18N
96
                                "MSG_ROLLBACK_TITLE")); // NOI18N
95
                    HgUtils.outputMercurialTabInRed(
97
                    logger.outputInRed(
96
                                NbBundle.getMessage(RollbackAction.class,
98
                                NbBundle.getMessage(RollbackAction.class,
97
                                "MSG_ROLLBACK_TITLE_SEP")); // NOI18N
99
                                "MSG_ROLLBACK_TITLE_SEP")); // NOI18N
98
                    HgUtils.outputMercurialTab(
100
                    logger.output(
99
                                NbBundle.getMessage(StripAction.class,
101
                                NbBundle.getMessage(StripAction.class,
100
                                "MSG_ROLLBACK_INFO_SEP", root.getAbsolutePath())); // NOI18N
102
                                "MSG_ROLLBACK_INFO_SEP", root.getAbsolutePath())); // NOI18N
101
                    int response = JOptionPane.showOptionDialog(null,
103
                    int response = JOptionPane.showOptionDialog(null,
Lines 104-126 public class RollbackAction extends Cont Link Here
104
                            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
106
                            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
105
107
106
                    if (response == JOptionPane.NO_OPTION) {
108
                    if (response == JOptionPane.NO_OPTION) {
107
                        HgUtils.outputMercurialTabInRed(
109
                        logger.outputInRed(
108
                                NbBundle.getMessage(RollbackAction.class,
110
                                NbBundle.getMessage(RollbackAction.class,
109
                                "MSG_ROLLBACK_CANCELED", root.getAbsolutePath())); // NOI18N
111
                                "MSG_ROLLBACK_CANCELED", root.getAbsolutePath())); // NOI18N
110
                        return;
112
                        return;
111
                    }
113
                    }
112
                    List<String> list = HgCommand.doRollback(root);
114
                    List<String> list = HgCommand.doRollback(root, logger);
113
                    
115
                    
114
                    
116
                    
115
                    if(list != null && !list.isEmpty()){                      
117
                    if(list != null && !list.isEmpty()){                      
116
                        //HgUtils.clearOutputMercurialTab();
118
                        //logger.clearOutput();
117
                        
119
                        
118
                        if(HgCommand.isNoRollbackPossible(list.get(0))){
120
                        if(HgCommand.isNoRollbackPossible(list.get(0))){
119
                            HgUtils.outputMercurialTab(
121
                            logger.output(
120
                                    NbBundle.getMessage(RollbackAction.class,
122
                                    NbBundle.getMessage(RollbackAction.class,
121
                                    "MSG_NO_ROLLBACK"));     // NOI18N                       
123
                                    "MSG_NO_ROLLBACK"));     // NOI18N                       
122
                        }else{
124
                        }else{
123
                            HgUtils.outputMercurialTab(list.get(0));
125
                            logger.output(list.get(0));
124
                            if (HgCommand.hasHistory(root)) {
126
                            if (HgCommand.hasHistory(root)) {
125
                                response = JOptionPane.showOptionDialog(null,
127
                                response = JOptionPane.showOptionDialog(null,
126
                                        NbBundle.getMessage(RollbackAction.class,"MSG_ROLLBACK_CONFIRM_UPDATE_QUERY") ,  // NOI18N
128
                                        NbBundle.getMessage(RollbackAction.class,"MSG_ROLLBACK_CONFIRM_UPDATE_QUERY") ,  // NOI18N
Lines 128-134 public class RollbackAction extends Cont Link Here
128
                                        JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,null, null, null);
130
                                        JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,null, null, null);
129
                            
131
                            
130
                                if( response == JOptionPane.YES_OPTION){
132
                                if( response == JOptionPane.YES_OPTION){
131
                                    HgUtils.outputMercurialTab(
133
                                    logger.output(
132
                                            NbBundle.getMessage(RollbackAction.class,
134
                                            NbBundle.getMessage(RollbackAction.class,
133
                                            "MSG_ROLLBACK_FORCE_UPDATE", root.getAbsolutePath())); // NOI18N
135
                                            "MSG_ROLLBACK_FORCE_UPDATE", root.getAbsolutePath())); // NOI18N
134
                                    list = HgCommand.doUpdateAll(root, true, null);
136
                                    list = HgCommand.doUpdateAll(root, true, null);
Lines 141-147 public class RollbackAction extends Cont Link Here
141
                                    Mercurial.getInstance().changesetChanged(root);
143
                                    Mercurial.getInstance().changesetChanged(root);
142
144
143
                                    if (list != null && !list.isEmpty()){
145
                                    if (list != null && !list.isEmpty()){
144
                                        HgUtils.outputMercurialTab(list);
146
                                        logger.output(list);
145
                                    }
147
                                    }
146
                                } else {
148
                                } else {
147
                                    HgUtils.forceStatusRefreshProject(ctx);
149
                                    HgUtils.forceStatusRefreshProject(ctx);
Lines 155-161 public class RollbackAction extends Cont Link Here
155
                            
157
                            
156
                            }
158
                            }
157
                        }
159
                        }
158
                        HgUtils.outputMercurialTabInRed(
160
                        logger.outputInRed(
159
                                    NbBundle.getMessage(RollbackAction.class,
161
                                    NbBundle.getMessage(RollbackAction.class,
160
                                    "MSG_ROLLBACK_INFO")); // NOI18N
162
                                    "MSG_ROLLBACK_INFO")); // NOI18N
161
                    }
163
                    }
Lines 163-172 public class RollbackAction extends Cont Link Here
163
                    NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
165
                    NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
164
                    DialogDisplayer.getDefault().notifyLater(e);
166
                    DialogDisplayer.getDefault().notifyLater(e);
165
                } finally {
167
                } finally {
166
                    HgUtils.outputMercurialTabInRed(
168
                    logger.outputInRed(
167
                                NbBundle.getMessage(RollbackAction.class,
169
                                NbBundle.getMessage(RollbackAction.class,
168
                                "MSG_ROLLBACK_DONE")); // NOI18N
170
                                "MSG_ROLLBACK_DONE")); // NOI18N
169
                    HgUtils.outputMercurialTab(""); // NOI18N
171
                    logger.output(""); // NOI18N
170
                }
172
                }
171
            }
173
            }
172
        };
174
        };
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/rollback/StripAction.java (-12 / +14 lines)
Lines 50-55 import org.netbeans.modules.mercurial.Hg Link Here
50
import org.netbeans.modules.mercurial.HgException;
50
import org.netbeans.modules.mercurial.HgException;
51
import org.netbeans.modules.mercurial.HgProgressSupport;
51
import org.netbeans.modules.mercurial.HgProgressSupport;
52
import org.netbeans.modules.mercurial.Mercurial;
52
import org.netbeans.modules.mercurial.Mercurial;
53
import org.netbeans.modules.mercurial.OutputLogger;
53
import org.netbeans.modules.mercurial.util.HgCommand;
54
import org.netbeans.modules.mercurial.util.HgCommand;
54
import org.netbeans.modules.mercurial.util.HgUtils;
55
import org.netbeans.modules.mercurial.util.HgUtils;
55
import org.netbeans.modules.mercurial.FileStatusCache;
56
import org.netbeans.modules.mercurial.FileStatusCache;
Lines 99-129 public class StripAction extends Context Link Here
99
        HgProgressSupport support = new HgProgressSupport() {
100
        HgProgressSupport support = new HgProgressSupport() {
100
            public void perform() {
101
            public void perform() {
101
                
102
                
103
                OutputLogger logger = getLogger();
102
                try {
104
                try {
103
                    HgUtils.outputMercurialTabInRed(
105
                    logger.outputInRed(
104
                                NbBundle.getMessage(StripAction.class,
106
                                NbBundle.getMessage(StripAction.class,
105
                                "MSG_STRIP_TITLE")); // NOI18N
107
                                "MSG_STRIP_TITLE")); // NOI18N
106
                    HgUtils.outputMercurialTabInRed(
108
                    logger.outputInRed(
107
                                NbBundle.getMessage(StripAction.class,
109
                                NbBundle.getMessage(StripAction.class,
108
                                "MSG_STRIP_TITLE_SEP")); // NOI18N
110
                                "MSG_STRIP_TITLE_SEP")); // NOI18N
109
                    HgUtils.outputMercurialTab(
111
                    logger.output(
110
                                NbBundle.getMessage(StripAction.class,
112
                                NbBundle.getMessage(StripAction.class,
111
                                "MSG_STRIP_INFO_SEP", revStr, root.getAbsolutePath())); // NOI18N
113
                                "MSG_STRIP_INFO_SEP", revStr, root.getAbsolutePath())); // NOI18N
112
                    List<String> list = HgCommand.doStrip(root, revStr, false, doBackup);
114
                    List<String> list = HgCommand.doStrip(root, revStr, false, doBackup, logger);
113
                    
115
                    
114
                    if(list != null && !list.isEmpty()){                      
116
                    if(list != null && !list.isEmpty()){                      
115
                        HgUtils.outputMercurialTab(list);
117
                        logger.output(list);
116
                        
118
                        
117
                        if(HgCommand.isNoRevStrip(list.get(0))){
119
                        if(HgCommand.isNoRevStrip(list.get(0))){
118
                            HgUtils.outputMercurialTabInRed(
120
                            logger.outputInRed(
119
                                    NbBundle.getMessage(StripAction.class,
121
                                    NbBundle.getMessage(StripAction.class,
120
                                    "MSG_NO_REV_STRIP",revStr));     // NOI18N                       
122
                                    "MSG_NO_REV_STRIP",revStr));     // NOI18N                       
121
                        }else if(HgCommand.isLocalChangesStrip(list.get(0))){
123
                        }else if(HgCommand.isLocalChangesStrip(list.get(0))){
122
                            HgUtils.outputMercurialTabInRed(
124
                            logger.outputInRed(
123
                                    NbBundle.getMessage(StripAction.class,
125
                                    NbBundle.getMessage(StripAction.class,
124
                                    "MSG_LOCAL_CHANGES_STRIP"));     // NOI18N                       
126
                                    "MSG_LOCAL_CHANGES_STRIP"));     // NOI18N                       
125
                        }else if(HgCommand.isMultipleHeadsStrip(list.get(0))){
127
                        }else if(HgCommand.isMultipleHeadsStrip(list.get(0))){
126
                            HgUtils.outputMercurialTabInRed(
128
                            logger.outputInRed(
127
                                    NbBundle.getMessage(StripAction.class,
129
                                    NbBundle.getMessage(StripAction.class,
128
                                    "MSG_MULTI_HEADS_STRIP"));     // NOI18N                       
130
                                    "MSG_MULTI_HEADS_STRIP"));     // NOI18N                       
129
                        }else{
131
                        }else{
Lines 139-148 public class StripAction extends Context Link Here
139
                            savingTo = savingTo != null? savingTo.substring(HG_STIP_SAVE_BUNDLE.length()): null;
141
                            savingTo = savingTo != null? savingTo.substring(HG_STIP_SAVE_BUNDLE.length()): null;
140
                            File savingFile = new File(savingTo);
142
                            File savingFile = new File(savingTo);
141
                            if(savingFile != null && savingFile.exists() && savingFile.canRead()){
143
                            if(savingFile != null && savingFile.exists() && savingFile.canRead()){
142
                                HgUtils.outputMercurialTabInRed(
144
                                logger.outputInRed(
143
                                        NbBundle.getMessage(StripAction.class,
145
                                        NbBundle.getMessage(StripAction.class,
144
                                        "MSG_STRIP_RESTORE_INFO")); // NOI18N                                
146
                                        "MSG_STRIP_RESTORE_INFO")); // NOI18N                                
145
                                HgUtils.outputMercurialTab(
147
                                logger.output(
146
                                        NbBundle.getMessage(StripAction.class,
148
                                        NbBundle.getMessage(StripAction.class,
147
                                        "MSG_STRIP_RESTORE_INFO2", savingFile.getAbsoluteFile())); // NOI18N                                
149
                                        "MSG_STRIP_RESTORE_INFO2", savingFile.getAbsoluteFile())); // NOI18N                                
148
                            }
150
                            }
Lines 152-161 public class StripAction extends Context Link Here
152
                    NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
154
                    NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
153
                    DialogDisplayer.getDefault().notifyLater(e);
155
                    DialogDisplayer.getDefault().notifyLater(e);
154
                } finally {
156
                } finally {
155
                    HgUtils.outputMercurialTabInRed(
157
                    logger.outputInRed(
156
                                NbBundle.getMessage(StripAction.class,
158
                                NbBundle.getMessage(StripAction.class,
157
                                "MSG_STRIP_DONE")); // NOI18N
159
                                "MSG_STRIP_DONE")); // NOI18N
158
                    HgUtils.outputMercurialTab(""); // NOI18N
160
                    logger.output(""); // NOI18N
159
                }
161
                }
160
            }
162
            }
161
        };
163
        };
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/update/RevertModificationsAction.java (-17 / +18 lines)
Lines 47-52 import java.awt.event.ActionEvent; Link Here
47
import java.awt.event.ActionEvent;
47
import java.awt.event.ActionEvent;
48
import org.netbeans.modules.versioning.spi.VCSContext;
48
import org.netbeans.modules.versioning.spi.VCSContext;
49
import org.netbeans.modules.mercurial.Mercurial;
49
import org.netbeans.modules.mercurial.Mercurial;
50
import org.netbeans.modules.mercurial.OutputLogger;
50
import org.netbeans.modules.mercurial.FileStatusCache;
51
import org.netbeans.modules.mercurial.FileStatusCache;
51
import org.netbeans.modules.mercurial.FileInformation;
52
import org.netbeans.modules.mercurial.FileInformation;
52
import org.netbeans.modules.mercurial.util.HgUtils;
53
import org.netbeans.modules.mercurial.util.HgUtils;
Lines 96-102 public class RevertModificationsAction e Link Here
96
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(repository);
97
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(repository);
97
        HgProgressSupport support = new HgProgressSupport() {
98
        HgProgressSupport support = new HgProgressSupport() {
98
            public void perform() {
99
            public void perform() {
99
                performRevert(repository, revStr, files, doBackup);
100
                performRevert(repository, revStr, files, doBackup, this.getLogger());
100
            }
101
            }
101
        };
102
        };
102
        support.start(rp, repository.getAbsolutePath(), org.openide.util.NbBundle.getMessage(UpdateAction.class, "MSG_Revert_Progress")); // NOI18N
103
        support.start(rp, repository.getAbsolutePath(), org.openide.util.NbBundle.getMessage(UpdateAction.class, "MSG_Revert_Progress")); // NOI18N
Lines 104-155 public class RevertModificationsAction e Link Here
104
        return;
105
        return;
105
    }
106
    }
106
107
107
    public static void performRevert(File repository, String revStr, File file, boolean doBackup) {
108
    public static void performRevert(File repository, String revStr, File file, boolean doBackup, OutputLogger logger) {
108
        List<File> revertFiles = new ArrayList<File>();
109
        List<File> revertFiles = new ArrayList<File>();
109
        revertFiles.add(file);        
110
        revertFiles.add(file);        
110
111
111
        performRevert(repository, revStr, revertFiles, doBackup);
112
        performRevert(repository, revStr, revertFiles, doBackup, logger);
112
    }
113
    }
113
    
114
    
114
    public static void performRevert(File repository, String revStr, File[] files, boolean doBackup) {
115
    public static void performRevert(File repository, String revStr, File[] files, boolean doBackup, OutputLogger logger) {
115
        List<File> revertFiles = new ArrayList<File>();
116
        List<File> revertFiles = new ArrayList<File>();
116
        for (File file : files) {
117
        for (File file : files) {
117
            revertFiles.add(file);
118
            revertFiles.add(file);
118
        }
119
        }
119
        performRevert(repository, revStr, revertFiles, doBackup);
120
        performRevert(repository, revStr, revertFiles, doBackup, logger);
120
    }
121
    }
121
    
122
    
122
    public static void performRevert(File repository, String revStr, List<File> revertFiles, boolean doBackup) {
123
    public static void performRevert(File repository, String revStr, List<File> revertFiles, boolean doBackup, OutputLogger logger) {
123
        try{
124
        try{
124
            HgUtils.outputMercurialTabInRed(
125
            logger.outputInRed(
125
                    NbBundle.getMessage(RevertModificationsAction.class,
126
                    NbBundle.getMessage(RevertModificationsAction.class,
126
                    "MSG_REVERT_TITLE")); // NOI18N
127
                    "MSG_REVERT_TITLE")); // NOI18N
127
            HgUtils.outputMercurialTabInRed(
128
            logger.outputInRed(
128
                    NbBundle.getMessage(RevertModificationsAction.class,
129
                    NbBundle.getMessage(RevertModificationsAction.class,
129
                    "MSG_REVERT_TITLE_SEP")); // NOI18N
130
                    "MSG_REVERT_TITLE_SEP")); // NOI18N
130
            
131
            
131
            // No revisions to revert too
132
            // No revisions to revert too
132
            if (NbBundle.getMessage(RevertModificationsAction.class,
133
            if (NbBundle.getMessage(RevertModificationsAction.class,
133
                    "MSG_Revision_Default").startsWith(revStr)) {
134
                    "MSG_Revision_Default").startsWith(revStr)) {
134
                HgUtils.outputMercurialTab(
135
                logger.output(
135
                        NbBundle.getMessage(RevertModificationsAction.class,
136
                        NbBundle.getMessage(RevertModificationsAction.class,
136
                        "MSG_REVERT_NOTHING")); // NOI18N
137
                        "MSG_REVERT_NOTHING")); // NOI18N
137
                HgUtils.outputMercurialTabInRed(
138
                logger.outputInRed(
138
                        NbBundle.getMessage(RevertModificationsAction.class,
139
                        NbBundle.getMessage(RevertModificationsAction.class,
139
                        "MSG_REVERT_DONE")); // NOI18N
140
                        "MSG_REVERT_DONE")); // NOI18N
140
                HgUtils.outputMercurialTabInRed(""); // NOI18N
141
                logger.outputInRed(""); // NOI18N
141
                return;
142
                return;
142
            }
143
            }
143
            
144
            
144
            HgUtils.outputMercurialTab(
145
            logger.output(
145
                    NbBundle.getMessage(RevertModificationsAction.class,
146
                    NbBundle.getMessage(RevertModificationsAction.class,
146
                    "MSG_REVERT_REVISION_STR", revStr)); // NOI18N
147
                    "MSG_REVERT_REVISION_STR", revStr)); // NOI18N
147
            for (File file : revertFiles) {
148
            for (File file : revertFiles) {
148
                HgUtils.outputMercurialTab(file.getAbsolutePath());
149
                logger.output(file.getAbsolutePath());
149
            }
150
            }
150
            HgUtils.outputMercurialTab(""); // NOI18N
151
            logger.output(""); // NOI18N
151
152
152
            HgCommand.doRevert(repository, revertFiles, revStr, doBackup);
153
            HgCommand.doRevert(repository, revertFiles, revStr, doBackup, logger);
153
            FileStatusCache cache = Mercurial.getInstance().getFileStatusCache();
154
            FileStatusCache cache = Mercurial.getInstance().getFileStatusCache();
154
            File[] conflictFiles = cache.listFiles(revertFiles.toArray(new File[0]), FileInformation.STATUS_VERSIONED_CONFLICT);
155
            File[] conflictFiles = cache.listFiles(revertFiles.toArray(new File[0]), FileInformation.STATUS_VERSIONED_CONFLICT);
155
            if (conflictFiles.length != 0) {
156
            if (conflictFiles.length != 0) {
Lines 174-183 public class RevertModificationsAction e Link Here
174
            rootObj.getFileSystem().refresh(true);
175
            rootObj.getFileSystem().refresh(true);
175
        } catch (java.lang.Exception exc) {
176
        } catch (java.lang.Exception exc) {
176
        }
177
        }
177
        HgUtils.outputMercurialTabInRed(
178
        logger.outputInRed(
178
                NbBundle.getMessage(RevertModificationsAction.class,
179
                NbBundle.getMessage(RevertModificationsAction.class,
179
                "MSG_REVERT_DONE")); // NOI18N
180
                "MSG_REVERT_DONE")); // NOI18N
180
        HgUtils.outputMercurialTabInRed(""); // NOI18N
181
        logger.outputInRed(""); // NOI18N
181
 
182
 
182
    }
183
    }
183
184
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/update/UpdateAction.java (-8 / +10 lines)
Lines 45-50 import org.netbeans.modules.mercurial.Hg Link Here
45
import org.netbeans.modules.mercurial.HgException;
45
import org.netbeans.modules.mercurial.HgException;
46
import org.netbeans.modules.mercurial.HgProgressSupport;
46
import org.netbeans.modules.mercurial.HgProgressSupport;
47
import org.netbeans.modules.mercurial.Mercurial;
47
import org.netbeans.modules.mercurial.Mercurial;
48
import org.netbeans.modules.mercurial.OutputLogger;
48
import org.netbeans.modules.mercurial.util.HgUtils;
49
import org.netbeans.modules.mercurial.util.HgUtils;
49
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
50
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
50
import org.netbeans.modules.versioning.spi.VCSContext;
51
import org.netbeans.modules.versioning.spi.VCSContext;
Lines 95-117 public class UpdateAction extends Contex Link Here
95
        HgProgressSupport support = new HgProgressSupport() {
96
        HgProgressSupport support = new HgProgressSupport() {
96
            public void perform() {
97
            public void perform() {
97
                boolean bNoUpdates = true;
98
                boolean bNoUpdates = true;
99
                OutputLogger logger = getLogger();
98
                try {
100
                try {
99
                    HgUtils.outputMercurialTabInRed(
101
                    logger.outputInRed(
100
                            NbBundle.getMessage(UpdateAction.class,
102
                            NbBundle.getMessage(UpdateAction.class,
101
                            "MSG_UPDATE_TITLE")); // NOI18N
103
                            "MSG_UPDATE_TITLE")); // NOI18N
102
                    HgUtils.outputMercurialTabInRed(
104
                    logger.outputInRed(
103
                            NbBundle.getMessage(UpdateAction.class,
105
                            NbBundle.getMessage(UpdateAction.class,
104
                            "MSG_UPDATE_TITLE_SEP")); // NOI18N
106
                            "MSG_UPDATE_TITLE_SEP")); // NOI18N
105
                    HgUtils.outputMercurialTab(
107
                    logger.output(
106
                                NbBundle.getMessage(UpdateAction.class,
108
                                NbBundle.getMessage(UpdateAction.class,
107
                                "MSG_UPDATE_INFO_SEP", revStr, root.getAbsolutePath())); // NOI18N
109
                                "MSG_UPDATE_INFO_SEP", revStr, root.getAbsolutePath())); // NOI18N
108
                    List<String> list = HgCommand.doUpdateAll(root, doForcedUpdate, revStr);
110
                    List<String> list = HgCommand.doUpdateAll(root, doForcedUpdate, revStr);
109
                    
111
                    
110
                    if (list != null && !list.isEmpty()){
112
                    if (list != null && !list.isEmpty()){
111
                        bNoUpdates = HgCommand.isNoUpdates(list.get(0));
113
                        bNoUpdates = HgCommand.isNoUpdates(list.get(0));
112
                        //HgUtils.clearOutputMercurialTab();
114
                        //logger.clearOutput();
113
                        HgUtils.outputMercurialTab(list);
115
                        logger.output(list);
114
                        HgUtils.outputMercurialTab(""); // NOI18N
116
                        logger.output(""); // NOI18N
115
                    }  
117
                    }  
116
                    // refresh filesystem to take account of changes
118
                    // refresh filesystem to take account of changes
117
                    FileObject rootObj = FileUtil.toFileObject(root);
119
                    FileObject rootObj = FileUtil.toFileObject(root);
Lines 129-138 public class UpdateAction extends Contex Link Here
129
                if(!bNoUpdates)
131
                if(!bNoUpdates)
130
                    HgUtils.forceStatusRefreshProject(ctx);
132
                    HgUtils.forceStatusRefreshProject(ctx);
131
133
132
                HgUtils.outputMercurialTabInRed(
134
                logger.outputInRed(
133
                        NbBundle.getMessage(UpdateAction.class,
135
                        NbBundle.getMessage(UpdateAction.class,
134
                        "MSG_UPDATE_DONE")); // NOI18N
136
                        "MSG_UPDATE_DONE")); // NOI18N
135
                HgUtils.outputMercurialTab(""); // NOI18N
137
                logger.output(""); // NOI18N
136
            }
138
            }
137
        };
139
        };
138
        support.start(rp, repository, org.openide.util.NbBundle.getMessage(UpdateAction.class, "MSG_Update_Progress")); // NOI18N
140
        support.start(rp, repository, org.openide.util.NbBundle.getMessage(UpdateAction.class, "MSG_Update_Progress")); // NOI18N
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/view/ViewAction.java (-10 / +15 lines)
Lines 42-47 package org.netbeans.modules.mercurial.u Link Here
42
42
43
import org.netbeans.modules.versioning.spi.VCSContext;
43
import org.netbeans.modules.versioning.spi.VCSContext;
44
import org.netbeans.modules.mercurial.Mercurial;
44
import org.netbeans.modules.mercurial.Mercurial;
45
import org.netbeans.modules.mercurial.OutputLogger;
45
import org.netbeans.modules.mercurial.HgException;
46
import org.netbeans.modules.mercurial.HgException;
46
import org.netbeans.modules.mercurial.util.HgCommand;
47
import org.netbeans.modules.mercurial.util.HgCommand;
47
import org.netbeans.modules.mercurial.util.HgUtils;
48
import org.netbeans.modules.mercurial.util.HgUtils;
Lines 87-95 public class ViewAction extends ContextA Link Here
87
    }
88
    }
88
89
89
    static void performView(File root) {
90
    static void performView(File root) {
91
        OutputLogger logger = OutputLogger.getLogger(root.getAbsolutePath());
90
        try {
92
        try {
91
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(ViewAction.class, "MSG_VIEW_TITLE")); // NOI18N
93
            logger.outputInRed(NbBundle.getMessage(ViewAction.class, "MSG_VIEW_TITLE")); // NOI18N
92
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(ViewAction.class, "MSG_VIEW_TITLE_SEP")); // NOI18N
94
            logger.outputInRed(NbBundle.getMessage(ViewAction.class, "MSG_VIEW_TITLE_SEP")); // NOI18N
93
95
94
            String hgkCommand = HgCommand.HGK_COMMAND;
96
            String hgkCommand = HgCommand.HGK_COMMAND;
95
            if(Utilities.isWindows()){ 
97
            if(Utilities.isWindows()){ 
Lines 109-121 public class ViewAction extends ContextA Link Here
109
                            HgConfigFiles.HG_EXTENSIONS, HgConfigFiles.HG_EXTENSIONS_HGK);
111
                            HgConfigFiles.HG_EXTENSIONS, HgConfigFiles.HG_EXTENSIONS_HGK);
110
            
112
            
111
            if(!bHgkFound){
113
            if(!bHgkFound){
112
                HgUtils.outputMercurialTabInRed(
114
                logger.outputInRed(
113
                            NbBundle.getMessage(ViewAction.class, "MSG_VIEW_HGK_NOT_FOUND_INFO")); // NOI18N
115
                            NbBundle.getMessage(ViewAction.class, "MSG_VIEW_HGK_NOT_FOUND_INFO")); // NOI18N
114
                HgUtils.outputMercurialTab(""); // NOI18N
116
                logger.output(""); // NOI18N
115
                JOptionPane.showMessageDialog(null,
117
                JOptionPane.showMessageDialog(null,
116
                        NbBundle.getMessage(ViewAction.class, "MSG_VIEW_HGK_NOT_FOUND"),// NOI18N
118
                        NbBundle.getMessage(ViewAction.class, "MSG_VIEW_HGK_NOT_FOUND"),// NOI18N
117
                        NbBundle.getMessage(ViewAction.class, "MSG_VIEW_HGK_NOT_FOUND_TITLE"),// NOI18N
119
                        NbBundle.getMessage(ViewAction.class, "MSG_VIEW_HGK_NOT_FOUND_TITLE"),// NOI18N
118
                        JOptionPane.INFORMATION_MESSAGE);
120
                        JOptionPane.INFORMATION_MESSAGE);
121
                logger.closeLog();
119
                return;
122
                return;
120
            }
123
            }
121
            if(!bHgkPropExists){
124
            if(!bHgkPropExists){
Lines 124-144 public class ViewAction extends ContextA Link Here
124
                        ViewAction.class, "MSG_VIEW_SETHGK_PROP_CONFIRM_TITLE", // NOI18N
127
                        ViewAction.class, "MSG_VIEW_SETHGK_PROP_CONFIRM_TITLE", // NOI18N
125
                        "MSG_VIEW_SETHGK_PROP_CONFIRM_QUERY"); // NOI18N                
128
                        "MSG_VIEW_SETHGK_PROP_CONFIRM_QUERY"); // NOI18N                
126
                if (bConfirmSetHgkProp) {
129
                if (bConfirmSetHgkProp) {
127
                    HgUtils.outputMercurialTabInRed(
130
                    logger.outputInRed(
128
                            NbBundle.getMessage(ViewAction.class, "MSG_VIEW_SETHGK_PROP_DO_INFO")); // NOI18N
131
                            NbBundle.getMessage(ViewAction.class, "MSG_VIEW_SETHGK_PROP_DO_INFO")); // NOI18N
129
                    HgConfigFiles.getInstance().setProperty(HgConfigFiles.HG_EXTENSIONS_HGK, ""); // NOI18N
132
                    HgConfigFiles.getInstance().setProperty(HgConfigFiles.HG_EXTENSIONS_HGK, ""); // NOI18N
130
                }else{
133
                }else{
131
                    HgUtils.outputMercurialTabInRed(
134
                    logger.outputInRed(
132
                            NbBundle.getMessage(ViewAction.class, "MSG_VIEW_NOTSETHGK_PROP_INFO")); // NOI18N
135
                            NbBundle.getMessage(ViewAction.class, "MSG_VIEW_NOTSETHGK_PROP_INFO")); // NOI18N
133
                    HgUtils.outputMercurialTab(""); // NOI18N
136
                    logger.output(""); // NOI18N
137
                    logger.closeLog();
134
                    return;
138
                    return;
135
                }
139
                }
136
            }
140
            }
137
            
141
            
138
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(ViewAction.class, 
142
            logger.outputInRed(NbBundle.getMessage(ViewAction.class, 
139
                    "MSG_VIEW_LAUNCH_INFO", root.getAbsolutePath())); // NOI18N
143
                    "MSG_VIEW_LAUNCH_INFO", root.getAbsolutePath())); // NOI18N
140
            HgUtils.outputMercurialTab(""); // NOI18N
144
            logger.output(""); // NOI18N
141
            HgCommand.doView(root);
145
            HgCommand.doView(root, logger);
146
            logger.closeLog();
142
        } catch (HgException ex) {
147
        } catch (HgException ex) {
143
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
148
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
144
            DialogDisplayer.getDefault().notifyLater(e);
149
            DialogDisplayer.getDefault().notifyLater(e);
(-)a/mercurial/src/org/netbeans/modules/mercurial/util/HgCommand.java (-102 / +118 lines)
Lines 66-71 import org.netbeans.modules.mercurial.Fi Link Here
66
import org.netbeans.modules.mercurial.FileStatus;
66
import org.netbeans.modules.mercurial.FileStatus;
67
import org.netbeans.modules.mercurial.HgException;
67
import org.netbeans.modules.mercurial.HgException;
68
import org.netbeans.modules.mercurial.Mercurial;
68
import org.netbeans.modules.mercurial.Mercurial;
69
import org.netbeans.modules.mercurial.OutputLogger;
69
import org.netbeans.api.queries.SharabilityQuery;
70
import org.netbeans.api.queries.SharabilityQuery;
70
import org.netbeans.modules.mercurial.HgModuleConfig;
71
import org.netbeans.modules.mercurial.HgModuleConfig;
71
import org.netbeans.modules.mercurial.config.HgConfigFiles;
72
import org.netbeans.modules.mercurial.config.HgConfigFiles;
Lines 361-367 public class HgCommand { Link Here
361
     * @return hg update output
362
     * @return hg update output
362
     * @throws org.netbeans.modules.mercurial.HgException
363
     * @throws org.netbeans.modules.mercurial.HgException
363
     */
364
     */
364
    public static List<String> doRollback(File repository) throws HgException {
365
    public static List<String> doRollback(File repository, OutputLogger logger) throws HgException {
365
        if (repository == null ) return null;
366
        if (repository == null ) return null;
366
        List<String> command = new ArrayList<String>();
367
        List<String> command = new ArrayList<String>();
367
368
Lines 372-383 public class HgCommand { Link Here
372
373
373
        List<String> list = exec(command);
374
        List<String> list = exec(command);
374
        if (list.isEmpty())
375
        if (list.isEmpty())
375
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_ROLLBACK_FAILED"));
376
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_ROLLBACK_FAILED"), logger);
376
        
377
        
377
        return list;
378
        return list;
378
    }
379
    }
379
    public static List<String> doBackout(File repository, String revision, 
380
    public static List<String> doBackout(File repository, String revision, 
380
            boolean doMerge, String commitMsg) throws HgException {
381
            boolean doMerge, String commitMsg, OutputLogger logger) throws HgException {
381
        if (repository == null ) return null;
382
        if (repository == null ) return null;
382
        List<String> env = new ArrayList<String>();
383
        List<String> env = new ArrayList<String>();
383
        List<String> command = new ArrayList<String>();
384
        List<String> command = new ArrayList<String>();
Lines 411-423 public class HgCommand { Link Here
411
            list = exec(command);            
412
            list = exec(command);            
412
        }
413
        }
413
        if (list.isEmpty())
414
        if (list.isEmpty())
414
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_BACKOUT_FAILED"));
415
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_BACKOUT_FAILED"), logger);
415
        
416
        
416
        return list;
417
        return list;
417
    }
418
    }
418
    
419
    
419
    public static List<String> doStrip(File repository, String revision, 
420
    public static List<String> doStrip(File repository, String revision, 
420
            boolean doForceMultiHead, boolean doBackup) throws HgException {
421
            boolean doForceMultiHead, boolean doBackup, OutputLogger logger) throws HgException {
421
        if (repository == null ) return null;
422
        if (repository == null ) return null;
422
        List<String> command = new ArrayList<String>();
423
        List<String> command = new ArrayList<String>();
423
424
Lines 439-445 public class HgCommand { Link Here
439
440
440
        List<String> list = exec(command);
441
        List<String> list = exec(command);
441
        if (list.isEmpty())
442
        if (list.isEmpty())
442
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_STRIP_FAILED"));
443
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_STRIP_FAILED"), logger);
443
        
444
        
444
        return list;
445
        return list;
445
    }
446
    }
Lines 476-483 public class HgCommand { Link Here
476
     * @return hg pull output
477
     * @return hg pull output
477
     * @throws org.netbeans.modules.mercurial.HgException
478
     * @throws org.netbeans.modules.mercurial.HgException
478
     */
479
     */
479
    public static List<String> doPull(File repository) throws HgException {
480
    public static List<String> doPull(File repository, OutputLogger logger) throws HgException {
480
        return doPull(repository, null);
481
        return doPull(repository, null, logger);
481
    }
482
    }
482
483
483
    /**
484
    /**
Lines 491-497 public class HgCommand { Link Here
491
     * @return hg pull output
492
     * @return hg pull output
492
     * @throws org.netbeans.modules.mercurial.HgException
493
     * @throws org.netbeans.modules.mercurial.HgException
493
     */
494
     */
494
    public static List<String> doPull(File repository, String from) throws HgException {
495
    public static List<String> doPull(File repository, String from, OutputLogger logger) throws HgException {
495
        if (repository == null ) return null;
496
        if (repository == null ) return null;
496
        List<String> command = new ArrayList<String>();
497
        List<String> command = new ArrayList<String>();
497
498
Lines 506-512 public class HgCommand { Link Here
506
507
507
        List<String> list;
508
        List<String> list;
508
        String defaultPull = new HgConfigFiles(repository).getDefaultPull(false);
509
        String defaultPull = new HgConfigFiles(repository).getDefaultPull(false);
509
        String proxy = getGlobalProxyIfNeeded(defaultPull, true);
510
        String proxy = getGlobalProxyIfNeeded(defaultPull, true, logger);
510
        if(proxy != null){
511
        if(proxy != null){
511
            List<String> env = new ArrayList<String>(); 
512
            List<String> env = new ArrayList<String>(); 
512
            env.add(HG_PROXY_ENV + proxy);
513
            env.add(HG_PROXY_ENV + proxy);
Lines 517-523 public class HgCommand { Link Here
517
518
518
        if (!list.isEmpty() && 
519
        if (!list.isEmpty() && 
519
             isErrorAbort(list.get(list.size() -1))) {
520
             isErrorAbort(list.get(list.size() -1))) {
520
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
521
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
521
        }
522
        }
522
        return list;
523
        return list;
523
    }
524
    }
Lines 533-539 public class HgCommand { Link Here
533
     * @return hg unbundle output
534
     * @return hg unbundle output
534
     * @throws org.netbeans.modules.mercurial.HgException
535
     * @throws org.netbeans.modules.mercurial.HgException
535
     */
536
     */
536
    public static List<String> doUnbundle(File repository, File bundle) throws HgException {
537
    public static List<String> doUnbundle(File repository, File bundle, OutputLogger logger) throws HgException {
537
        if (repository == null ) return null;
538
        if (repository == null ) return null;
538
        List<String> command = new ArrayList<String>();
539
        List<String> command = new ArrayList<String>();
539
540
Lines 549-555 public class HgCommand { Link Here
549
        List<String> list = exec(command);
550
        List<String> list = exec(command);
550
        if (!list.isEmpty() && 
551
        if (!list.isEmpty() && 
551
             isErrorAbort(list.get(list.size() -1))) {
552
             isErrorAbort(list.get(list.size() -1))) {
552
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
553
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
553
        }
554
        }
554
        return list;
555
        return list;
555
    }
556
    }
Lines 562-569 public class HgCommand { Link Here
562
     * @return hg incoming output
563
     * @return hg incoming output
563
     * @throws org.netbeans.modules.mercurial.HgException
564
     * @throws org.netbeans.modules.mercurial.HgException
564
     */
565
     */
565
    public static List<String> doIncoming(File repository) throws HgException {
566
    public static List<String> doIncoming(File repository, OutputLogger logger) throws HgException {
566
        return doIncoming(repository, null, null);
567
        return doIncoming(repository, null, null, logger);
567
    }
568
    }
568
569
569
    /**
570
    /**
Lines 576-582 public class HgCommand { Link Here
576
     * @return hg incoming output
577
     * @return hg incoming output
577
     * @throws org.netbeans.modules.mercurial.HgException
578
     * @throws org.netbeans.modules.mercurial.HgException
578
     */
579
     */
579
    public static List<String> doIncoming(File repository, String from, File bundle) throws HgException {
580
    public static List<String> doIncoming(File repository, String from, File bundle, OutputLogger logger) throws HgException {
580
        if (repository == null ) return null;
581
        if (repository == null ) return null;
581
        List<String> command = new ArrayList<String>();
582
        List<String> command = new ArrayList<String>();
582
583
Lines 595-601 public class HgCommand { Link Here
595
596
596
        List<String> list;
597
        List<String> list;
597
        String defaultPull = new HgConfigFiles(repository).getDefaultPull(false);
598
        String defaultPull = new HgConfigFiles(repository).getDefaultPull(false);
598
        String proxy = getGlobalProxyIfNeeded(defaultPull, false);
599
        String proxy = getGlobalProxyIfNeeded(defaultPull, false, null);
599
        if(proxy != null){
600
        if(proxy != null){
600
            List<String> env = new ArrayList<String>(); 
601
            List<String> env = new ArrayList<String>(); 
601
            env.add(HG_PROXY_ENV + proxy);
602
            env.add(HG_PROXY_ENV + proxy);
Lines 606-612 public class HgCommand { Link Here
606
607
607
        if (!list.isEmpty() && 
608
        if (!list.isEmpty() && 
608
             isErrorAbort(list.get(list.size() -1))) {
609
             isErrorAbort(list.get(list.size() -1))) {
609
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
610
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
610
        }
611
        }
611
        return list;
612
        return list;
612
    }
613
    }
Lines 620-626 public class HgCommand { Link Here
620
     * @return hg outgoing output
621
     * @return hg outgoing output
621
     * @throws org.netbeans.modules.mercurial.HgException
622
     * @throws org.netbeans.modules.mercurial.HgException
622
     */
623
     */
623
    public static List<String> doOutgoing(File repository, String to) throws HgException {
624
    public static List<String> doOutgoing(File repository, String to, OutputLogger logger) throws HgException {
624
        if (repository == null ) return null;
625
        if (repository == null ) return null;
625
        List<String> command = new ArrayList<String>();
626
        List<String> command = new ArrayList<String>();
626
627
Lines 633-639 public class HgCommand { Link Here
633
634
634
        List<String> list;
635
        List<String> list;
635
        String defaultPush = new HgConfigFiles(repository).getDefaultPush(false);
636
        String defaultPush = new HgConfigFiles(repository).getDefaultPush(false);
636
        String proxy = getGlobalProxyIfNeeded(defaultPush, false);
637
        String proxy = getGlobalProxyIfNeeded(defaultPush, false, null);
637
        if(proxy != null){
638
        if(proxy != null){
638
            List<String> env = new ArrayList<String>(); 
639
            List<String> env = new ArrayList<String>(); 
639
            env.add(HG_PROXY_ENV + proxy);
640
            env.add(HG_PROXY_ENV + proxy);
Lines 643-649 public class HgCommand { Link Here
643
        }
644
        }
644
        if (!list.isEmpty() && 
645
        if (!list.isEmpty() && 
645
             isErrorAbort(list.get(list.size() -1))) {
646
             isErrorAbort(list.get(list.size() -1))) {
646
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
647
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
647
        }
648
        }
648
        return list;
649
        return list;
649
    }
650
    }
Lines 657-663 public class HgCommand { Link Here
657
     * @return hg push output
658
     * @return hg push output
658
     * @throws org.netbeans.modules.mercurial.HgException
659
     * @throws org.netbeans.modules.mercurial.HgException
659
     */
660
     */
660
    public static List<String> doPush(File repository, String to) throws HgException {
661
    public static List<String> doPush(File repository, String to, OutputLogger logger) throws HgException {
661
        if (repository == null || to == null ) return null;
662
        if (repository == null || to == null ) return null;
662
        List<String> command = new ArrayList<String>();
663
        List<String> command = new ArrayList<String>();
663
664
Lines 669-675 public class HgCommand { Link Here
669
670
670
        List<String> list;
671
        List<String> list;
671
        String defaultPush = new HgConfigFiles(repository).getDefaultPush(false);
672
        String defaultPush = new HgConfigFiles(repository).getDefaultPush(false);
672
        String proxy = getGlobalProxyIfNeeded(defaultPush, true);
673
        String proxy = getGlobalProxyIfNeeded(defaultPush, true, logger);
673
        if(proxy != null){
674
        if(proxy != null){
674
            List<String> env = new ArrayList<String>(); 
675
            List<String> env = new ArrayList<String>(); 
675
            env.add(HG_PROXY_ENV + proxy);
676
            env.add(HG_PROXY_ENV + proxy);
Lines 682-688 public class HgCommand { Link Here
682
        if (!list.isEmpty() && 
683
        if (!list.isEmpty() && 
683
            !isErrorAbortPush(list.get(list.size() -1)) &&
684
            !isErrorAbortPush(list.get(list.size() -1)) &&
684
            isErrorAbort(list.get(list.size() -1))) {
685
            isErrorAbort(list.get(list.size() -1))) {
685
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
686
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
686
        }
687
        }
687
        return list;
688
        return list;
688
    }
689
    }
Lines 693-699 public class HgCommand { Link Here
693
     * @param File repository of the mercurial repository's root directory
694
     * @param File repository of the mercurial repository's root directory
694
     * @throws org.netbeans.modules.mercurial.HgException
695
     * @throws org.netbeans.modules.mercurial.HgException
695
     */
696
     */
696
    public static List<String> doView(File repository) throws HgException {
697
    public static List<String> doView(File repository, OutputLogger logger) throws HgException {
697
        if (repository == null) return null;
698
        if (repository == null) return null;
698
        List<String> command = new ArrayList<String>();
699
        List<String> command = new ArrayList<String>();
699
        List<String> env = new ArrayList<String>();
700
        List<String> env = new ArrayList<String>();
Lines 719-731 public class HgCommand { Link Here
719
            else if (isErrorHgkNotFound(list.get(0))) {
720
            else if (isErrorHgkNotFound(list.get(0))) {
720
                throw new HgException(NbBundle.getMessage(HgCommand.class, "MSG_WARN_HGK_NOT_FOUND_TEXT"));
721
                throw new HgException(NbBundle.getMessage(HgCommand.class, "MSG_WARN_HGK_NOT_FOUND_TEXT"));
721
            } else if (isErrorAbort(list.get(list.size() -1))) {
722
            } else if (isErrorAbort(list.get(list.size() -1))) {
722
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
723
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
723
            }
724
            }
724
        } 
725
        } 
725
        return list;
726
        return list;
726
    }
727
    }
727
    
728
    
728
    private static String getGlobalProxyIfNeeded(String defaultPath, boolean bOutputDetails){
729
    private static String getGlobalProxyIfNeeded(String defaultPath, boolean bOutputDetails, OutputLogger logger){
729
        String proxy = null;
730
        String proxy = null;
730
        if(defaultPath != null && 
731
        if(defaultPath != null && 
731
                (defaultPath.startsWith("http:") || defaultPath.startsWith("https:"))){ // NOI18N
732
                (defaultPath.startsWith("http:") || defaultPath.startsWith("https:"))){ // NOI18N
Lines 750-756 public class HgCommand { Link Here
750
            }
751
            }
751
        }
752
        }
752
        if(proxy != null && bOutputDetails){
753
        if(proxy != null && bOutputDetails){
753
            HgUtils.outputMercurialTab(NbBundle.getMessage(HgCommand.class, "MSG_USING_PROXY_INFO", proxy)); // NOI18N
754
            logger.output(NbBundle.getMessage(HgCommand.class, "MSG_USING_PROXY_INFO", proxy)); // NOI18N
754
        }
755
        }
755
        return proxy;
756
        return proxy;
756
    }
757
    }
Lines 760-766 public class HgCommand { Link Here
760
     * @param File repository of the mercurial repository's root directory
761
     * @param File repository of the mercurial repository's root directory
761
     * @throws org.netbeans.modules.mercurial.HgException
762
     * @throws org.netbeans.modules.mercurial.HgException
762
     */
763
     */
763
    public static List<String> doFetch(File repository) throws HgException {
764
    public static List<String> doFetch(File repository, OutputLogger logger) throws HgException {
764
        if (repository == null) return null;
765
        if (repository == null) return null;
765
        List<String> command = new ArrayList<String>();
766
        List<String> command = new ArrayList<String>();
766
        
767
        
Lines 773-779 public class HgCommand { Link Here
773
        
774
        
774
        List<String> list;
775
        List<String> list;
775
        String defaultPull = new HgConfigFiles(repository).getDefaultPull(false);
776
        String defaultPull = new HgConfigFiles(repository).getDefaultPull(false);
776
        String proxy = getGlobalProxyIfNeeded(defaultPull, true);
777
        String proxy = getGlobalProxyIfNeeded(defaultPull, true, logger);
777
        if(proxy != null){
778
        if(proxy != null){
778
            List<String> env = new ArrayList<String>(); 
779
            List<String> env = new ArrayList<String>(); 
779
            env.add(HG_PROXY_ENV + proxy);
780
            env.add(HG_PROXY_ENV + proxy);
Lines 784-790 public class HgCommand { Link Here
784
785
785
        if (!list.isEmpty()) {
786
        if (!list.isEmpty()) {
786
            if (isErrorAbort(list.get(list.size() -1))) {
787
            if (isErrorAbort(list.get(list.size() -1))) {
787
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
788
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
788
            }
789
            }
789
        } 
790
        } 
790
        return list;
791
        return list;
Lines 834-848 public class HgCommand { Link Here
834
        final List<HgLogMessage> messages = new ArrayList<HgLogMessage>(0);  
835
        final List<HgLogMessage> messages = new ArrayList<HgLogMessage>(0);  
835
        final File root = new File(rootUrl);
836
        final File root = new File(rootUrl);
836
        
837
        
838
        OutputLogger logger = OutputLogger.getLogger(rootUrl);
837
        try {
839
        try {
838
840
839
            List<String> list = new LinkedList<String>();
841
            List<String> list = new LinkedList<String>();
840
            list = HgCommand.doIncomingForSearch(root);
842
            list = HgCommand.doIncomingForSearch(root, logger);
841
            processLogMessages(list, messages);
843
            processLogMessages(list, messages);
842
844
843
        } catch (HgException ex) {
845
        } catch (HgException ex) {
844
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
846
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
845
            DialogDisplayer.getDefault().notifyLater(e);
847
            DialogDisplayer.getDefault().notifyLater(e);
848
        } finally {
849
            logger.closeLog();
846
        }
850
        }
847
        
851
        
848
        return messages.toArray(new HgLogMessage[0]);
852
        return messages.toArray(new HgLogMessage[0]);
Lines 852-866 public class HgCommand { Link Here
852
        final List<HgLogMessage> messages = new ArrayList<HgLogMessage>(0);  
856
        final List<HgLogMessage> messages = new ArrayList<HgLogMessage>(0);  
853
        final File root = new File(rootUrl);
857
        final File root = new File(rootUrl);
854
        
858
        
859
        OutputLogger logger = OutputLogger.getLogger(rootUrl);
855
        try {
860
        try {
856
861
857
            List<String> list = new LinkedList<String>();
862
            List<String> list = new LinkedList<String>();
858
            list = HgCommand.doOut(root);
863
            list = HgCommand.doOut(root, logger);
859
            processLogMessages(list, messages);
864
            processLogMessages(list, messages);
860
865
861
        } catch (HgException ex) {
866
        } catch (HgException ex) {
862
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
867
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
863
            DialogDisplayer.getDefault().notifyLater(e);
868
            DialogDisplayer.getDefault().notifyLater(e);
869
        } finally {
870
            logger.closeLog();
864
        }
871
        }
865
        
872
        
866
        return messages.toArray(new HgLogMessage[0]);
873
        return messages.toArray(new HgLogMessage[0]);
Lines 870-875 public class HgCommand { Link Here
870
        final List<HgLogMessage> messages = new ArrayList<HgLogMessage>(0);  
877
        final List<HgLogMessage> messages = new ArrayList<HgLogMessage>(0);  
871
        final File root = new File(rootUrl);
878
        final File root = new File(rootUrl);
872
        
879
        
880
        OutputLogger logger = OutputLogger.getLogger(rootUrl);
873
        try {
881
        try {
874
            String headRev = HgCommand.getLastRevision(root, null);
882
            String headRev = HgCommand.getLastRevision(root, null);
875
            if (headRev == null) {
883
            if (headRev == null) {
Lines 879-890 public class HgCommand { Link Here
879
            List<String> list = new LinkedList<String>();
887
            List<String> list = new LinkedList<String>();
880
            list = HgCommand.doLogForHistory(root, 
888
            list = HgCommand.doLogForHistory(root, 
881
                    files != null ? new ArrayList<File>(files) : null,
889
                    files != null ? new ArrayList<File>(files) : null,
882
                    fromRevision, toRevision, headRev);
890
                    fromRevision, toRevision, headRev, logger);
883
            processLogMessages(list, messages);
891
            processLogMessages(list, messages);
884
            
892
            
885
        } catch (HgException ex) {
893
        } catch (HgException ex) {
886
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
894
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
887
            DialogDisplayer.getDefault().notifyLater(e);
895
            DialogDisplayer.getDefault().notifyLater(e);
896
        } finally {
897
            logger.closeLog();
888
        }
898
        }
889
        
899
        
890
        return messages.toArray(new HgLogMessage[0]);
900
        return messages.toArray(new HgLogMessage[0]);
Lines 996-1003 public class HgCommand { Link Here
996
     * @return List<String> list of the log entries for the specified file.
1006
     * @return List<String> list of the log entries for the specified file.
997
     * @throws org.netbeans.modules.mercurial.HgException
1007
     * @throws org.netbeans.modules.mercurial.HgException
998
     */
1008
     */
999
     public static List<String> doLogShort(File repository, File file) throws HgException {
1009
     public static List<String> doLogShort(File repository, File file, OutputLogger logger) throws HgException {
1000
        return doLog(repository, file, HG_LOG_TEMPLATE_SHORT_CMD, false);
1010
        return doLog(repository, file, HG_LOG_TEMPLATE_SHORT_CMD, false, logger);
1001
     }
1011
     }
1002
     
1012
     
1003
     /**
1013
     /**
Lines 1008-1015 public class HgCommand { Link Here
1008
     * @return List<String> list of the log entries for the specified file.
1018
     * @return List<String> list of the log entries for the specified file.
1009
     * @throws org.netbeans.modules.mercurial.HgException
1019
     * @throws org.netbeans.modules.mercurial.HgException
1010
     */
1020
     */
1011
     public static List<String> doLogLong(File repository, File file) throws HgException {
1021
     public static List<String> doLogLong(File repository, File file, OutputLogger logger) throws HgException {
1012
        return doLog(repository, file, HG_LOG_TEMPLATE_LONG_CMD, false);
1022
        return doLog(repository, file, HG_LOG_TEMPLATE_LONG_CMD, false, logger);
1013
     }
1023
     }
1014
1024
1015
     /**
1025
     /**
Lines 1022-1028 public class HgCommand { Link Here
1022
     * @return List<String> list of the log entries for the specified file.
1032
     * @return List<String> list of the log entries for the specified file.
1023
     * @throws org.netbeans.modules.mercurial.HgException
1033
     * @throws org.netbeans.modules.mercurial.HgException
1024
     */
1034
     */
1025
    public static List<String> doLog(File repository, File file, String LOG_TEMPLATE, boolean bDebug) throws HgException {
1035
    public static List<String> doLog(File repository, File file, String LOG_TEMPLATE, boolean bDebug, OutputLogger logger) throws HgException {
1026
        if (repository == null ) return null;
1036
        if (repository == null ) return null;
1027
        
1037
        
1028
        List<String> command = new ArrayList<String>();
1038
        List<String> command = new ArrayList<String>();
Lines 1043-1051 public class HgCommand { Link Here
1043
        List<String> list = exec(command);
1053
        List<String> list = exec(command);
1044
        if (!list.isEmpty()) {
1054
        if (!list.isEmpty()) {
1045
            if (isErrorNoRepository(list.get(0))) {
1055
            if (isErrorNoRepository(list.get(0))) {
1046
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"));
1056
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"), logger);
1047
             } else if (isErrorAbort(list.get(0))) {
1057
             } else if (isErrorAbort(list.get(0))) {
1048
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
1058
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
1049
             }
1059
             }
1050
        }
1060
        }
1051
        return list;
1061
        return list;
Lines 1061-1067 public class HgCommand { Link Here
1061
     * @return List<String> list of the log entries for the specified file.
1071
     * @return List<String> list of the log entries for the specified file.
1062
     * @throws org.netbeans.modules.mercurial.HgException
1072
     * @throws org.netbeans.modules.mercurial.HgException
1063
     */
1073
     */
1064
    public static List<String> doLog(File repository, List<File> files, String LOG_TEMPLATE, boolean bDebug) throws HgException {
1074
    public static List<String> doLog(File repository, List<File> files, String LOG_TEMPLATE, boolean bDebug, OutputLogger logger) throws HgException {
1065
        if (repository == null ) return null;
1075
        if (repository == null ) return null;
1066
        if (files != null && files.isEmpty()) return null;
1076
        if (files != null && files.isEmpty()) return null;
1067
        
1077
        
Lines 1099-1107 public class HgCommand { Link Here
1099
        List<String> list = exec(command);
1109
        List<String> list = exec(command);
1100
        if (!list.isEmpty()) {
1110
        if (!list.isEmpty()) {
1101
            if (isErrorNoRepository(list.get(0))) {
1111
            if (isErrorNoRepository(list.get(0))) {
1102
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"));
1112
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"), logger);
1103
             } else if (isErrorAbort(list.get(0))) {
1113
             } else if (isErrorAbort(list.get(0))) {
1104
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
1114
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
1105
             }
1115
             }
1106
        }
1116
        }
1107
        return list;
1117
        return list;
Lines 1118-1124 public class HgCommand { Link Here
1118
     * @throws org.netbeans.modules.mercurial.HgException
1128
     * @throws org.netbeans.modules.mercurial.HgException
1119
     */
1129
     */
1120
    public static List<String> doLogForHistory(File repository, List<File> files, 
1130
    public static List<String> doLogForHistory(File repository, List<File> files, 
1121
            String from, String to, String headRev) throws HgException {
1131
            String from, String to, String headRev, OutputLogger logger) throws HgException {
1122
        if (repository == null ) return null;
1132
        if (repository == null ) return null;
1123
        if (files != null && files.isEmpty()) return null;
1133
        if (files != null && files.isEmpty()) return null;
1124
        
1134
        
Lines 1163-1171 public class HgCommand { Link Here
1163
        List<String> list = exec(command);
1173
        List<String> list = exec(command);
1164
        if (!list.isEmpty()) {
1174
        if (!list.isEmpty()) {
1165
            if (isErrorNoRepository(list.get(0))) {
1175
            if (isErrorNoRepository(list.get(0))) {
1166
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"));
1176
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"), logger);
1167
             } else if (isErrorAbort(list.get(0))) {
1177
             } else if (isErrorAbort(list.get(0))) {
1168
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
1178
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
1169
             }
1179
             }
1170
        }
1180
        }
1171
        return list;
1181
        return list;
Lines 1178-1184 public class HgCommand { Link Here
1178
     * @return List<String> list of the out entries for the specified repo.
1188
     * @return List<String> list of the out entries for the specified repo.
1179
     * @throws org.netbeans.modules.mercurial.HgException
1189
     * @throws org.netbeans.modules.mercurial.HgException
1180
     */
1190
     */
1181
    public static List<String> doOut(File repository) throws HgException {
1191
    public static List<String> doOut(File repository, OutputLogger logger) throws HgException {
1182
        if (repository == null ) return null;
1192
        if (repository == null ) return null;
1183
        
1193
        
1184
        List<String> command = new ArrayList<String>();
1194
        List<String> command = new ArrayList<String>();
Lines 1193-1199 public class HgCommand { Link Here
1193
1203
1194
        List<String> list;
1204
        List<String> list;
1195
        String defaultPush = new HgConfigFiles(repository).getDefaultPush(false);
1205
        String defaultPush = new HgConfigFiles(repository).getDefaultPush(false);
1196
        String proxy = getGlobalProxyIfNeeded(defaultPush, false);
1206
        String proxy = getGlobalProxyIfNeeded(defaultPush, false, null);
1197
        if(proxy != null){
1207
        if(proxy != null){
1198
            List<String> env = new ArrayList<String>(); 
1208
            List<String> env = new ArrayList<String>(); 
1199
            env.add(HG_PROXY_ENV + proxy);
1209
            env.add(HG_PROXY_ENV + proxy);
Lines 1205-1213 public class HgCommand { Link Here
1205
            if(isErrorNoDefaultPush(list.get(0))){
1215
            if(isErrorNoDefaultPush(list.get(0))){
1206
                // Ignore
1216
                // Ignore
1207
            }else if (isErrorNoRepository(list.get(0))) {
1217
            }else if (isErrorNoRepository(list.get(0))) {
1208
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"));
1218
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"), logger);
1209
             } else if (isErrorAbort(list.get(0))) {
1219
             } else if (isErrorAbort(list.get(0))) {
1210
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
1220
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
1211
             }
1221
             }
1212
        }
1222
        }
1213
        return list;
1223
        return list;
Lines 1220-1226 public class HgCommand { Link Here
1220
     * @return List<String> list of the out entries for the specified repo.
1230
     * @return List<String> list of the out entries for the specified repo.
1221
     * @throws org.netbeans.modules.mercurial.HgException
1231
     * @throws org.netbeans.modules.mercurial.HgException
1222
     */
1232
     */
1223
    public static List<String> doIncomingForSearch(File repository) throws HgException {
1233
    public static List<String> doIncomingForSearch(File repository, OutputLogger logger) throws HgException {
1224
        if (repository == null ) return null;
1234
        if (repository == null ) return null;
1225
        
1235
        
1226
        List<String> command = new ArrayList<String>();
1236
        List<String> command = new ArrayList<String>();
Lines 1234-1240 public class HgCommand { Link Here
1234
1244
1235
        List<String> list = exec(command);
1245
        List<String> list = exec(command);
1236
        String defaultPull = new HgConfigFiles(repository).getDefaultPull(false);
1246
        String defaultPull = new HgConfigFiles(repository).getDefaultPull(false);
1237
        String proxy = getGlobalProxyIfNeeded(defaultPull, false);
1247
        String proxy = getGlobalProxyIfNeeded(defaultPull, false, null);
1238
        if(proxy != null){
1248
        if(proxy != null){
1239
            List<String> env = new ArrayList<String>(); 
1249
            List<String> env = new ArrayList<String>(); 
1240
            env.add(HG_PROXY_ENV + proxy);
1250
            env.add(HG_PROXY_ENV + proxy);
Lines 1247-1255 public class HgCommand { Link Here
1247
            if (isErrorNoDefaultPath(list.get(0))) {
1257
            if (isErrorNoDefaultPath(list.get(0))) {
1248
            // Ignore
1258
            // Ignore
1249
            } else if (isErrorNoRepository(list.get(0))) {
1259
            } else if (isErrorNoRepository(list.get(0))) {
1250
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"));
1260
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"), logger);
1251
            } else if (isErrorAbort(list.get(0)) || isErrorAbort(list.get(list.size() - 1))) {
1261
            } else if (isErrorAbort(list.get(0)) || isErrorAbort(list.get(list.size() - 1))) {
1252
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
1262
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
1253
            }
1263
            }
1254
        }
1264
        }
1255
        return list;
1265
        return list;
Lines 1383-1390 public class HgCommand { Link Here
1383
     * @param File outFile to contain the contents of the file
1393
     * @param File outFile to contain the contents of the file
1384
     * @throws org.netbeans.modules.mercurial.HgException
1394
     * @throws org.netbeans.modules.mercurial.HgException
1385
     */
1395
     */
1386
    public static void doCat(File repository, File file, File outFile) throws HgException {
1396
    public static void doCat(File repository, File file, File outFile, OutputLogger logger) throws HgException {
1387
        doCat(repository, file, outFile, "tip", false); //NOI18N
1397
        doCat(repository, file, outFile, "tip", false, logger); //NOI18N
1388
    }
1398
    }
1389
    
1399
    
1390
    /**
1400
    /**
Lines 1399-1409 public class HgCommand { Link Here
1399
     * @return List<String> list of all the log entries
1409
     * @return List<String> list of all the log entries
1400
     * @throws org.netbeans.modules.mercurial.HgException
1410
     * @throws org.netbeans.modules.mercurial.HgException
1401
     */
1411
     */
1402
    public static void doCat(File repository, File file, File outFile, String revision) throws HgException {
1412
    public static void doCat(File repository, File file, File outFile, String revision, OutputLogger logger) throws HgException {
1403
        doCat(repository, file, outFile, revision, true); //NOI18N
1413
        doCat(repository, file, outFile, revision, true, logger); //NOI18N
1404
    }
1414
    }
1405
1415
1406
    public static void doCat(File repository, File file, File outFile, String revision, boolean retry) throws HgException {
1416
    public static void doCat(File repository, File file, File outFile, String revision, boolean retry, OutputLogger logger) throws HgException {
1407
        if (repository == null) return;
1417
        if (repository == null) return;
1408
        if (file == null) return;
1418
        if (file == null) return;
1409
        
1419
        
Lines 1425-1433 public class HgCommand { Link Here
1425
        
1435
        
1426
        if (!list.isEmpty()) {
1436
        if (!list.isEmpty()) {
1427
            if (isErrorNoRepository(list.get(0))) {
1437
            if (isErrorNoRepository(list.get(0))) {
1428
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"));
1438
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"), logger);
1429
             } else if (isErrorAbort(list.get(0))) {
1439
             } else if (isErrorAbort(list.get(0))) {
1430
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
1440
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
1431
             }
1441
             }
1432
        }
1442
        }
1433
        if (outFile.length() == 0 && retry) {
1443
        if (outFile.length() == 0 && retry) {
Lines 1435-1441 public class HgCommand { Link Here
1435
            String newRevision = Integer.toString(Integer.parseInt(revision)+1);
1445
            String newRevision = Integer.toString(Integer.parseInt(revision)+1);
1436
            File prevFile = getPreviousName(repository, file, newRevision); 
1446
            File prevFile = getPreviousName(repository, file, newRevision); 
1437
            if (prevFile != null) {
1447
            if (prevFile != null) {
1438
                doCat(repository, prevFile, outFile, revision, false); //NOI18N
1448
                doCat(repository, prevFile, outFile, revision, false, logger); //NOI18N
1439
            }
1449
            }
1440
        }
1450
        }
1441
    }
1451
    }
Lines 1449-1455 public class HgCommand { Link Here
1449
     * @return void
1459
     * @return void
1450
     * @throws org.netbeans.modules.mercurial.HgException
1460
     * @throws org.netbeans.modules.mercurial.HgException
1451
     */
1461
     */
1452
    public static void doCreate(File root) throws HgException {
1462
    public static void doCreate(File root, OutputLogger logger) throws HgException {
1453
        if (root == null ) return;
1463
        if (root == null ) return;
1454
        List<String> command = new ArrayList<String>();
1464
        List<String> command = new ArrayList<String>();
1455
        
1465
        
Lines 1459-1465 public class HgCommand { Link Here
1459
1469
1460
        List<String> list = exec(command);
1470
        List<String> list = exec(command);
1461
        if (!list.isEmpty())
1471
        if (!list.isEmpty())
1462
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_CREATE_FAILED"));
1472
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_CREATE_FAILED"), logger);
1463
    }
1473
    }
1464
    
1474
    
1465
    /**
1475
    /**
Lines 1470-1478 public class HgCommand { Link Here
1470
     * @return clone output
1480
     * @return clone output
1471
     * @throws org.netbeans.modules.mercurial.HgException
1481
     * @throws org.netbeans.modules.mercurial.HgException
1472
     */
1482
     */
1473
    public static List<String> doClone(File repository, String target) throws HgException {
1483
    public static List<String> doClone(File repository, String target, OutputLogger logger) throws HgException {
1474
        if (repository == null) return null;
1484
        if (repository == null) return null;
1475
        return doClone(repository.getAbsolutePath(), target);
1485
        return doClone(repository.getAbsolutePath(), target, logger);
1476
    }
1486
    }
1477
    
1487
    
1478
    /**
1488
    /**
Lines 1483-1489 public class HgCommand { Link Here
1483
     * @return clone output
1493
     * @return clone output
1484
     * @throws org.netbeans.modules.mercurial.HgException
1494
     * @throws org.netbeans.modules.mercurial.HgException
1485
     */
1495
     */
1486
    public static List<String> doClone(String repository, String target) throws HgException {
1496
    public static List<String> doClone(String repository, String target, OutputLogger logger) throws HgException {
1487
        if (repository == null || target == null) return null;
1497
        if (repository == null || target == null) return null;
1488
        
1498
        
1489
        // Ensure that parent directory of target exists, creating if necessary
1499
        // Ensure that parent directory of target exists, creating if necessary
Lines 1517-1527 public class HgCommand { Link Here
1517
        List<String> list = exec(command);
1527
        List<String> list = exec(command);
1518
        if (!list.isEmpty()) {
1528
        if (!list.isEmpty()) {
1519
            if (isErrorNoRepository(list.get(0))){
1529
            if (isErrorNoRepository(list.get(0))){
1520
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"));
1530
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"), logger);
1521
            }else if (isErrorNoResponse(list.get(list.size() -1))){
1531
            }else if (isErrorNoResponse(list.get(list.size() -1))){
1522
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_RESPONSE_ERR"));
1532
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_RESPONSE_ERR"), logger);
1523
            }else if (isErrorAbort(list.get(list.size() -1))){
1533
            }else if (isErrorAbort(list.get(list.size() -1))){
1524
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
1534
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
1525
            }
1535
            }
1526
        }
1536
        }
1527
        return list;
1537
        return list;
Lines 1536-1542 public class HgCommand { Link Here
1536
     * @return void
1546
     * @return void
1537
     * @throws org.netbeans.modules.mercurial.HgException
1547
     * @throws org.netbeans.modules.mercurial.HgException
1538
     */
1548
     */
1539
    public static void doCommit(File repository, List<File> commitFiles, String commitMessage)  throws HgException {
1549
    public static void doCommit(File repository, List<File> commitFiles, String commitMessage, OutputLogger logger)  throws HgException {
1540
        List<String> command = new ArrayList<String>();
1550
        List<String> command = new ArrayList<String>();
1541
1551
1542
        command.add(getHgCommand());
1552
        command.add(getHgCommand());
Lines 1581-1587 public class HgCommand { Link Here
1581
            
1591
            
1582
            if (!list.isEmpty()
1592
            if (!list.isEmpty()
1583
                    && (isErrorNotTracked(list.get(0)) || isErrorCannotReadCommitMsg(list.get(0))))
1593
                    && (isErrorNotTracked(list.get(0)) || isErrorCannotReadCommitMsg(list.get(0))))
1584
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMIT_FAILED"));
1594
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMIT_FAILED"), logger);
1585
            
1595
            
1586
        }catch (IOException ex){
1596
        }catch (IOException ex){
1587
            throw new HgException(NbBundle.getMessage(HgCommand.class, "MSG_FAILED_TO_READ_COMMIT_MESSAGE"));
1597
            throw new HgException(NbBundle.getMessage(HgCommand.class, "MSG_FAILED_TO_READ_COMMIT_MESSAGE"));
Lines 1604-1614 public class HgCommand { Link Here
1604
     * @return void
1614
     * @return void
1605
     * @throws org.netbeans.modules.mercurial.HgException
1615
     * @throws org.netbeans.modules.mercurial.HgException
1606
     */
1616
     */
1607
    public static void doRename(File repository, File sourceFile, File destFile)  throws HgException {
1617
    public static void doRename(File repository, File sourceFile, File destFile, OutputLogger logger)  throws HgException {
1608
        doRename(repository, sourceFile, destFile, false);
1618
        doRename(repository, sourceFile, destFile, false, logger);
1609
    }
1619
    }
1610
1620
1611
    private static void doRename(File repository, File sourceFile, File destFile, boolean bAfter)  throws HgException {
1621
    private static void doRename(File repository, File sourceFile, File destFile, boolean bAfter, OutputLogger logger)  throws HgException {
1612
        if (repository == null) return;
1622
        if (repository == null) return;
1613
        
1623
        
1614
        List<String> command = new ArrayList<String>();
1624
        List<String> command = new ArrayList<String>();
Lines 1628-1634 public class HgCommand { Link Here
1628
        if (!list.isEmpty() &&
1638
        if (!list.isEmpty() &&
1629
             isErrorAbort(list.get(list.size() -1))) {
1639
             isErrorAbort(list.get(list.size() -1))) {
1630
            if (!bAfter || !isErrorAbortNoFilesToCopy(list.get(list.size() -1))) {
1640
            if (!bAfter || !isErrorAbortNoFilesToCopy(list.get(list.size() -1))) {
1631
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_RENAME_FAILED"));
1641
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_RENAME_FAILED"), logger);
1632
            }
1642
            }
1633
        }
1643
        }
1634
    }
1644
    }
Lines 1643-1650 public class HgCommand { Link Here
1643
     * @return void
1653
     * @return void
1644
     * @throws org.netbeans.modules.mercurial.HgException
1654
     * @throws org.netbeans.modules.mercurial.HgException
1645
     */
1655
     */
1646
    public static void doRenameAfter(File repository, File sourceFile, File destFile)  throws HgException {
1656
    public static void doRenameAfter(File repository, File sourceFile, File destFile, OutputLogger logger)  throws HgException {
1647
       doRename(repository, sourceFile, destFile, true);
1657
       doRename(repository, sourceFile, destFile, true, logger);
1648
    }
1658
    }
1649
    
1659
    
1650
    /**
1660
    /**
Lines 1657-1663 public class HgCommand { Link Here
1657
     * @return void
1667
     * @return void
1658
     * @throws org.netbeans.modules.mercurial.HgException
1668
     * @throws org.netbeans.modules.mercurial.HgException
1659
     */
1669
     */
1660
    public static void doAdd(File repository, List<File> addFiles)  throws HgException {
1670
    public static void doAdd(File repository, List<File> addFiles, OutputLogger logger)  throws HgException {
1661
        if (repository == null) return;
1671
        if (repository == null) return;
1662
        if (addFiles.size() == 0) return;
1672
        if (addFiles.size() == 0) return;
1663
        List<String> command = new ArrayList<String>();
1673
        List<String> command = new ArrayList<String>();
Lines 1676-1682 public class HgCommand { Link Here
1676
        }
1686
        }
1677
        List<String> list = exec(command);
1687
        List<String> list = exec(command);
1678
        if (!list.isEmpty() && isErrorAlreadyTracked(list.get(0)))
1688
        if (!list.isEmpty() && isErrorAlreadyTracked(list.get(0)))
1679
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_ALREADY_TRACKED"));
1689
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_ALREADY_TRACKED"), logger);
1680
    }
1690
    }
1681
1691
1682
    /**
1692
    /**
Lines 1689-1695 public class HgCommand { Link Here
1689
     * @throws org.netbeans.modules.mercurial.HgException
1699
     * @throws org.netbeans.modules.mercurial.HgException
1690
     */
1700
     */
1691
    public static void doRevert(File repository, List<File> revertFiles, 
1701
    public static void doRevert(File repository, List<File> revertFiles, 
1692
            String revision, boolean doBackup)  throws HgException {
1702
            String revision, boolean doBackup, OutputLogger logger)  throws HgException {
1693
        if (repository == null) return;
1703
        if (repository == null) return;
1694
        if (revertFiles.size() == 0) return;
1704
        if (revertFiles.size() == 0) return;
1695
        
1705
        
Lines 1712-1718 public class HgCommand { Link Here
1712
        }
1722
        }
1713
        List<String> list = exec(command);
1723
        List<String> list = exec(command);
1714
        if (!list.isEmpty() && isErrorNoChangeNeeded(list.get(0)))
1724
        if (!list.isEmpty() && isErrorNoChangeNeeded(list.get(0)))
1715
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_REVERT_FAILED"));
1725
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_REVERT_FAILED"), logger);
1716
    }
1726
    }
1717
1727
1718
    /**
1728
    /**
Lines 1725-1731 public class HgCommand { Link Here
1725
     * @return void
1735
     * @return void
1726
     * @throws org.netbeans.modules.mercurial.HgException
1736
     * @throws org.netbeans.modules.mercurial.HgException
1727
     */
1737
     */
1728
    public static void doAdd(File repository, File file)  throws HgException {
1738
    public static void doAdd(File repository, File file, OutputLogger logger)  throws HgException {
1729
        if (repository == null) return;
1739
        if (repository == null) return;
1730
        if (file == null) return;
1740
        if (file == null) return;
1731
        if (file.isDirectory()) return;
1741
        if (file.isDirectory()) return;
Lines 1742-1748 public class HgCommand { Link Here
1742
        command.add(file.getAbsolutePath());
1752
        command.add(file.getAbsolutePath());
1743
        List<String> list = exec(command);
1753
        List<String> list = exec(command);
1744
        if (!list.isEmpty() && isErrorAlreadyTracked(list.get(0)))
1754
        if (!list.isEmpty() && isErrorAlreadyTracked(list.get(0)))
1745
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_ALREADY_TRACKED"));
1755
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_ALREADY_TRACKED"), logger);
1746
    }
1756
    }
1747
    
1757
    
1748
    /**
1758
    /**
Lines 1754-1760 public class HgCommand { Link Here
1754
     * @return List<String> list of the annotated lines of the file
1764
     * @return List<String> list of the annotated lines of the file
1755
     * @throws org.netbeans.modules.mercurial.HgException
1765
     * @throws org.netbeans.modules.mercurial.HgException
1756
     */
1766
     */
1757
    public static List<String> doAnnotate(File repository, File file, String revision) throws HgException {
1767
    public static List<String> doAnnotate(File repository, File file, String revision, OutputLogger logger) throws HgException {
1758
        if (repository == null) return null;
1768
        if (repository == null) return null;
1759
        List<String> command = new ArrayList<String>();
1769
        List<String> command = new ArrayList<String>();
1760
1770
Lines 1774-1787 public class HgCommand { Link Here
1774
        List<String> list = exec(command);
1784
        List<String> list = exec(command);
1775
        if (!list.isEmpty()) {
1785
        if (!list.isEmpty()) {
1776
            if (isErrorNoRepository(list.get(0))) {
1786
            if (isErrorNoRepository(list.get(0))) {
1777
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"));
1787
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"), logger);
1778
            } else if (isErrorNoSuchFile(list.get(0))) {
1788
            } else if (isErrorNoSuchFile(list.get(0))) {
1779
                // This can happen if we have multiple heads and the wrong
1789
                // This can happen if we have multiple heads and the wrong
1780
                // one was picked by default hg annotation 
1790
                // one was picked by default hg annotation 
1781
                if (revision == null) {
1791
                if (revision == null) {
1782
                    String rev = getLastRevision(repository, file);
1792
                    String rev = getLastRevision(repository, file);
1783
                    if (rev != null) {
1793
                    if (rev != null) {
1784
                        list = doAnnotate(repository, file, rev);
1794
                        list = doAnnotate(repository, file, rev, logger);
1785
                    } else {
1795
                    } else {
1786
                        list = null;
1796
                        list = null;
1787
                    }
1797
                    }
Lines 1793-1800 public class HgCommand { Link Here
1793
        return list;
1803
        return list;
1794
    }
1804
    }
1795
  
1805
  
1796
    public static List<String> doAnnotate(File repository, File file) throws HgException {
1806
    public static List<String> doAnnotate(File repository, File file, OutputLogger logger) throws HgException {
1797
        return doAnnotate(repository, file, null);
1807
        return doAnnotate(repository, file, null, logger);
1798
    }
1808
    }
1799
1809
1800
    /**
1810
    /**
Lines 2258-2264 public class HgCommand { Link Here
2258
     * @param f path to be removed from the repository
2268
     * @param f path to be removed from the repository
2259
     * @throws org.netbeans.modules.mercurial.HgException
2269
     * @throws org.netbeans.modules.mercurial.HgException
2260
     */
2270
     */
2261
    public static void doRemove(File repository, File f)  throws HgException {
2271
    public static void doRemove(File repository, File f, OutputLogger logger)  throws HgException {
2262
        List<String> command = new ArrayList<String>();
2272
        List<String> command = new ArrayList<String>();
2263
2273
2264
        command.add(getHgCommand());
2274
        command.add(getHgCommand());
Lines 2270-2276 public class HgCommand { Link Here
2270
2280
2271
        List<String> list = exec(command);
2281
        List<String> list = exec(command);
2272
        if (!list.isEmpty() && isErrorAlreadyTracked(list.get(0)))
2282
        if (!list.isEmpty() && isErrorAlreadyTracked(list.get(0)))
2273
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_ALREADY_TRACKED"));
2283
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_ALREADY_TRACKED"), logger);
2274
    }
2284
    }
2275
    
2285
    
2276
    /**
2286
    /**
Lines 2281-2287 public class HgCommand { Link Here
2281
     * @param outputFileName path of the output file
2291
     * @param outputFileName path of the output file
2282
     * @throws org.netbeans.modules.mercurial.HgException
2292
     * @throws org.netbeans.modules.mercurial.HgException
2283
     */
2293
     */
2284
    public static List<String> doExport(File repository, String revStr, String outputFileName)  throws HgException {
2294
    public static List<String> doExport(File repository, String revStr, String outputFileName, OutputLogger logger)  throws HgException {
2285
        // Ensure that parent directory of target exists, creating if necessary
2295
        // Ensure that parent directory of target exists, creating if necessary
2286
        File fileTarget = new File (outputFileName);
2296
        File fileTarget = new File (outputFileName);
2287
        File parentTarget = fileTarget.getParentFile();
2297
        File parentTarget = fileTarget.getParentFile();
Lines 2310-2316 public class HgCommand { Link Here
2310
        List<String> list = exec(command);
2320
        List<String> list = exec(command);
2311
        if (!list.isEmpty() &&
2321
        if (!list.isEmpty() &&
2312
             isErrorAbort(list.get(list.size() -1))) {
2322
             isErrorAbort(list.get(list.size() -1))) {
2313
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_EXPORT_FAILED"));
2323
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_EXPORT_FAILED"), logger);
2314
        }
2324
        }
2315
        return list;
2325
        return list;
2316
    }
2326
    }
Lines 2322-2328 public class HgCommand { Link Here
2322
     * @param File patchFile of the patch file
2332
     * @param File patchFile of the patch file
2323
     * @throws org.netbeans.modules.mercurial.HgException
2333
     * @throws org.netbeans.modules.mercurial.HgException
2324
     */
2334
     */
2325
    public static List<String> doImport(File repository, File patchFile)  throws HgException {
2335
    public static List<String> doImport(File repository, File patchFile, OutputLogger logger)  throws HgException {
2326
        List<String> command = new ArrayList<String>();
2336
        List<String> command = new ArrayList<String>();
2327
2337
2328
        command.add(getHgCommand());
2338
        command.add(getHgCommand());
Lines 2337-2344 public class HgCommand { Link Here
2337
        List<String> list = exec(command);
2347
        List<String> list = exec(command);
2338
        if (!list.isEmpty() &&
2348
        if (!list.isEmpty() &&
2339
             isErrorAbort(list.get(list.size() -1))) {
2349
             isErrorAbort(list.get(list.size() -1))) {
2340
            HgUtils.outputMercurialTab(list); // need the failure info from import
2350
            logger.output(list); // need the failure info from import
2341
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_IMPORT_FAILED"));
2351
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_IMPORT_FAILED"), logger);
2342
        }
2352
        }
2343
        return list;
2353
        return list;
2344
    }
2354
    }
Lines 2504-2511 public class HgCommand { Link Here
2504
        }
2514
        }
2505
        
2515
        
2506
        List<String> list =  exec(command);
2516
        List<String> list =  exec(command);
2507
        if (!list.isEmpty() && isErrorNoRepository(list.get(0)))
2517
        if (!list.isEmpty() && isErrorNoRepository(list.get(0))) {
2508
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"));
2518
            OutputLogger logger = OutputLogger.getLogger(repository.getAbsolutePath());
2519
            try {
2520
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"), logger);
2521
            } finally {
2522
                logger.closeLog();
2523
            }
2524
        }
2509
        return list;
2525
        return list;
2510
    }
2526
    }
2511
    /**
2527
    /**
Lines 2644-2655 public class HgCommand { Link Here
2644
            return defaultPath + File.separatorChar + HG_COMMAND;
2660
            return defaultPath + File.separatorChar + HG_COMMAND;
2645
    }
2661
    }
2646
2662
2647
    private static void handleError(List<String> command, List<String> list, String message) throws HgException{
2663
    private static void handleError(List<String> command, List<String> list, String message, OutputLogger logger) throws HgException{
2648
        if (command != null && list != null){
2664
        if (command != null && list != null){
2649
            Mercurial.LOG.log(Level.WARNING, "command: " + HgUtils.replaceHttpPassword(command)); // NOI18N        
2665
            Mercurial.LOG.log(Level.WARNING, "command: " + HgUtils.replaceHttpPassword(command)); // NOI18N        
2650
            Mercurial.LOG.log(Level.WARNING, "output: " + HgUtils.replaceHttpPassword(list)); // NOI18N
2666
            Mercurial.LOG.log(Level.WARNING, "output: " + HgUtils.replaceHttpPassword(list)); // NOI18N
2651
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ERR")); // NOI18N
2667
            logger.outputInRed(NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ERR")); // NOI18N
2652
            HgUtils.outputMercurialTab(NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_INFO_ERR",
2668
            logger.output(NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_INFO_ERR",
2653
                    HgUtils.replaceHttpPassword(command), HgUtils.replaceHttpPassword(list))); // NOI18N
2669
                    HgUtils.replaceHttpPassword(command), HgUtils.replaceHttpPassword(list))); // NOI18N
2654
        }
2670
        }
2655
2671
(-)a/mercurial/src/org/netbeans/modules/mercurial/util/HgUtils.java (-132 lines)
Lines 50-56 import java.io.IOException; Link Here
50
import java.io.IOException;
50
import java.io.IOException;
51
import java.io.OutputStreamWriter;
51
import java.io.OutputStreamWriter;
52
import java.io.PrintWriter;
52
import java.io.PrintWriter;
53
import java.net.URL;
54
import java.text.SimpleDateFormat;
53
import java.text.SimpleDateFormat;
55
import java.util.List;
54
import java.util.List;
56
import java.util.Arrays;
55
import java.util.Arrays;
Lines 78-86 import org.openide.windows.OutputEvent; Link Here
78
import org.openide.windows.OutputEvent;
77
import org.openide.windows.OutputEvent;
79
import org.openide.windows.TopComponent;
78
import org.openide.windows.TopComponent;
80
import org.netbeans.modules.versioning.spi.VCSContext;
79
import org.netbeans.modules.versioning.spi.VCSContext;
81
import org.openide.windows.IOProvider;
82
import org.openide.windows.InputOutput;
83
import org.openide.windows.OutputWriter;
84
import java.util.Calendar;
80
import java.util.Calendar;
85
import java.util.Date;
81
import java.util.Date;
86
import java.util.HashMap;
82
import java.util.HashMap;
Lines 98-106 import org.netbeans.api.project.FileOwne Link Here
98
import org.netbeans.api.project.FileOwnerQuery;
94
import org.netbeans.api.project.FileOwnerQuery;
99
import org.netbeans.api.project.ProjectManager;
95
import org.netbeans.api.project.ProjectManager;
100
import org.netbeans.api.queries.SharabilityQuery;
96
import org.netbeans.api.queries.SharabilityQuery;
101
import org.netbeans.modules.mercurial.HgProgressSupport;
102
import org.openide.awt.HtmlBrowser;
103
import org.openide.util.RequestProcessor;
104
import org.openide.util.Utilities;
97
import org.openide.util.Utilities;
105
import org.openide.windows.OutputListener;
98
import org.openide.windows.OutputListener;
106
99
Lines 124-133 public class HgUtils { Link Here
124
    private static final String HG_IGNORE_CONFLICT_ANY_FILES = "\\.conflict\\~$"; // NOI18N
117
    private static final String HG_IGNORE_CONFLICT_ANY_FILES = "\\.conflict\\~$"; // NOI18N
125
    
118
    
126
    private static final String FILENAME_HGIGNORE = ".hgignore"; // NOI18N
119
    private static final String FILENAME_HGIGNORE = ".hgignore"; // NOI18N
127
128
    public static final int MAX_LINES_TO_PRINT = 500;
129
130
    private static final String MSG_TOO_MANY_LINES = "The number of output lines is greater than 500; see message log for complete output";
131
120
132
    private static HashMap<String, Set<Pattern>> ignorePatterns;
121
    private static HashMap<String, Set<Pattern>> ignorePatterns;
133
122
Lines 1072-1198 itor tabs #66700). Link Here
1072
        }
1061
        }
1073
    }
1062
    }
1074
1063
1075
1076
    /**
1077
     * Print contents of list to Mercurial Output Tab
1078
     *
1079
     * @param list to print out
1080
     * 
1081
     */
1082
     public static void outputMercurialTab(List<String> list){
1083
        if( list.isEmpty()) return;
1084
1085
        InputOutput io = IOProvider.getDefault().getIO(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE, false);
1086
        io.select();
1087
        OutputWriter out = io.getOut();
1088
        
1089
        int lines = list.size();
1090
        if (lines > MAX_LINES_TO_PRINT) {
1091
            out.println(list.get(1));
1092
            out.println(list.get(2));
1093
            out.println(list.get(3));
1094
            out.println("...");
1095
            out.println(list.get(list.size() -1));
1096
            out.println(MSG_TOO_MANY_LINES);
1097
            for (String s : list){
1098
                Mercurial.LOG.log(Level.WARNING, s);
1099
            }
1100
        } else {
1101
            for (String s : list){
1102
                out.println(s);
1103
1104
            }
1105
        }
1106
        out.close();
1107
    }
1108
1109
     /**
1110
     * Print msg to Mercurial Output Tab
1111
     *
1112
     * @param String msg to print out
1113
     * 
1114
     */
1115
     public static void outputMercurialTab(String msg){
1116
        if( msg == null) return;
1117
1118
        InputOutput io = IOProvider.getDefault().getIO(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE, false);
1119
        io.select();
1120
        OutputWriter out = io.getOut();
1121
        
1122
        out.println(msg);
1123
        out.close();
1124
    }
1125
1126
    /**
1127
     * Print msg to Mercurial Output Tab in Red
1128
     *
1129
     * @param String msg to print out
1130
     * 
1131
     */
1132
     public static void outputMercurialTabInRed(String msg){
1133
        if( msg == null) return;
1134
1135
        InputOutput io = IOProvider.getDefault().getIO(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE, false);
1136
        io.select();
1137
        OutputWriter out = io.getErr();
1138
        
1139
        out.println(msg);
1140
        out.close();
1141
    }
1142
1143
    /**
1144
     * Print URL to Mercurial Output Tab as an active Hyperlink
1145
     *
1146
     * @param String sURL to print out
1147
     * 
1148
     */
1149
     public static void outputMercurialTabLink(final String sURL){
1150
         if (sURL == null) return;
1151
         
1152
         try {
1153
             InputOutput io = IOProvider.getDefault().getIO(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE, false);
1154
             io.select();
1155
             OutputWriter out = io.getOut();
1156
1157
             OutputListener listener = new OutputListener() {
1158
                         public void outputLineAction(OutputEvent ev) {
1159
                             try {
1160
                                 HtmlBrowser.URLDisplayer.getDefault().showURL(new URL(sURL));
1161
                             } catch (IOException ex) {
1162
                             // Ignore
1163
                             }
1164
                         }
1165
                         public void outputLineSelected(OutputEvent ev) {}
1166
                         public void outputLineCleared(OutputEvent ev) {}
1167
                     };
1168
             out.println(sURL, listener, true);
1169
             out.close();
1170
         } catch (IOException ex) {
1171
         // Ignore
1172
         }
1173
     }
1174
1175
    /**
1176
     * Select and Clear Mercurial Output Tab
1177
     *
1178
     * @param list to print out
1179
     * 
1180
     */
1181
     public static void clearOutputMercurialTab(){
1182
         InputOutput io = IOProvider.getDefault().getIO(
1183
                 Mercurial.MERCURIAL_OUTPUT_TAB_TITLE, false);
1184
         
1185
         io.select();
1186
         OutputWriter out = io.getOut();
1187
         
1188
         try {
1189
             out.reset();
1190
         } catch (IOException ex) {
1191
             // Ignore Exception
1192
         }
1193
         out.close();
1194
    }
1195
     
1196
    /**
1064
    /**
1197
     * This utility class should not be instantiated anywhere.
1065
     * This utility class should not be instantiated anywhere.
1198
     */
1066
     */

Return to bug 127182