Mercurial > hg > mercurial
changeset 852:d746a9351572
Fix command line lenght limit
Use the length of max int only if running a command via wrapper is actually enabled.
author | Dmitry Neverov <dmitry.neverov@jetbrains.com> |
---|---|
date | Wed, 02 Jul 2014 19:21:34 +0200 |
parents | fcc2a5bf4238 |
children | 820d02ac9b8a |
files | mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/ArchiveCommand.java mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/BaseCommand.java mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/CatCommand.java mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/CommandSettings.java |
diffstat | 4 files changed, 4 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/ArchiveCommand.java Wed Jul 02 18:43:15 2014 +0200 +++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/ArchiveCommand.java Wed Jul 02 19:21:34 2014 +0200 @@ -69,7 +69,7 @@ final MercurialCommandLine cmd = createCmd(); final int cmdSize = cmd.getCommandLineLength(); - if (cmdSize + rule.length() + 3 + (myIncludeRules.isEmpty() ? 0 : "-I ".length()) > getMaxCommandLineSize()) { + if (cmdSize + rule.length() + 3 + (myIncludeRules.isEmpty() ? 0 : "-I ".length()) > myCommandSettings.getMaxCommandLineSize()) { return false; }
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/BaseCommand.java Wed Jul 02 18:43:15 2014 +0200 +++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/BaseCommand.java Wed Jul 02 19:21:34 2014 +0200 @@ -40,16 +40,6 @@ myWorkDirectory = workingDir; } - protected final int getMaxCommandLineSize() { - return allowCommandlineViaFileWrapper() - ? Integer.MAX_VALUE - : myCommandSettings.getMaxCommandLineSize(); - } - - protected boolean allowCommandlineViaFileWrapper() { - return true; - } - public File getWorkDirectory() { return myWorkDirectory; } @@ -82,7 +72,7 @@ protected final CommandResult runCommand(@NotNull final MercurialCommandLine cli, @NotNull final CommandSettings commandSettings) throws VcsException { - if (!myCommandSettings.getUseCommandlineViaFileWrapper() || !allowCommandlineViaFileWrapper()) { + if (!myCommandSettings.getUseCommandlineViaFileWrapper()) { return CommandUtil.runCommand(cli, commandSettings.setPrivateData(getPrivateData())); }
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/CatCommand.java Wed Jul 02 18:43:15 2014 +0200 +++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/CatCommand.java Wed Jul 02 19:21:34 2014 +0200 @@ -116,7 +116,7 @@ String path = paths.poll(); cli.addParameter(path); cmdSize += path.length() + 3; //quotes + space - } while (cmdSize < getMaxCommandLineSize() && !paths.isEmpty()); + } while (cmdSize < myCommandSettings.getMaxCommandLineSize() && !paths.isEmpty()); runCommand(cli, myCommandSettings.setCheckForFailure(checkFailure)); }
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/CommandSettings.java Wed Jul 02 18:43:15 2014 +0200 +++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/CommandSettings.java Wed Jul 02 19:21:34 2014 +0200 @@ -39,7 +39,7 @@ private boolean myUseCommandlineViaFileWrapper = false; public final int getMaxCommandLineSize() { - return OS.getMaxCommandLineSize(); + return myUseCommandlineViaFileWrapper ? Integer.MAX_VALUE : OS.getMaxCommandLineSize(); } public boolean getUseCommandlineViaFileWrapper() {