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
        };
(-)17372bae056d (+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 431-437 final class AnnotationBar extends JCompo Link Here
431
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root);
431
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root);
432
        HgProgressSupport support = new HgProgressSupport() {
432
        HgProgressSupport support = new HgProgressSupport() {
433
            public void perform() {                 
433
            public void perform() {                 
434
                RevertModificationsAction.performRevert(root, revStr, file);
434
                RevertModificationsAction.performRevert(root, revStr, file, this.getLogger());
435
            }
435
            }
436
        };
436
        };
437
        support.start(rp, root.getAbsolutePath(), NbBundle.getMessage(AnnotationBar.class, "MSG_Revert_Progress")); // NOI18N
437
        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 (-16 / +20 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 313-319 public class CommitAction extends Contex Link Here
313
        commit.setEnabled(enabled && containsCommitable(table));
317
        commit.setEnabled(enabled && containsCommitable(table));
314
    }
318
    }
315
    
319
    
316
    private static void performCommit(String message, Map<HgFileNode, CommitOptions> commitFiles, VCSContext ctx, HgProgressSupport support, String prjName) {
320
    private static void performCommit(String message, Map<HgFileNode, CommitOptions> commitFiles, VCSContext ctx, HgProgressSupport support, String prjName, OutputLogger logger) {
317
        FileStatusCache cache = Mercurial.getInstance().getFileStatusCache();
321
        FileStatusCache cache = Mercurial.getInstance().getFileStatusCache();
318
        final File repository = HgUtils.getRootFile(ctx);
322
        final File repository = HgUtils.getRootFile(ctx);
319
        List<File> addCandidates = new ArrayList<File>();
323
        List<File> addCandidates = new ArrayList<File>();
Lines 350-389 public class CommitAction extends Contex Link Here
350
        }
354
        }
351
        
355
        
352
        try {
356
        try {
353
            HgUtils.outputMercurialTabInRed(
357
            logger.outputInRed(
354
                    NbBundle.getMessage(CommitAction.class,
358
                    NbBundle.getMessage(CommitAction.class,
355
                    "MSG_COMMIT_TITLE")); // NOI18N
359
                    "MSG_COMMIT_TITLE")); // NOI18N
356
            HgUtils.outputMercurialTabInRed(
360
            logger.outputInRed(
357
                    NbBundle.getMessage(CommitAction.class,
361
                    NbBundle.getMessage(CommitAction.class,
358
                    "MSG_COMMIT_TITLE_SEP")); // NOI18N
362
                    "MSG_COMMIT_TITLE_SEP")); // NOI18N
359
            if (addCandidates.size() > 0 ) {
363
            if (addCandidates.size() > 0 ) {
360
                HgCommand.doAdd(repository, addCandidates);
364
                HgCommand.doAdd(repository, addCandidates, logger);
361
                for (File f : addCandidates) {
365
                for (File f : addCandidates) {
362
                    HgUtils.outputMercurialTab("hg add " + f.getName()); //NOI18N
366
                    logger.output("hg add " + f.getName()); //NOI18N
363
                }
367
                }
364
            }
368
            }
365
            HgCommand.doCommit(repository, commitCandidates, message);
369
            HgCommand.doCommit(repository, commitCandidates, message, logger);
366
            HgRepositoryContextCache.setHasHistory(ctx);
370
            HgRepositoryContextCache.setHasHistory(ctx);
367
371
368
            if (commitCandidates.size() == 1) {
372
            if (commitCandidates.size() == 1) {
369
                HgUtils.outputMercurialTab(
373
                logger.output(
370
                        NbBundle.getMessage(CommitAction.class,
374
                        NbBundle.getMessage(CommitAction.class,
371
                        "MSG_COMMIT_INIT_SEP_ONE", commitCandidates.size(), prjName)); // NOI18N
375
                        "MSG_COMMIT_INIT_SEP_ONE", commitCandidates.size(), prjName)); // NOI18N
372
            } else {
376
            } else {
373
                HgUtils.outputMercurialTab(
377
                logger.output(
374
                        NbBundle.getMessage(CommitAction.class,
378
                        NbBundle.getMessage(CommitAction.class,
375
                        "MSG_COMMIT_INIT_SEP", commitCandidates.size(), prjName)); // NOI18N
379
                        "MSG_COMMIT_INIT_SEP", commitCandidates.size(), prjName)); // NOI18N
376
            }
380
            }
377
            for (File f : commitCandidates) {
381
            for (File f : commitCandidates) {
378
                HgUtils.outputMercurialTab("\t" + f.getAbsolutePath()); // NOI18N
382
                logger.output("\t" + f.getAbsolutePath()); // NOI18N
379
            }
383
            }
380
        } catch (HgException ex) {
384
        } catch (HgException ex) {
381
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
385
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
382
            DialogDisplayer.getDefault().notifyLater(e);
386
            DialogDisplayer.getDefault().notifyLater(e);
383
        } finally {
387
        } finally {
384
            cache.refreshCached(ctx);
388
            cache.refreshCached(ctx);
385
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_DONE")); // NOI18N
389
            logger.outputInRed(NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_DONE")); // NOI18N
386
            HgUtils.outputMercurialTab(""); // NOI18N
390
            logger.output(""); // NOI18N
387
        }
391
        }
388
    }
392
    }
389
}
393
}
(-)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/SummaryView.java (-2 / +2 lines)
Lines 435-441 class SummaryView implements MouseListen Link Here
435
                revertFiles.add(event.getFile());
435
                revertFiles.add(event.getFile());
436
            }
436
            }
437
            RevertModificationsAction.performRevert(
437
            RevertModificationsAction.performRevert(
438
                        root, revision.getLog().getRevision(), revertFiles);
438
                        root, revision.getLog().getRevision(), revertFiles, progress.getLogger());
439
            revertFiles.clear();
439
            revertFiles.clear();
440
        }
440
        }
441
        
441
        
Lines 465-471 class SummaryView implements MouseListen Link Here
465
                if(revEvents != null && !revEvents.isEmpty()){
465
                if(revEvents != null && !revEvents.isEmpty()){
466
                    // Assuming all files in a given repository reverting to same revision
466
                    // Assuming all files in a given repository reverting to same revision
467
                    RevertModificationsAction.performRevert(
467
                    RevertModificationsAction.performRevert(
468
                        root, revEvents.get(0).getLogInfoHeader().getLog().getRevision(), revertFiles);
468
                        root, revEvents.get(0).getLogInfoHeader().getLog().getRevision(), revertFiles, progress.getLogger());
469
                }
469
                }
470
            }                       
470
            }                       
471
        }
471
        }
(-)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/RollbackAction.java (-16 / +19 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.util.HgRepositoryContextCache;
56
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
Lines 79-93 public class RollbackAction extends Cont Link Here
79
    
80
    
80
    public void performAction(ActionEvent e) {
81
    public void performAction(ActionEvent e) {
81
        if(!HgRepositoryContextCache.hasHistory(context)){
82
        if(!HgRepositoryContextCache.hasHistory(context)){
82
            HgUtils.outputMercurialTabInRed(
83
           OutputLogger logger = OutputLogger.getLogger(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE);
84
            logger.outputInRed(
83
                    NbBundle.getMessage(RollbackAction.class,
85
                    NbBundle.getMessage(RollbackAction.class,
84
                    "MSG_ROLLBACK_TITLE")); // NOI18N
86
                    "MSG_ROLLBACK_TITLE")); // NOI18N
85
            HgUtils.outputMercurialTabInRed(
87
            logger.outputInRed(
86
                    NbBundle.getMessage(RollbackAction.class,
88
                    NbBundle.getMessage(RollbackAction.class,
87
                    "MSG_ROLLBACK_TITLE_SEP")); // NOI18N
89
                    "MSG_ROLLBACK_TITLE_SEP")); // NOI18N
88
            HgUtils.outputMercurialTab(NbBundle.getMessage(RollbackAction.class, "MSG_NO_ROLLBACK")); // NOI18N
90
            logger.output(NbBundle.getMessage(RollbackAction.class, "MSG_NO_ROLLBACK")); // NOI18N
89
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(RollbackAction.class, "MSG_ROLLBACK_DONE")); // NOI18N
91
            logger.outputInRed(NbBundle.getMessage(RollbackAction.class, "MSG_ROLLBACK_DONE")); // NOI18N
90
            HgUtils.outputMercurialTab(""); // NOI18N
92
            logger.output(""); // NOI18N
91
            return;
93
            return;
92
        }
94
        }
93
        rollback(context);
95
        rollback(context);
Lines 102-125 public class RollbackAction extends Cont Link Here
102
        HgProgressSupport support = new HgProgressSupport() {
104
        HgProgressSupport support = new HgProgressSupport() {
103
            public void perform() {
105
            public void perform() {
104
                
106
                
107
                OutputLogger logger = getLogger();
105
                try {
108
                try {
106
                    HgUtils.outputMercurialTabInRed(
109
                    logger.outputInRed(
107
                                NbBundle.getMessage(RollbackAction.class,
110
                                NbBundle.getMessage(RollbackAction.class,
108
                                "MSG_ROLLBACK_TITLE")); // NOI18N
111
                                "MSG_ROLLBACK_TITLE")); // NOI18N
109
                    HgUtils.outputMercurialTabInRed(
112
                    logger.outputInRed(
110
                                NbBundle.getMessage(RollbackAction.class,
113
                                NbBundle.getMessage(RollbackAction.class,
111
                                "MSG_ROLLBACK_TITLE_SEP")); // NOI18N
114
                                "MSG_ROLLBACK_TITLE_SEP")); // NOI18N
112
                    List<String> list = HgCommand.doRollback(root);
115
                    List<String> list = HgCommand.doRollback(root, logger);
113
                    
116
                    
114
                    if(list != null && !list.isEmpty()){                      
117
                    if(list != null && !list.isEmpty()){                      
115
                        //HgUtils.clearOutputMercurialTab();
118
                        //logger.clearOutput();
116
                        
119
                        
117
                        if(HgCommand.isNoRollbackPossible(list.get(0))){
120
                        if(HgCommand.isNoRollbackPossible(list.get(0))){
118
                            HgUtils.outputMercurialTab(
121
                            logger.output(
119
                                    NbBundle.getMessage(RollbackAction.class,
122
                                    NbBundle.getMessage(RollbackAction.class,
120
                                    "MSG_NO_ROLLBACK"));     // NOI18N                       
123
                                    "MSG_NO_ROLLBACK"));     // NOI18N                       
121
                        }else{
124
                        }else{
122
                            HgUtils.outputMercurialTab(list.get(0));
125
                            logger.output(list.get(0));
123
                            if (HgCommand.hasHistory(root)) {
126
                            if (HgCommand.hasHistory(root)) {
124
                                int response = JOptionPane.showOptionDialog(null,
127
                                int response = JOptionPane.showOptionDialog(null,
125
                                        NbBundle.getMessage(RollbackAction.class,"MSG_ROLLBACK_CONFIRM_QUERY") ,  // NOI18N
128
                                        NbBundle.getMessage(RollbackAction.class,"MSG_ROLLBACK_CONFIRM_QUERY") ,  // NOI18N
Lines 127-133 public class RollbackAction extends Cont Link Here
127
                                        JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,null, null, null);
130
                                        JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,null, null, null);
128
                            
131
                            
129
                                if( response == JOptionPane.YES_OPTION){
132
                                if( response == JOptionPane.YES_OPTION){
130
                                    HgUtils.outputMercurialTab(
133
                                    logger.output(
131
                                            NbBundle.getMessage(RollbackAction.class,
134
                                            NbBundle.getMessage(RollbackAction.class,
132
                                            "MSG_ROLLBACK_FORCE_UPDATE", root.getAbsolutePath())); // NOI18N
135
                                            "MSG_ROLLBACK_FORCE_UPDATE", root.getAbsolutePath())); // NOI18N
133
                                    list = HgCommand.doUpdateAll(root, true, null);
136
                                    list = HgCommand.doUpdateAll(root, true, null);
Lines 140-146 public class RollbackAction extends Cont Link Here
140
                                    Mercurial.getInstance().changesetChanged(root);
143
                                    Mercurial.getInstance().changesetChanged(root);
141
144
142
                                    if (list != null && !list.isEmpty()){
145
                                    if (list != null && !list.isEmpty()){
143
                                        HgUtils.outputMercurialTab(list);
146
                                        logger.output(list);
144
                                    }
147
                                    }
145
                                } else {
148
                                } else {
146
                                    HgUtils.forceStatusRefreshProject(ctx);
149
                                    HgUtils.forceStatusRefreshProject(ctx);
Lines 154-160 public class RollbackAction extends Cont Link Here
154
                            
157
                            
155
                            }
158
                            }
156
                        }
159
                        }
157
                        HgUtils.outputMercurialTabInRed(
160
                        logger.outputInRed(
158
                                    NbBundle.getMessage(RollbackAction.class,
161
                                    NbBundle.getMessage(RollbackAction.class,
159
                                    "MSG_ROLLBACK_INFO")); // NOI18N
162
                                    "MSG_ROLLBACK_INFO")); // NOI18N
160
                    }
163
                    }
Lines 162-171 public class RollbackAction extends Cont Link Here
162
                    NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
165
                    NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
163
                    DialogDisplayer.getDefault().notifyLater(e);
166
                    DialogDisplayer.getDefault().notifyLater(e);
164
                } finally {
167
                } finally {
165
                    HgUtils.outputMercurialTabInRed(
168
                    logger.outputInRed(
166
                                NbBundle.getMessage(RollbackAction.class,
169
                                NbBundle.getMessage(RollbackAction.class,
167
                                "MSG_ROLLBACK_DONE")); // NOI18N
170
                                "MSG_ROLLBACK_DONE")); // NOI18N
168
                    HgUtils.outputMercurialTab(""); // NOI18N
171
                    logger.output(""); // NOI18N
169
                }
172
                }
170
            }
173
            }
171
        };
174
        };
(-)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);
100
                performRevert(repository, revStr, files, 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) {
108
    public static void performRevert(File repository, String revStr, File file, 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);
112
        performRevert(repository, revStr, revertFiles, logger);
112
    }
113
    }
113
    
114
    
114
    public static void performRevert(File repository, String revStr, File[] files) {
115
    public static void performRevert(File repository, String revStr, File[] files, 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);
120
        performRevert(repository, revStr, revertFiles, logger);
120
    }
121
    }
121
    
122
    
122
    public static void performRevert(File repository, String revStr, List<File> revertFiles) {
123
    public static void performRevert(File repository, String revStr, List<File> revertFiles, 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);
153
            HgCommand.doRevert(repository, revertFiles, revStr, 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 (-6 / +8 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 86-105 public class UpdateAction extends Contex Link Here
86
        HgProgressSupport support = new HgProgressSupport() {
87
        HgProgressSupport support = new HgProgressSupport() {
87
            public void perform() {
88
            public void perform() {
88
                boolean bNoUpdates = true;
89
                boolean bNoUpdates = true;
90
                OutputLogger logger = getLogger();
89
                try {
91
                try {
90
                    HgUtils.outputMercurialTabInRed(
92
                    logger.outputInRed(
91
                            NbBundle.getMessage(UpdateAction.class,
93
                            NbBundle.getMessage(UpdateAction.class,
92
                            "MSG_UPDATE_TITLE")); // NOI18N
94
                            "MSG_UPDATE_TITLE")); // NOI18N
93
                    HgUtils.outputMercurialTabInRed(
95
                    logger.outputInRed(
94
                            NbBundle.getMessage(UpdateAction.class,
96
                            NbBundle.getMessage(UpdateAction.class,
95
                            "MSG_UPDATE_TITLE_SEP")); // NOI18N
97
                            "MSG_UPDATE_TITLE_SEP")); // NOI18N
96
                    List<String> list = HgCommand.doUpdateAll(root, false, revision);
98
                    List<String> list = HgCommand.doUpdateAll(root, false, revision);
97
                    
99
                    
98
                    if (list != null && !list.isEmpty()){
100
                    if (list != null && !list.isEmpty()){
99
                        bNoUpdates = HgCommand.isNoUpdates(list.get(0));
101
                        bNoUpdates = HgCommand.isNoUpdates(list.get(0));
100
                        //HgUtils.clearOutputMercurialTab();
102
                        //logger.clearOutput();
101
                        HgUtils.outputMercurialTab(list);
103
                        logger.output(list);
102
                        HgUtils.outputMercurialTab(""); // NOI18N
104
                        logger.output(""); // NOI18N
103
                    }  
105
                    }  
104
                    // refresh filesystem to take account of changes
106
                    // refresh filesystem to take account of changes
105
                    FileObject rootObj = FileUtil.toFileObject(root);
107
                    FileObject rootObj = FileUtil.toFileObject(root);
Lines 117-123 public class UpdateAction extends Contex Link Here
117
                if(!bNoUpdates)
119
                if(!bNoUpdates)
118
                    HgUtils.forceStatusRefreshProject(ctx);
120
                    HgUtils.forceStatusRefreshProject(ctx);
119
121
120
                HgUtils.outputMercurialTabInRed(
122
                logger.outputInRed(
121
                        NbBundle.getMessage(UpdateAction.class,
123
                        NbBundle.getMessage(UpdateAction.class,
122
                        "MSG_UPDATE_DONE")); // NOI18N
124
                        "MSG_UPDATE_DONE")); // NOI18N
123
            }
125
            }
(-)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 (-98 / +114 lines)
Lines 69-74 import org.netbeans.modules.mercurial.Fi Link Here
69
import org.netbeans.modules.mercurial.FileStatus;
69
import org.netbeans.modules.mercurial.FileStatus;
70
import org.netbeans.modules.mercurial.HgException;
70
import org.netbeans.modules.mercurial.HgException;
71
import org.netbeans.modules.mercurial.Mercurial;
71
import org.netbeans.modules.mercurial.Mercurial;
72
import org.netbeans.modules.mercurial.OutputLogger;
72
import org.netbeans.api.queries.SharabilityQuery;
73
import org.netbeans.api.queries.SharabilityQuery;
73
import org.netbeans.modules.mercurial.HgModuleConfig;
74
import org.netbeans.modules.mercurial.HgModuleConfig;
74
import org.netbeans.modules.mercurial.config.HgConfigFiles;
75
import org.netbeans.modules.mercurial.config.HgConfigFiles;
Lines 348-354 public class HgCommand { Link Here
348
     * @return hg update output
349
     * @return hg update output
349
     * @throws org.netbeans.modules.mercurial.HgException
350
     * @throws org.netbeans.modules.mercurial.HgException
350
     */
351
     */
351
    public static List<String> doRollback(File repository) throws HgException {
352
    public static List<String> doRollback(File repository, OutputLogger logger) throws HgException {
352
        if (repository == null ) return null;
353
        if (repository == null ) return null;
353
        List<String> command = new ArrayList<String>();
354
        List<String> command = new ArrayList<String>();
354
355
Lines 359-365 public class HgCommand { Link Here
359
360
360
        List<String> list = exec(command);
361
        List<String> list = exec(command);
361
        if (list.isEmpty())
362
        if (list.isEmpty())
362
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_ROLLBACK_FAILED"));
363
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_ROLLBACK_FAILED"), logger);
363
        
364
        
364
        return list;
365
        return list;
365
    }
366
    }
Lines 396-403 public class HgCommand { Link Here
396
     * @return hg pull output
397
     * @return hg pull output
397
     * @throws org.netbeans.modules.mercurial.HgException
398
     * @throws org.netbeans.modules.mercurial.HgException
398
     */
399
     */
399
    public static List<String> doPull(File repository) throws HgException {
400
    public static List<String> doPull(File repository, OutputLogger logger) throws HgException {
400
        return doPull(repository, null);
401
        return doPull(repository, null, logger);
401
    }
402
    }
402
403
403
    /**
404
    /**
Lines 411-417 public class HgCommand { Link Here
411
     * @return hg pull output
412
     * @return hg pull output
412
     * @throws org.netbeans.modules.mercurial.HgException
413
     * @throws org.netbeans.modules.mercurial.HgException
413
     */
414
     */
414
    public static List<String> doPull(File repository, String from) throws HgException {
415
    public static List<String> doPull(File repository, String from, OutputLogger logger) throws HgException {
415
        if (repository == null ) return null;
416
        if (repository == null ) return null;
416
        List<String> command = new ArrayList<String>();
417
        List<String> command = new ArrayList<String>();
417
418
Lines 426-432 public class HgCommand { Link Here
426
427
427
        List<String> list;
428
        List<String> list;
428
        String defaultPull = new HgConfigFiles(repository).getDefaultPull(false);
429
        String defaultPull = new HgConfigFiles(repository).getDefaultPull(false);
429
        String proxy = getGlobalProxyIfNeeded(defaultPull, true);
430
        String proxy = getGlobalProxyIfNeeded(defaultPull, true, logger);
430
        if(proxy != null){
431
        if(proxy != null){
431
            List<String> env = new ArrayList<String>(); 
432
            List<String> env = new ArrayList<String>(); 
432
            env.add(HG_PROXY_ENV + proxy);
433
            env.add(HG_PROXY_ENV + proxy);
Lines 437-443 public class HgCommand { Link Here
437
438
438
        if (!list.isEmpty() && 
439
        if (!list.isEmpty() && 
439
             isErrorAbort(list.get(list.size() -1))) {
440
             isErrorAbort(list.get(list.size() -1))) {
440
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
441
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
441
        }
442
        }
442
        return list;
443
        return list;
443
    }
444
    }
Lines 453-459 public class HgCommand { Link Here
453
     * @return hg unbundle output
454
     * @return hg unbundle output
454
     * @throws org.netbeans.modules.mercurial.HgException
455
     * @throws org.netbeans.modules.mercurial.HgException
455
     */
456
     */
456
    public static List<String> doUnbundle(File repository, File bundle) throws HgException {
457
    public static List<String> doUnbundle(File repository, File bundle, OutputLogger logger) throws HgException {
457
        if (repository == null ) return null;
458
        if (repository == null ) return null;
458
        List<String> command = new ArrayList<String>();
459
        List<String> command = new ArrayList<String>();
459
460
Lines 469-475 public class HgCommand { Link Here
469
        List<String> list = exec(command);
470
        List<String> list = exec(command);
470
        if (!list.isEmpty() && 
471
        if (!list.isEmpty() && 
471
             isErrorAbort(list.get(list.size() -1))) {
472
             isErrorAbort(list.get(list.size() -1))) {
472
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
473
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
473
        }
474
        }
474
        return list;
475
        return list;
475
    }
476
    }
Lines 482-489 public class HgCommand { Link Here
482
     * @return hg incoming output
483
     * @return hg incoming output
483
     * @throws org.netbeans.modules.mercurial.HgException
484
     * @throws org.netbeans.modules.mercurial.HgException
484
     */
485
     */
485
    public static List<String> doIncoming(File repository) throws HgException {
486
    public static List<String> doIncoming(File repository, OutputLogger logger) throws HgException {
486
        return doIncoming(repository, null, null);
487
        return doIncoming(repository, null, null, logger);
487
    }
488
    }
488
489
489
    /**
490
    /**
Lines 496-502 public class HgCommand { Link Here
496
     * @return hg incoming output
497
     * @return hg incoming output
497
     * @throws org.netbeans.modules.mercurial.HgException
498
     * @throws org.netbeans.modules.mercurial.HgException
498
     */
499
     */
499
    public static List<String> doIncoming(File repository, String from, File bundle) throws HgException {
500
    public static List<String> doIncoming(File repository, String from, File bundle, OutputLogger logger) throws HgException {
500
        if (repository == null ) return null;
501
        if (repository == null ) return null;
501
        List<String> command = new ArrayList<String>();
502
        List<String> command = new ArrayList<String>();
502
503
Lines 515-521 public class HgCommand { Link Here
515
516
516
        List<String> list;
517
        List<String> list;
517
        String defaultPull = new HgConfigFiles(repository).getDefaultPull(false);
518
        String defaultPull = new HgConfigFiles(repository).getDefaultPull(false);
518
        String proxy = getGlobalProxyIfNeeded(defaultPull, false);
519
        String proxy = getGlobalProxyIfNeeded(defaultPull, false, null);
519
        if(proxy != null){
520
        if(proxy != null){
520
            List<String> env = new ArrayList<String>(); 
521
            List<String> env = new ArrayList<String>(); 
521
            env.add(HG_PROXY_ENV + proxy);
522
            env.add(HG_PROXY_ENV + proxy);
Lines 526-532 public class HgCommand { Link Here
526
527
527
        if (!list.isEmpty() && 
528
        if (!list.isEmpty() && 
528
             isErrorAbort(list.get(list.size() -1))) {
529
             isErrorAbort(list.get(list.size() -1))) {
529
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
530
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
530
        }
531
        }
531
        return list;
532
        return list;
532
    }
533
    }
Lines 540-546 public class HgCommand { Link Here
540
     * @return hg outgoing output
541
     * @return hg outgoing output
541
     * @throws org.netbeans.modules.mercurial.HgException
542
     * @throws org.netbeans.modules.mercurial.HgException
542
     */
543
     */
543
    public static List<String> doOutgoing(File repository, String to) throws HgException {
544
    public static List<String> doOutgoing(File repository, String to, OutputLogger logger) throws HgException {
544
        if (repository == null ) return null;
545
        if (repository == null ) return null;
545
        List<String> command = new ArrayList<String>();
546
        List<String> command = new ArrayList<String>();
546
547
Lines 553-559 public class HgCommand { Link Here
553
554
554
        List<String> list;
555
        List<String> list;
555
        String defaultPush = new HgConfigFiles(repository).getDefaultPush(false);
556
        String defaultPush = new HgConfigFiles(repository).getDefaultPush(false);
556
        String proxy = getGlobalProxyIfNeeded(defaultPush, false);
557
        String proxy = getGlobalProxyIfNeeded(defaultPush, false, null);
557
        if(proxy != null){
558
        if(proxy != null){
558
            List<String> env = new ArrayList<String>(); 
559
            List<String> env = new ArrayList<String>(); 
559
            env.add(HG_PROXY_ENV + proxy);
560
            env.add(HG_PROXY_ENV + proxy);
Lines 563-569 public class HgCommand { Link Here
563
        }
564
        }
564
        if (!list.isEmpty() && 
565
        if (!list.isEmpty() && 
565
             isErrorAbort(list.get(list.size() -1))) {
566
             isErrorAbort(list.get(list.size() -1))) {
566
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
567
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
567
        }
568
        }
568
        return list;
569
        return list;
569
    }
570
    }
Lines 577-583 public class HgCommand { Link Here
577
     * @return hg push output
578
     * @return hg push output
578
     * @throws org.netbeans.modules.mercurial.HgException
579
     * @throws org.netbeans.modules.mercurial.HgException
579
     */
580
     */
580
    public static List<String> doPush(File repository, String to) throws HgException {
581
    public static List<String> doPush(File repository, String to, OutputLogger logger) throws HgException {
581
        if (repository == null || to == null ) return null;
582
        if (repository == null || to == null ) return null;
582
        List<String> command = new ArrayList<String>();
583
        List<String> command = new ArrayList<String>();
583
584
Lines 589-595 public class HgCommand { Link Here
589
590
590
        List<String> list;
591
        List<String> list;
591
        String defaultPush = new HgConfigFiles(repository).getDefaultPush(false);
592
        String defaultPush = new HgConfigFiles(repository).getDefaultPush(false);
592
        String proxy = getGlobalProxyIfNeeded(defaultPush, true);
593
        String proxy = getGlobalProxyIfNeeded(defaultPush, true, logger);
593
        if(proxy != null){
594
        if(proxy != null){
594
            List<String> env = new ArrayList<String>(); 
595
            List<String> env = new ArrayList<String>(); 
595
            env.add(HG_PROXY_ENV + proxy);
596
            env.add(HG_PROXY_ENV + proxy);
Lines 602-608 public class HgCommand { Link Here
602
        if (!list.isEmpty() && 
603
        if (!list.isEmpty() && 
603
            !isErrorAbortPush(list.get(list.size() -1)) &&
604
            !isErrorAbortPush(list.get(list.size() -1)) &&
604
            isErrorAbort(list.get(list.size() -1))) {
605
            isErrorAbort(list.get(list.size() -1))) {
605
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
606
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
606
        }
607
        }
607
        return list;
608
        return list;
608
    }
609
    }
Lines 613-619 public class HgCommand { Link Here
613
     * @param File repository of the mercurial repository's root directory
614
     * @param File repository of the mercurial repository's root directory
614
     * @throws org.netbeans.modules.mercurial.HgException
615
     * @throws org.netbeans.modules.mercurial.HgException
615
     */
616
     */
616
    public static List<String> doView(File repository) throws HgException {
617
    public static List<String> doView(File repository, OutputLogger logger) throws HgException {
617
        if (repository == null) return null;
618
        if (repository == null) return null;
618
        List<String> command = new ArrayList<String>();
619
        List<String> command = new ArrayList<String>();
619
        List<String> env = new ArrayList<String>();
620
        List<String> env = new ArrayList<String>();
Lines 639-651 public class HgCommand { Link Here
639
            else if (isErrorHgkNotFound(list.get(0))) {
640
            else if (isErrorHgkNotFound(list.get(0))) {
640
                throw new HgException(NbBundle.getMessage(HgCommand.class, "MSG_WARN_HGK_NOT_FOUND_TEXT"));
641
                throw new HgException(NbBundle.getMessage(HgCommand.class, "MSG_WARN_HGK_NOT_FOUND_TEXT"));
641
            } else if (isErrorAbort(list.get(list.size() -1))) {
642
            } else if (isErrorAbort(list.get(list.size() -1))) {
642
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
643
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
643
            }
644
            }
644
        } 
645
        } 
645
        return list;
646
        return list;
646
    }
647
    }
647
    
648
    
648
    private static String getGlobalProxyIfNeeded(String defaultPath, boolean bOutputDetails){
649
    private static String getGlobalProxyIfNeeded(String defaultPath, boolean bOutputDetails, OutputLogger logger){
649
        String proxy = null;
650
        String proxy = null;
650
        if(defaultPath != null && 
651
        if(defaultPath != null && 
651
                (defaultPath.startsWith("http:") || defaultPath.startsWith("https:"))){ // NOI18N
652
                (defaultPath.startsWith("http:") || defaultPath.startsWith("https:"))){ // NOI18N
Lines 670-676 public class HgCommand { Link Here
670
            }
671
            }
671
        }
672
        }
672
        if(proxy != null && bOutputDetails){
673
        if(proxy != null && bOutputDetails){
673
            HgUtils.outputMercurialTab(NbBundle.getMessage(HgCommand.class, "MSG_USING_PROXY_INFO", proxy)); // NOI18N
674
            logger.output(NbBundle.getMessage(HgCommand.class, "MSG_USING_PROXY_INFO", proxy)); // NOI18N
674
        }
675
        }
675
        return proxy;
676
        return proxy;
676
    }
677
    }
Lines 680-686 public class HgCommand { Link Here
680
     * @param File repository of the mercurial repository's root directory
681
     * @param File repository of the mercurial repository's root directory
681
     * @throws org.netbeans.modules.mercurial.HgException
682
     * @throws org.netbeans.modules.mercurial.HgException
682
     */
683
     */
683
    public static List<String> doFetch(File repository) throws HgException {
684
    public static List<String> doFetch(File repository, OutputLogger logger) throws HgException {
684
        if (repository == null) return null;
685
        if (repository == null) return null;
685
        List<String> command = new ArrayList<String>();
686
        List<String> command = new ArrayList<String>();
686
        
687
        
Lines 693-699 public class HgCommand { Link Here
693
        
694
        
694
        List<String> list;
695
        List<String> list;
695
        String defaultPull = new HgConfigFiles(repository).getDefaultPull(false);
696
        String defaultPull = new HgConfigFiles(repository).getDefaultPull(false);
696
        String proxy = getGlobalProxyIfNeeded(defaultPull, true);
697
        String proxy = getGlobalProxyIfNeeded(defaultPull, true, logger);
697
        if(proxy != null){
698
        if(proxy != null){
698
            List<String> env = new ArrayList<String>(); 
699
            List<String> env = new ArrayList<String>(); 
699
            env.add(HG_PROXY_ENV + proxy);
700
            env.add(HG_PROXY_ENV + proxy);
Lines 704-710 public class HgCommand { Link Here
704
705
705
        if (!list.isEmpty()) {
706
        if (!list.isEmpty()) {
706
            if (isErrorAbort(list.get(list.size() -1))) {
707
            if (isErrorAbort(list.get(list.size() -1))) {
707
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
708
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
708
            }
709
            }
709
        } 
710
        } 
710
        return list;
711
        return list;
Lines 754-768 public class HgCommand { Link Here
754
        final List<HgLogMessage> messages = new ArrayList<HgLogMessage>(0);  
755
        final List<HgLogMessage> messages = new ArrayList<HgLogMessage>(0);  
755
        final File root = new File(rootUrl);
756
        final File root = new File(rootUrl);
756
        
757
        
758
        OutputLogger logger = OutputLogger.getLogger(rootUrl);
757
        try {
759
        try {
758
760
759
            List<String> list = new LinkedList<String>();
761
            List<String> list = new LinkedList<String>();
760
            list = HgCommand.doIncomingForSearch(root);
762
            list = HgCommand.doIncomingForSearch(root, logger);
761
            processLogMessages(list, messages);
763
            processLogMessages(list, messages);
762
764
763
        } catch (HgException ex) {
765
        } catch (HgException ex) {
764
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
766
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
765
            DialogDisplayer.getDefault().notifyLater(e);
767
            DialogDisplayer.getDefault().notifyLater(e);
768
        } finally {
769
            logger.closeLog();
766
        }
770
        }
767
        
771
        
768
        return messages.toArray(new HgLogMessage[0]);
772
        return messages.toArray(new HgLogMessage[0]);
Lines 772-786 public class HgCommand { Link Here
772
        final List<HgLogMessage> messages = new ArrayList<HgLogMessage>(0);  
776
        final List<HgLogMessage> messages = new ArrayList<HgLogMessage>(0);  
773
        final File root = new File(rootUrl);
777
        final File root = new File(rootUrl);
774
        
778
        
779
        OutputLogger logger = OutputLogger.getLogger(rootUrl);
775
        try {
780
        try {
776
781
777
            List<String> list = new LinkedList<String>();
782
            List<String> list = new LinkedList<String>();
778
            list = HgCommand.doOut(root);
783
            list = HgCommand.doOut(root, logger);
779
            processLogMessages(list, messages);
784
            processLogMessages(list, messages);
780
785
781
        } catch (HgException ex) {
786
        } catch (HgException ex) {
782
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
787
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
783
            DialogDisplayer.getDefault().notifyLater(e);
788
            DialogDisplayer.getDefault().notifyLater(e);
789
        } finally {
790
            logger.closeLog();
784
        }
791
        }
785
        
792
        
786
        return messages.toArray(new HgLogMessage[0]);
793
        return messages.toArray(new HgLogMessage[0]);
Lines 790-795 public class HgCommand { Link Here
790
        final List<HgLogMessage> messages = new ArrayList<HgLogMessage>(0);  
797
        final List<HgLogMessage> messages = new ArrayList<HgLogMessage>(0);  
791
        final File root = new File(rootUrl);
798
        final File root = new File(rootUrl);
792
        
799
        
800
        OutputLogger logger = OutputLogger.getLogger(rootUrl);
793
        try {
801
        try {
794
            String headRev = HgCommand.getLastRevision(root, null);
802
            String headRev = HgCommand.getLastRevision(root, null);
795
            if (headRev == null) {
803
            if (headRev == null) {
Lines 799-810 public class HgCommand { Link Here
799
            List<String> list = new LinkedList<String>();
807
            List<String> list = new LinkedList<String>();
800
            list = HgCommand.doLogForHistory(root, 
808
            list = HgCommand.doLogForHistory(root, 
801
                    files != null ? new ArrayList<File>(files) : null,
809
                    files != null ? new ArrayList<File>(files) : null,
802
                    fromRevision, toRevision, headRev);
810
                    fromRevision, toRevision, headRev, logger);
803
            processLogMessages(list, messages);
811
            processLogMessages(list, messages);
804
            
812
            
805
        } catch (HgException ex) {
813
        } catch (HgException ex) {
806
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
814
            NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
807
            DialogDisplayer.getDefault().notifyLater(e);
815
            DialogDisplayer.getDefault().notifyLater(e);
816
        } finally {
817
            logger.closeLog();
808
        }
818
        }
809
        
819
        
810
        return messages.toArray(new HgLogMessage[0]);
820
        return messages.toArray(new HgLogMessage[0]);
Lines 916-923 public class HgCommand { Link Here
916
     * @return List<String> list of the log entries for the specified file.
926
     * @return List<String> list of the log entries for the specified file.
917
     * @throws org.netbeans.modules.mercurial.HgException
927
     * @throws org.netbeans.modules.mercurial.HgException
918
     */
928
     */
919
     public static List<String> doLogShort(File repository, File file) throws HgException {
929
     public static List<String> doLogShort(File repository, File file, OutputLogger logger) throws HgException {
920
        return doLog(repository, file, HG_LOG_TEMPLATE_SHORT_CMD, false);
930
        return doLog(repository, file, HG_LOG_TEMPLATE_SHORT_CMD, false, logger);
921
     }
931
     }
922
     
932
     
923
     /**
933
     /**
Lines 928-935 public class HgCommand { Link Here
928
     * @return List<String> list of the log entries for the specified file.
938
     * @return List<String> list of the log entries for the specified file.
929
     * @throws org.netbeans.modules.mercurial.HgException
939
     * @throws org.netbeans.modules.mercurial.HgException
930
     */
940
     */
931
     public static List<String> doLogLong(File repository, File file) throws HgException {
941
     public static List<String> doLogLong(File repository, File file, OutputLogger logger) throws HgException {
932
        return doLog(repository, file, HG_LOG_TEMPLATE_LONG_CMD, false);
942
        return doLog(repository, file, HG_LOG_TEMPLATE_LONG_CMD, false, logger);
933
     }
943
     }
934
944
935
     /**
945
     /**
Lines 942-948 public class HgCommand { Link Here
942
     * @return List<String> list of the log entries for the specified file.
952
     * @return List<String> list of the log entries for the specified file.
943
     * @throws org.netbeans.modules.mercurial.HgException
953
     * @throws org.netbeans.modules.mercurial.HgException
944
     */
954
     */
945
    public static List<String> doLog(File repository, File file, String LOG_TEMPLATE, boolean bDebug) throws HgException {
955
    public static List<String> doLog(File repository, File file, String LOG_TEMPLATE, boolean bDebug, OutputLogger logger) throws HgException {
946
        if (repository == null ) return null;
956
        if (repository == null ) return null;
947
        
957
        
948
        List<String> command = new ArrayList<String>();
958
        List<String> command = new ArrayList<String>();
Lines 963-971 public class HgCommand { Link Here
963
        List<String> list = exec(command);
973
        List<String> list = exec(command);
964
        if (!list.isEmpty()) {
974
        if (!list.isEmpty()) {
965
            if (isErrorNoRepository(list.get(0))) {
975
            if (isErrorNoRepository(list.get(0))) {
966
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"));
976
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"), logger);
967
             } else if (isErrorAbort(list.get(0))) {
977
             } else if (isErrorAbort(list.get(0))) {
968
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
978
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
969
             }
979
             }
970
        }
980
        }
971
        return list;
981
        return list;
Lines 981-987 public class HgCommand { Link Here
981
     * @return List<String> list of the log entries for the specified file.
991
     * @return List<String> list of the log entries for the specified file.
982
     * @throws org.netbeans.modules.mercurial.HgException
992
     * @throws org.netbeans.modules.mercurial.HgException
983
     */
993
     */
984
    public static List<String> doLog(File repository, List<File> files, String LOG_TEMPLATE, boolean bDebug) throws HgException {
994
    public static List<String> doLog(File repository, List<File> files, String LOG_TEMPLATE, boolean bDebug, OutputLogger logger) throws HgException {
985
        if (repository == null ) return null;
995
        if (repository == null ) return null;
986
        if (files != null && files.isEmpty()) return null;
996
        if (files != null && files.isEmpty()) return null;
987
        
997
        
Lines 1019-1027 public class HgCommand { Link Here
1019
        List<String> list = exec(command);
1029
        List<String> list = exec(command);
1020
        if (!list.isEmpty()) {
1030
        if (!list.isEmpty()) {
1021
            if (isErrorNoRepository(list.get(0))) {
1031
            if (isErrorNoRepository(list.get(0))) {
1022
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"));
1032
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"), logger);
1023
             } else if (isErrorAbort(list.get(0))) {
1033
             } else if (isErrorAbort(list.get(0))) {
1024
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
1034
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
1025
             }
1035
             }
1026
        }
1036
        }
1027
        return list;
1037
        return list;
Lines 1038-1044 public class HgCommand { Link Here
1038
     * @throws org.netbeans.modules.mercurial.HgException
1048
     * @throws org.netbeans.modules.mercurial.HgException
1039
     */
1049
     */
1040
    public static List<String> doLogForHistory(File repository, List<File> files, 
1050
    public static List<String> doLogForHistory(File repository, List<File> files, 
1041
            String from, String to, String headRev) throws HgException {
1051
            String from, String to, String headRev, OutputLogger logger) throws HgException {
1042
        if (repository == null ) return null;
1052
        if (repository == null ) return null;
1043
        if (files != null && files.isEmpty()) return null;
1053
        if (files != null && files.isEmpty()) return null;
1044
        
1054
        
Lines 1083-1091 public class HgCommand { Link Here
1083
        List<String> list = exec(command);
1093
        List<String> list = exec(command);
1084
        if (!list.isEmpty()) {
1094
        if (!list.isEmpty()) {
1085
            if (isErrorNoRepository(list.get(0))) {
1095
            if (isErrorNoRepository(list.get(0))) {
1086
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"));
1096
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"), logger);
1087
             } else if (isErrorAbort(list.get(0))) {
1097
             } else if (isErrorAbort(list.get(0))) {
1088
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
1098
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
1089
             }
1099
             }
1090
        }
1100
        }
1091
        return list;
1101
        return list;
Lines 1098-1104 public class HgCommand { Link Here
1098
     * @return List<String> list of the out entries for the specified repo.
1108
     * @return List<String> list of the out entries for the specified repo.
1099
     * @throws org.netbeans.modules.mercurial.HgException
1109
     * @throws org.netbeans.modules.mercurial.HgException
1100
     */
1110
     */
1101
    public static List<String> doOut(File repository) throws HgException {
1111
    public static List<String> doOut(File repository, OutputLogger logger) throws HgException {
1102
        if (repository == null ) return null;
1112
        if (repository == null ) return null;
1103
        
1113
        
1104
        List<String> command = new ArrayList<String>();
1114
        List<String> command = new ArrayList<String>();
Lines 1113-1119 public class HgCommand { Link Here
1113
1123
1114
        List<String> list;
1124
        List<String> list;
1115
        String defaultPush = new HgConfigFiles(repository).getDefaultPush(false);
1125
        String defaultPush = new HgConfigFiles(repository).getDefaultPush(false);
1116
        String proxy = getGlobalProxyIfNeeded(defaultPush, false);
1126
        String proxy = getGlobalProxyIfNeeded(defaultPush, false, null);
1117
        if(proxy != null){
1127
        if(proxy != null){
1118
            List<String> env = new ArrayList<String>(); 
1128
            List<String> env = new ArrayList<String>(); 
1119
            env.add(HG_PROXY_ENV + proxy);
1129
            env.add(HG_PROXY_ENV + proxy);
Lines 1125-1133 public class HgCommand { Link Here
1125
            if(isErrorNoDefaultPush(list.get(0))){
1135
            if(isErrorNoDefaultPush(list.get(0))){
1126
                // Ignore
1136
                // Ignore
1127
            }else if (isErrorNoRepository(list.get(0))) {
1137
            }else if (isErrorNoRepository(list.get(0))) {
1128
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"));
1138
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"), logger);
1129
             } else if (isErrorAbort(list.get(0))) {
1139
             } else if (isErrorAbort(list.get(0))) {
1130
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
1140
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
1131
             }
1141
             }
1132
        }
1142
        }
1133
        return list;
1143
        return list;
Lines 1140-1146 public class HgCommand { Link Here
1140
     * @return List<String> list of the out entries for the specified repo.
1150
     * @return List<String> list of the out entries for the specified repo.
1141
     * @throws org.netbeans.modules.mercurial.HgException
1151
     * @throws org.netbeans.modules.mercurial.HgException
1142
     */
1152
     */
1143
    public static List<String> doIncomingForSearch(File repository) throws HgException {
1153
    public static List<String> doIncomingForSearch(File repository, OutputLogger logger) throws HgException {
1144
        if (repository == null ) return null;
1154
        if (repository == null ) return null;
1145
        
1155
        
1146
        List<String> command = new ArrayList<String>();
1156
        List<String> command = new ArrayList<String>();
Lines 1154-1160 public class HgCommand { Link Here
1154
1164
1155
        List<String> list = exec(command);
1165
        List<String> list = exec(command);
1156
        String defaultPull = new HgConfigFiles(repository).getDefaultPull(false);
1166
        String defaultPull = new HgConfigFiles(repository).getDefaultPull(false);
1157
        String proxy = getGlobalProxyIfNeeded(defaultPull, false);
1167
        String proxy = getGlobalProxyIfNeeded(defaultPull, false, null);
1158
        if(proxy != null){
1168
        if(proxy != null){
1159
            List<String> env = new ArrayList<String>(); 
1169
            List<String> env = new ArrayList<String>(); 
1160
            env.add(HG_PROXY_ENV + proxy);
1170
            env.add(HG_PROXY_ENV + proxy);
Lines 1167-1175 public class HgCommand { Link Here
1167
            if (isErrorNoDefaultPath(list.get(0))) {
1177
            if (isErrorNoDefaultPath(list.get(0))) {
1168
            // Ignore
1178
            // Ignore
1169
            } else if (isErrorNoRepository(list.get(0))) {
1179
            } else if (isErrorNoRepository(list.get(0))) {
1170
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"));
1180
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"), logger);
1171
            } else if (isErrorAbort(list.get(0)) || isErrorAbort(list.get(list.size() - 1))) {
1181
            } else if (isErrorAbort(list.get(0)) || isErrorAbort(list.get(list.size() - 1))) {
1172
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
1182
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
1173
            }
1183
            }
1174
        }
1184
        }
1175
        return list;
1185
        return list;
Lines 1303-1310 public class HgCommand { Link Here
1303
     * @param File outFile to contain the contents of the file
1313
     * @param File outFile to contain the contents of the file
1304
     * @throws org.netbeans.modules.mercurial.HgException
1314
     * @throws org.netbeans.modules.mercurial.HgException
1305
     */
1315
     */
1306
    public static void doCat(File repository, File file, File outFile) throws HgException {
1316
    public static void doCat(File repository, File file, File outFile, OutputLogger logger) throws HgException {
1307
        doCat(repository, file, outFile, "tip", false); //NOI18N
1317
        doCat(repository, file, outFile, "tip", false, logger); //NOI18N
1308
    }
1318
    }
1309
    
1319
    
1310
    /**
1320
    /**
Lines 1319-1329 public class HgCommand { Link Here
1319
     * @return List<String> list of all the log entries
1329
     * @return List<String> list of all the log entries
1320
     * @throws org.netbeans.modules.mercurial.HgException
1330
     * @throws org.netbeans.modules.mercurial.HgException
1321
     */
1331
     */
1322
    public static void doCat(File repository, File file, File outFile, String revision) throws HgException {
1332
    public static void doCat(File repository, File file, File outFile, String revision, OutputLogger logger) throws HgException {
1323
        doCat(repository, file, outFile, revision, true); //NOI18N
1333
        doCat(repository, file, outFile, revision, true, logger); //NOI18N
1324
    }
1334
    }
1325
1335
1326
    public static void doCat(File repository, File file, File outFile, String revision, boolean retry) throws HgException {
1336
    public static void doCat(File repository, File file, File outFile, String revision, boolean retry, OutputLogger logger) throws HgException {
1327
        if (repository == null) return;
1337
        if (repository == null) return;
1328
        if (file == null) return;
1338
        if (file == null) return;
1329
        
1339
        
Lines 1345-1353 public class HgCommand { Link Here
1345
        
1355
        
1346
        if (!list.isEmpty()) {
1356
        if (!list.isEmpty()) {
1347
            if (isErrorNoRepository(list.get(0))) {
1357
            if (isErrorNoRepository(list.get(0))) {
1348
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"));
1358
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"), logger);
1349
             } else if (isErrorAbort(list.get(0))) {
1359
             } else if (isErrorAbort(list.get(0))) {
1350
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
1360
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
1351
             }
1361
             }
1352
        }
1362
        }
1353
        if (outFile.length() == 0 && retry) {
1363
        if (outFile.length() == 0 && retry) {
Lines 1355-1361 public class HgCommand { Link Here
1355
            String newRevision = Integer.toString(Integer.parseInt(revision)+1);
1365
            String newRevision = Integer.toString(Integer.parseInt(revision)+1);
1356
            File prevFile = getPreviousName(repository, file, newRevision); 
1366
            File prevFile = getPreviousName(repository, file, newRevision); 
1357
            if (prevFile != null) {
1367
            if (prevFile != null) {
1358
                doCat(repository, prevFile, outFile, revision, false); //NOI18N
1368
                doCat(repository, prevFile, outFile, revision, false, logger); //NOI18N
1359
            }
1369
            }
1360
        }
1370
        }
1361
    }
1371
    }
Lines 1369-1375 public class HgCommand { Link Here
1369
     * @return void
1379
     * @return void
1370
     * @throws org.netbeans.modules.mercurial.HgException
1380
     * @throws org.netbeans.modules.mercurial.HgException
1371
     */
1381
     */
1372
    public static void doCreate(File root) throws HgException {
1382
    public static void doCreate(File root, OutputLogger logger) throws HgException {
1373
        if (root == null ) return;
1383
        if (root == null ) return;
1374
        List<String> command = new ArrayList<String>();
1384
        List<String> command = new ArrayList<String>();
1375
        
1385
        
Lines 1379-1385 public class HgCommand { Link Here
1379
1389
1380
        List<String> list = exec(command);
1390
        List<String> list = exec(command);
1381
        if (!list.isEmpty())
1391
        if (!list.isEmpty())
1382
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_CREATE_FAILED"));
1392
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_CREATE_FAILED"), logger);
1383
    }
1393
    }
1384
    
1394
    
1385
    /**
1395
    /**
Lines 1390-1398 public class HgCommand { Link Here
1390
     * @return clone output
1400
     * @return clone output
1391
     * @throws org.netbeans.modules.mercurial.HgException
1401
     * @throws org.netbeans.modules.mercurial.HgException
1392
     */
1402
     */
1393
    public static List<String> doClone(File repository, String target) throws HgException {
1403
    public static List<String> doClone(File repository, String target, OutputLogger logger) throws HgException {
1394
        if (repository == null) return null;
1404
        if (repository == null) return null;
1395
        return doClone(repository.getAbsolutePath(), target);
1405
        return doClone(repository.getAbsolutePath(), target, logger);
1396
    }
1406
    }
1397
    
1407
    
1398
    /**
1408
    /**
Lines 1403-1409 public class HgCommand { Link Here
1403
     * @return clone output
1413
     * @return clone output
1404
     * @throws org.netbeans.modules.mercurial.HgException
1414
     * @throws org.netbeans.modules.mercurial.HgException
1405
     */
1415
     */
1406
    public static List<String> doClone(String repository, String target) throws HgException {
1416
    public static List<String> doClone(String repository, String target, OutputLogger logger) throws HgException {
1407
        if (repository == null || target == null) return null;
1417
        if (repository == null || target == null) return null;
1408
        
1418
        
1409
        // Ensure that parent directory of target exists, creating if necessary
1419
        // Ensure that parent directory of target exists, creating if necessary
Lines 1437-1447 public class HgCommand { Link Here
1437
        List<String> list = exec(command);
1447
        List<String> list = exec(command);
1438
        if (!list.isEmpty()) {
1448
        if (!list.isEmpty()) {
1439
            if (isErrorNoRepository(list.get(0))){
1449
            if (isErrorNoRepository(list.get(0))){
1440
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"));
1450
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"), logger);
1441
            }else if (isErrorNoResponse(list.get(list.size() -1))){
1451
            }else if (isErrorNoResponse(list.get(list.size() -1))){
1442
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_RESPONSE_ERR"));
1452
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_RESPONSE_ERR"), logger);
1443
            }else if (isErrorAbort(list.get(list.size() -1))){
1453
            }else if (isErrorAbort(list.get(list.size() -1))){
1444
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"));
1454
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ABORTED"), logger);
1445
            }
1455
            }
1446
        }
1456
        }
1447
        return list;
1457
        return list;
Lines 1456-1462 public class HgCommand { Link Here
1456
     * @return void
1466
     * @return void
1457
     * @throws org.netbeans.modules.mercurial.HgException
1467
     * @throws org.netbeans.modules.mercurial.HgException
1458
     */
1468
     */
1459
    public static void doCommit(File repository, List<File> commitFiles, String commitMessage)  throws HgException {
1469
    public static void doCommit(File repository, List<File> commitFiles, String commitMessage, OutputLogger logger)  throws HgException {
1460
        List<String> command = new ArrayList<String>();
1470
        List<String> command = new ArrayList<String>();
1461
1471
1462
        command.add(getHgCommand());
1472
        command.add(getHgCommand());
Lines 1501-1507 public class HgCommand { Link Here
1501
            
1511
            
1502
            if (!list.isEmpty()
1512
            if (!list.isEmpty()
1503
                    && (isErrorNotTracked(list.get(0)) || isErrorCannotReadCommitMsg(list.get(0))))
1513
                    && (isErrorNotTracked(list.get(0)) || isErrorCannotReadCommitMsg(list.get(0))))
1504
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMIT_FAILED"));
1514
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COMMIT_FAILED"), logger);
1505
            
1515
            
1506
        }catch (IOException ex){
1516
        }catch (IOException ex){
1507
            throw new HgException(NbBundle.getMessage(HgCommand.class, "MSG_FAILED_TO_READ_COMMIT_MESSAGE"));
1517
            throw new HgException(NbBundle.getMessage(HgCommand.class, "MSG_FAILED_TO_READ_COMMIT_MESSAGE"));
Lines 1524-1534 public class HgCommand { Link Here
1524
     * @return void
1534
     * @return void
1525
     * @throws org.netbeans.modules.mercurial.HgException
1535
     * @throws org.netbeans.modules.mercurial.HgException
1526
     */
1536
     */
1527
    public static void doRename(File repository, File sourceFile, File destFile)  throws HgException {
1537
    public static void doRename(File repository, File sourceFile, File destFile, OutputLogger logger)  throws HgException {
1528
        doRename(repository, sourceFile, destFile, false);
1538
        doRename(repository, sourceFile, destFile, false, logger);
1529
    }
1539
    }
1530
1540
1531
    private static void doRename(File repository, File sourceFile, File destFile, boolean bAfter)  throws HgException {
1541
    private static void doRename(File repository, File sourceFile, File destFile, boolean bAfter, OutputLogger logger)  throws HgException {
1532
        if (repository == null) return;
1542
        if (repository == null) return;
1533
        
1543
        
1534
        List<String> command = new ArrayList<String>();
1544
        List<String> command = new ArrayList<String>();
Lines 1548-1554 public class HgCommand { Link Here
1548
        if (!list.isEmpty() &&
1558
        if (!list.isEmpty() &&
1549
             isErrorAbort(list.get(list.size() -1))) {
1559
             isErrorAbort(list.get(list.size() -1))) {
1550
            if (!bAfter || !isErrorAbortNoFilesToCopy(list.get(list.size() -1))) {
1560
            if (!bAfter || !isErrorAbortNoFilesToCopy(list.get(list.size() -1))) {
1551
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_RENAME_FAILED"));
1561
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_RENAME_FAILED"), logger);
1552
            }
1562
            }
1553
        }
1563
        }
1554
    }
1564
    }
Lines 1563-1570 public class HgCommand { Link Here
1563
     * @return void
1573
     * @return void
1564
     * @throws org.netbeans.modules.mercurial.HgException
1574
     * @throws org.netbeans.modules.mercurial.HgException
1565
     */
1575
     */
1566
    public static void doRenameAfter(File repository, File sourceFile, File destFile)  throws HgException {
1576
    public static void doRenameAfter(File repository, File sourceFile, File destFile, OutputLogger logger)  throws HgException {
1567
       doRename(repository, sourceFile, destFile, true);
1577
       doRename(repository, sourceFile, destFile, true, logger);
1568
    }
1578
    }
1569
    
1579
    
1570
    /**
1580
    /**
Lines 1577-1583 public class HgCommand { Link Here
1577
     * @return void
1587
     * @return void
1578
     * @throws org.netbeans.modules.mercurial.HgException
1588
     * @throws org.netbeans.modules.mercurial.HgException
1579
     */
1589
     */
1580
    public static void doAdd(File repository, List<File> addFiles)  throws HgException {
1590
    public static void doAdd(File repository, List<File> addFiles, OutputLogger logger)  throws HgException {
1581
        if (repository == null) return;
1591
        if (repository == null) return;
1582
        if (addFiles.size() == 0) return;
1592
        if (addFiles.size() == 0) return;
1583
        List<String> command = new ArrayList<String>();
1593
        List<String> command = new ArrayList<String>();
Lines 1596-1602 public class HgCommand { Link Here
1596
        }
1606
        }
1597
        List<String> list = exec(command);
1607
        List<String> list = exec(command);
1598
        if (!list.isEmpty() && isErrorAlreadyTracked(list.get(0)))
1608
        if (!list.isEmpty() && isErrorAlreadyTracked(list.get(0)))
1599
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_ALREADY_TRACKED"));
1609
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_ALREADY_TRACKED"), logger);
1600
    }
1610
    }
1601
1611
1602
    /**
1612
    /**
Lines 1608-1614 public class HgCommand { Link Here
1608
     * @return void
1618
     * @return void
1609
     * @throws org.netbeans.modules.mercurial.HgException
1619
     * @throws org.netbeans.modules.mercurial.HgException
1610
     */
1620
     */
1611
    public static void doRevert(File repository, List<File> revertFiles, String revision)  throws HgException {
1621
    public static void doRevert(File repository, List<File> revertFiles, String revision, OutputLogger logger)  throws HgException {
1612
        if (repository == null) return;
1622
        if (repository == null) return;
1613
        if (revertFiles.size() == 0) return;
1623
        if (revertFiles.size() == 0) return;
1614
        boolean doBackup = HgModuleConfig.getDefault().getBackupOnRevertModifications();
1624
        boolean doBackup = HgModuleConfig.getDefault().getBackupOnRevertModifications();
Lines 1632-1638 public class HgCommand { Link Here
1632
        }
1642
        }
1633
        List<String> list = exec(command);
1643
        List<String> list = exec(command);
1634
        if (!list.isEmpty() && isErrorNoChangeNeeded(list.get(0)))
1644
        if (!list.isEmpty() && isErrorNoChangeNeeded(list.get(0)))
1635
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_REVERT_FAILED"));
1645
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_REVERT_FAILED"), logger);
1636
    }
1646
    }
1637
1647
1638
    /**
1648
    /**
Lines 1645-1651 public class HgCommand { Link Here
1645
     * @return void
1655
     * @return void
1646
     * @throws org.netbeans.modules.mercurial.HgException
1656
     * @throws org.netbeans.modules.mercurial.HgException
1647
     */
1657
     */
1648
    public static void doAdd(File repository, File file)  throws HgException {
1658
    public static void doAdd(File repository, File file, OutputLogger logger)  throws HgException {
1649
        if (repository == null) return;
1659
        if (repository == null) return;
1650
        if (file == null) return;
1660
        if (file == null) return;
1651
        if (file.isDirectory()) return;
1661
        if (file.isDirectory()) return;
Lines 1662-1668 public class HgCommand { Link Here
1662
        command.add(file.getAbsolutePath());
1672
        command.add(file.getAbsolutePath());
1663
        List<String> list = exec(command);
1673
        List<String> list = exec(command);
1664
        if (!list.isEmpty() && isErrorAlreadyTracked(list.get(0)))
1674
        if (!list.isEmpty() && isErrorAlreadyTracked(list.get(0)))
1665
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_ALREADY_TRACKED"));
1675
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_ALREADY_TRACKED"), logger);
1666
    }
1676
    }
1667
    
1677
    
1668
    /**
1678
    /**
Lines 1674-1680 public class HgCommand { Link Here
1674
     * @return List<String> list of the annotated lines of the file
1684
     * @return List<String> list of the annotated lines of the file
1675
     * @throws org.netbeans.modules.mercurial.HgException
1685
     * @throws org.netbeans.modules.mercurial.HgException
1676
     */
1686
     */
1677
    public static List<String> doAnnotate(File repository, File file, String revision) throws HgException {
1687
    public static List<String> doAnnotate(File repository, File file, String revision, OutputLogger logger) throws HgException {
1678
        if (repository == null) return null;
1688
        if (repository == null) return null;
1679
        List<String> command = new ArrayList<String>();
1689
        List<String> command = new ArrayList<String>();
1680
1690
Lines 1694-1707 public class HgCommand { Link Here
1694
        List<String> list = exec(command);
1704
        List<String> list = exec(command);
1695
        if (!list.isEmpty()) {
1705
        if (!list.isEmpty()) {
1696
            if (isErrorNoRepository(list.get(0))) {
1706
            if (isErrorNoRepository(list.get(0))) {
1697
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"));
1707
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"), logger);
1698
            } else if (isErrorNoSuchFile(list.get(0))) {
1708
            } else if (isErrorNoSuchFile(list.get(0))) {
1699
                // This can happen if we have multiple heads and the wrong
1709
                // This can happen if we have multiple heads and the wrong
1700
                // one was picked by default hg annotation 
1710
                // one was picked by default hg annotation 
1701
                if (revision == null) {
1711
                if (revision == null) {
1702
                    String rev = getLastRevision(repository, file);
1712
                    String rev = getLastRevision(repository, file);
1703
                    if (rev != null) {
1713
                    if (rev != null) {
1704
                        list = doAnnotate(repository, file, rev);
1714
                        list = doAnnotate(repository, file, rev, logger);
1705
                    } else {
1715
                    } else {
1706
                        list = null;
1716
                        list = null;
1707
                    }
1717
                    }
Lines 1713-1720 public class HgCommand { Link Here
1713
        return list;
1723
        return list;
1714
    }
1724
    }
1715
  
1725
  
1716
    public static List<String> doAnnotate(File repository, File file) throws HgException {
1726
    public static List<String> doAnnotate(File repository, File file, OutputLogger logger) throws HgException {
1717
        return doAnnotate(repository, file, null);
1727
        return doAnnotate(repository, file, null, logger);
1718
    }
1728
    }
1719
1729
1720
    /**
1730
    /**
Lines 2178-2184 public class HgCommand { Link Here
2178
     * @param f path to be removed from the repository
2188
     * @param f path to be removed from the repository
2179
     * @throws org.netbeans.modules.mercurial.HgException
2189
     * @throws org.netbeans.modules.mercurial.HgException
2180
     */
2190
     */
2181
    public static void doRemove(File repository, File f)  throws HgException {
2191
    public static void doRemove(File repository, File f, OutputLogger logger)  throws HgException {
2182
        List<String> command = new ArrayList<String>();
2192
        List<String> command = new ArrayList<String>();
2183
2193
2184
        command.add(getHgCommand());
2194
        command.add(getHgCommand());
Lines 2190-2196 public class HgCommand { Link Here
2190
2200
2191
        List<String> list = exec(command);
2201
        List<String> list = exec(command);
2192
        if (!list.isEmpty() && isErrorAlreadyTracked(list.get(0)))
2202
        if (!list.isEmpty() && isErrorAlreadyTracked(list.get(0)))
2193
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_ALREADY_TRACKED"));
2203
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_ALREADY_TRACKED"), logger);
2194
    }
2204
    }
2195
    
2205
    
2196
    /**
2206
    /**
Lines 2201-2207 public class HgCommand { Link Here
2201
     * @param outputFileName path of the output file
2211
     * @param outputFileName path of the output file
2202
     * @throws org.netbeans.modules.mercurial.HgException
2212
     * @throws org.netbeans.modules.mercurial.HgException
2203
     */
2213
     */
2204
    public static List<String> doExport(File repository, String revStr, String outputFileName)  throws HgException {
2214
    public static List<String> doExport(File repository, String revStr, String outputFileName, OutputLogger logger)  throws HgException {
2205
        // Ensure that parent directory of target exists, creating if necessary
2215
        // Ensure that parent directory of target exists, creating if necessary
2206
        File fileTarget = new File (outputFileName);
2216
        File fileTarget = new File (outputFileName);
2207
        File parentTarget = fileTarget.getParentFile();
2217
        File parentTarget = fileTarget.getParentFile();
Lines 2230-2236 public class HgCommand { Link Here
2230
        List<String> list = exec(command);
2240
        List<String> list = exec(command);
2231
        if (!list.isEmpty() &&
2241
        if (!list.isEmpty() &&
2232
             isErrorAbort(list.get(list.size() -1))) {
2242
             isErrorAbort(list.get(list.size() -1))) {
2233
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_EXPORT_FAILED"));
2243
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_EXPORT_FAILED"), logger);
2234
        }
2244
        }
2235
        return list;
2245
        return list;
2236
    }
2246
    }
Lines 2242-2248 public class HgCommand { Link Here
2242
     * @param File patchFile of the patch file
2252
     * @param File patchFile of the patch file
2243
     * @throws org.netbeans.modules.mercurial.HgException
2253
     * @throws org.netbeans.modules.mercurial.HgException
2244
     */
2254
     */
2245
    public static List<String> doImport(File repository, File patchFile)  throws HgException {
2255
    public static List<String> doImport(File repository, File patchFile, OutputLogger logger)  throws HgException {
2246
        List<String> command = new ArrayList<String>();
2256
        List<String> command = new ArrayList<String>();
2247
2257
2248
        command.add(getHgCommand());
2258
        command.add(getHgCommand());
Lines 2257-2264 public class HgCommand { Link Here
2257
        List<String> list = exec(command);
2267
        List<String> list = exec(command);
2258
        if (!list.isEmpty() &&
2268
        if (!list.isEmpty() &&
2259
             isErrorAbort(list.get(list.size() -1))) {
2269
             isErrorAbort(list.get(list.size() -1))) {
2260
            HgUtils.outputMercurialTab(list); // need the failure info from import
2270
            logger.output(list); // need the failure info from import
2261
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_IMPORT_FAILED"));
2271
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_IMPORT_FAILED"), logger);
2262
        }
2272
        }
2263
        return list;
2273
        return list;
2264
    }
2274
    }
Lines 2424-2431 public class HgCommand { Link Here
2424
        }
2434
        }
2425
        
2435
        
2426
        List<String> list =  exec(command);
2436
        List<String> list =  exec(command);
2427
        if (!list.isEmpty() && isErrorNoRepository(list.get(0)))
2437
        if (!list.isEmpty() && isErrorNoRepository(list.get(0))) {
2428
            handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"));
2438
            OutputLogger logger = OutputLogger.getLogger(repository.getAbsolutePath());
2439
            try {
2440
                handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_NO_REPOSITORY_ERR"), logger);
2441
            } finally {
2442
                logger.closeLog();
2443
            }
2444
        }
2429
        return list;
2445
        return list;
2430
    }
2446
    }
2431
    /**
2447
    /**
Lines 2564-2575 public class HgCommand { Link Here
2564
            return defaultPath + File.separatorChar + HG_COMMAND;
2580
            return defaultPath + File.separatorChar + HG_COMMAND;
2565
    }
2581
    }
2566
2582
2567
    private static void handleError(List<String> command, List<String> list, String message) throws HgException{
2583
    private static void handleError(List<String> command, List<String> list, String message, OutputLogger logger) throws HgException{
2568
        if (command != null && list != null){
2584
        if (command != null && list != null){
2569
            Mercurial.LOG.log(Level.WARNING, "command: " + HgUtils.replaceHttpPassword(command)); // NOI18N        
2585
            Mercurial.LOG.log(Level.WARNING, "command: " + HgUtils.replaceHttpPassword(command)); // NOI18N        
2570
            Mercurial.LOG.log(Level.WARNING, "output: " + HgUtils.replaceHttpPassword(list)); // NOI18N
2586
            Mercurial.LOG.log(Level.WARNING, "output: " + HgUtils.replaceHttpPassword(list)); // NOI18N
2571
            HgUtils.outputMercurialTabInRed(NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ERR")); // NOI18N
2587
            logger.outputInRed(NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_ERR")); // NOI18N
2572
            HgUtils.outputMercurialTab(NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_INFO_ERR",
2588
            logger.output(NbBundle.getMessage(HgCommand.class, "MSG_COMMAND_INFO_ERR",
2573
                    HgUtils.replaceHttpPassword(command), HgUtils.replaceHttpPassword(list))); // NOI18N
2589
                    HgUtils.replaceHttpPassword(command), HgUtils.replaceHttpPassword(list))); // NOI18N
2574
        }
2590
        }
2575
2591
(-)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 123-132 public class HgUtils { Link Here
123
    private static final String HG_IGNORE_REJ_ANY_FILES = "\\.rej$"; // NOI18N
116
    private static final String HG_IGNORE_REJ_ANY_FILES = "\\.rej$"; // NOI18N
124
    
117
    
125
    private static final String FILENAME_HGIGNORE = ".hgignore"; // NOI18N
118
    private static final String FILENAME_HGIGNORE = ".hgignore"; // NOI18N
126
127
    public static final int MAX_LINES_TO_PRINT = 500;
128
129
    private static final String MSG_TOO_MANY_LINES = "The number of output lines is greater than 500; see message log for complete output";
130
119
131
    private static HashMap<String, Set<Pattern>> ignorePatterns;
120
    private static HashMap<String, Set<Pattern>> ignorePatterns;
132
121
Lines 1063-1189 itor tabs #66700). Link Here
1063
        }
1052
        }
1064
    }
1053
    }
1065
1054
1066
1067
    /**
1068
     * Print contents of list to Mercurial Output Tab
1069
     *
1070
     * @param list to print out
1071
     * 
1072
     */
1073
     public static void outputMercurialTab(List<String> list){
1074
        if( list.isEmpty()) return;
1075
1076
        InputOutput io = IOProvider.getDefault().getIO(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE, false);
1077
        io.select();
1078
        OutputWriter out = io.getOut();
1079
        
1080
        int lines = list.size();
1081
        if (lines > MAX_LINES_TO_PRINT) {
1082
            out.println(list.get(1));
1083
            out.println(list.get(2));
1084
            out.println(list.get(3));
1085
            out.println("...");
1086
            out.println(list.get(list.size() -1));
1087
            out.println(MSG_TOO_MANY_LINES);
1088
            for (String s : list){
1089
                Mercurial.LOG.log(Level.WARNING, s);
1090
            }
1091
        } else {
1092
            for (String s : list){
1093
                out.println(s);
1094
1095
            }
1096
        }
1097
        out.close();
1098
    }
1099
1100
     /**
1101
     * Print msg to Mercurial Output Tab
1102
     *
1103
     * @param String msg to print out
1104
     * 
1105
     */
1106
     public static void outputMercurialTab(String msg){
1107
        if( msg == null) return;
1108
1109
        InputOutput io = IOProvider.getDefault().getIO(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE, false);
1110
        io.select();
1111
        OutputWriter out = io.getOut();
1112
        
1113
        out.println(msg);
1114
        out.close();
1115
    }
1116
1117
    /**
1118
     * Print msg to Mercurial Output Tab in Red
1119
     *
1120
     * @param String msg to print out
1121
     * 
1122
     */
1123
     public static void outputMercurialTabInRed(String msg){
1124
        if( msg == null) return;
1125
1126
        InputOutput io = IOProvider.getDefault().getIO(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE, false);
1127
        io.select();
1128
        OutputWriter out = io.getErr();
1129
        
1130
        out.println(msg);
1131
        out.close();
1132
    }
1133
1134
    /**
1135
     * Print URL to Mercurial Output Tab as an active Hyperlink
1136
     *
1137
     * @param String sURL to print out
1138
     * 
1139
     */
1140
     public static void outputMercurialTabLink(final String sURL){
1141
         if (sURL == null) return;
1142
         
1143
         try {
1144
             InputOutput io = IOProvider.getDefault().getIO(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE, false);
1145
             io.select();
1146
             OutputWriter out = io.getOut();
1147
1148
             OutputListener listener = new OutputListener() {
1149
                         public void outputLineAction(OutputEvent ev) {
1150
                             try {
1151
                                 HtmlBrowser.URLDisplayer.getDefault().showURL(new URL(sURL));
1152
                             } catch (IOException ex) {
1153
                             // Ignore
1154
                             }
1155
                         }
1156
                         public void outputLineSelected(OutputEvent ev) {}
1157
                         public void outputLineCleared(OutputEvent ev) {}
1158
                     };
1159
             out.println(sURL, listener, true);
1160
             out.close();
1161
         } catch (IOException ex) {
1162
         // Ignore
1163
         }
1164
     }
1165
1166
    /**
1167
     * Select and Clear Mercurial Output Tab
1168
     *
1169
     * @param list to print out
1170
     * 
1171
     */
1172
     public static void clearOutputMercurialTab(){
1173
         InputOutput io = IOProvider.getDefault().getIO(
1174
                 Mercurial.MERCURIAL_OUTPUT_TAB_TITLE, false);
1175
         
1176
         io.select();
1177
         OutputWriter out = io.getOut();
1178
         
1179
         try {
1180
             out.reset();
1181
         } catch (IOException ex) {
1182
             // Ignore Exception
1183
         }
1184
         out.close();
1185
    }
1186
     
1187
    /**
1055
    /**
1188
     * This utility class should not be instantiated anywhere.
1056
     * This utility class should not be instantiated anywhere.
1189
     */
1057
     */

Return to bug 127182