# HG changeset patch # User padraigob@netbeans.org # Date 1205424771 0 # Node ID 76bb055b6b8f547a88606666f9d37a886c7113df # Parent cb25d8c5041b4c87bd5e3f9fbc8a5bfd05433db0 126839: Check whether command line for commit is too long on Windows diff -r cb25d8c5041b -r 76bb055b6b8f mercurial/src/org/netbeans/modules/mercurial/util/Bundle.properties --- a/mercurial/src/org/netbeans/modules/mercurial/util/Bundle.properties Thu Mar 13 13:45:40 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/util/Bundle.properties Thu Mar 13 16:12:51 2008 +0000 @@ -80,3 +80,5 @@ MSG_SEARCH_HISTORY_WARN_FROM_BEFORE_TODA MSG_SEARCH_HISTORY_WARN_FROM_BEFORE_TODATE_NEEDED_TEXT = The From date is after the To date.\nPlease specify a From date before the To date. MSG_POSSIBLE_PROXY_ISSUE_TITLE = Command Failed - Possible Proxy Issue MSG_POSSIBLE_PROXY_ISSUE_QUERY = The Mercurial command has failed (refer to Output Window).\n\nThis may be due to your proxy settings, do you want to modify them? +MSG_LONG_COMMAND_QUERY = The command line for the commit command is too long.\n\nDo you wish to commit all files? +MSG_LONG_COMMAND_TITLE = Command Line Too Long diff -r cb25d8c5041b -r 76bb055b6b8f mercurial/src/org/netbeans/modules/mercurial/util/HgCommand.java --- a/mercurial/src/org/netbeans/modules/mercurial/util/HgCommand.java Thu Mar 13 13:45:40 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/util/HgCommand.java Thu Mar 13 16:12:51 2008 +0000 @@ -42,6 +42,7 @@ package org.netbeans.modules.mercurial.u package org.netbeans.modules.mercurial.util; import java.awt.EventQueue; +import javax.swing.JOptionPane; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileWriter; @@ -1670,8 +1671,33 @@ public class HgCommand { command.add(HG_COMMIT_OPT_LOGFILE_CMD); command.add(tempfile.getAbsolutePath()); + List saveCommand = null; + if(Utilities.isWindows()) { + saveCommand = new ArrayList(command); + } for(File f: commitFiles){ command.add(f.getAbsolutePath().substring(repository.getAbsolutePath().length()+1)); + } + if(Utilities.isWindows()) { + // Count size of command + int size = 0; + for (String line : command) { + size += line.length(); + } + int maxSize = 32767; // Assume CreateProcess is used + if (size > maxSize) { + NotifyDescriptor descriptor = new NotifyDescriptor.Confirmation(NbBundle.getMessage(HgCommand.class, "MSG_LONG_COMMAND_QUERY")); // NOI18N + descriptor.setTitle(NbBundle.getMessage(HgCommand.class, "MSG_LONG_COMMAND_TITLE")); // NOI18N + descriptor.setMessageType(JOptionPane.WARNING_MESSAGE); + descriptor.setOptionType(NotifyDescriptor.YES_NO_OPTION); + + Object res = DialogDisplayer.getDefault().notify(descriptor) +; + if (res == NotifyDescriptor.NO_OPTION) { + return; + } + command = saveCommand; + } } List list = exec(command);