VcsCommand: Remove one addJob overload

Remove defaultTimeoutS field, as it wasn't broadly used.

Change-Id: I0056788b066eb6d682d5ba7acdb01d5dd3568967
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2022-08-03 07:27:51 +02:00
parent d2a1198a7b
commit 191fc196d5
5 changed files with 4 additions and 31 deletions

View File

@@ -3436,7 +3436,7 @@ VcsCommand *GitClient::vcsExecAbortable(const FilePath &workingDirectory,
| VcsCommand::ShowSuccessMessage); | VcsCommand::ShowSuccessMessage);
// For rebase, Git might request an editor (which means the process keeps running until the // For rebase, Git might request an editor (which means the process keeps running until the
// user closes it), so run without timeout. // user closes it), so run without timeout.
command->addJob({vcsBinary(), arguments}, isRebase ? 0 : command->defaultTimeoutS()); command->addJob({vcsBinary(), arguments}, isRebase ? 0 : vcsTimeoutS());
ConflictHandler::attachToCommand(command, abortCommand); ConflictHandler::attachToCommand(command, abortCommand);
if (isRebase) if (isRebase)
GitProgressParser::attachToCommand(command); GitProgressParser::attachToCommand(command);

View File

@@ -96,7 +96,6 @@ VcsCommand *VcsBaseClientImpl::createCommand(const FilePath &workingDirectory,
JobOutputBindMode mode) const JobOutputBindMode mode) const
{ {
auto cmd = createVcsCommand(workingDirectory, processEnvironment()); auto cmd = createVcsCommand(workingDirectory, processEnvironment());
cmd->setDefaultTimeoutS(vcsTimeoutS());
if (editor) if (editor)
editor->setCommand(cmd); editor->setCommand(cmd);
if (mode == VcsWindowOutputBind) { if (mode == VcsWindowOutputBind) {
@@ -119,7 +118,7 @@ VcsCommand *VcsBaseClientImpl::execBgCommand(const FilePath &workingDirectory,
cmd->addFlags(flags | VcsCommand::SuppressCommandLogging cmd->addFlags(flags | VcsCommand::SuppressCommandLogging
| VcsCommand::SuppressStdErr | VcsCommand::SuppressStdErr
| VcsCommand::SuppressFailMessage); | VcsCommand::SuppressFailMessage);
cmd->addJob({vcsBinary(), args}); cmd->addJob({vcsBinary(), args}, vcsTimeoutS());
connect(cmd, &VcsCommand::stdOutText, this, outputCallback); connect(cmd, &VcsCommand::stdOutText, this, outputCallback);
cmd->execute(); cmd->execute();
return cmd; return cmd;

View File

@@ -109,7 +109,6 @@ public:
QList<Job> m_jobs; QList<Job> m_jobs;
unsigned m_flags = 0; unsigned m_flags = 0;
int m_defaultTimeoutS = 10;
bool m_progressiveOutput = false; bool m_progressiveOutput = false;
bool m_hadOutput = false; bool m_hadOutput = false;
@@ -201,28 +200,11 @@ const FilePath &VcsCommand::defaultWorkingDirectory() const
return d->m_defaultWorkingDirectory; return d->m_defaultWorkingDirectory;
} }
int VcsCommand::defaultTimeoutS() const
{
return d->m_defaultTimeoutS;
}
void VcsCommand::setDefaultTimeoutS(int timeout)
{
d->m_defaultTimeoutS = timeout;
}
void VcsCommand::addFlags(unsigned f) void VcsCommand::addFlags(unsigned f)
{ {
d->m_flags |= f; d->m_flags |= f;
} }
void VcsCommand::addJob(const CommandLine &command,
const FilePath &workingDirectory,
const ExitCodeInterpreter &interpreter)
{
addJob(command, defaultTimeoutS(), workingDirectory, interpreter);
}
void VcsCommand::addJob(const CommandLine &command, int timeoutS, void VcsCommand::addJob(const CommandLine &command, int timeoutS,
const FilePath &workingDirectory, const FilePath &workingDirectory,
const ExitCodeInterpreter &interpreter) const ExitCodeInterpreter &interpreter)

View File

@@ -126,18 +126,12 @@ public:
const Utils::FilePath &defaultWorkingDirectory() const; const Utils::FilePath &defaultWorkingDirectory() const;
void addJob(const Utils::CommandLine &command,
const Utils::FilePath &workingDirectory = {},
const Utils::ExitCodeInterpreter &interpreter = {});
void addJob(const Utils::CommandLine &command, int timeoutS, void addJob(const Utils::CommandLine &command, int timeoutS,
const Utils::FilePath &workingDirectory = {}, const Utils::FilePath &workingDirectory = {},
const Utils::ExitCodeInterpreter &interpreter = {}); const Utils::ExitCodeInterpreter &interpreter = {});
void execute(); // Execute tasks asynchronously! void execute(); // Execute tasks asynchronously!
void abort(); void abort();
int defaultTimeoutS() const;
void setDefaultTimeoutS(int timeout);
void addFlags(unsigned f); void addFlags(unsigned f);
void setCodec(QTextCodec *codec); void setCodec(QTextCodec *codec);
@@ -145,9 +139,6 @@ public:
void setProgressParser(ProgressParser *parser); void setProgressParser(ProgressParser *parser);
void setProgressiveOutput(bool progressive); void setProgressiveOutput(bool progressive);
// This is called once per job in a thread.
// When called from the UI thread it will execute fully synchronously, so no signals will
// be triggered!
CommandResult runCommand(const Utils::CommandLine &command, int timeoutS = 10); CommandResult runCommand(const Utils::CommandLine &command, int timeoutS = 10);
void cancel(); void cancel();

View File

@@ -363,7 +363,8 @@ void VcsCommandPage::delayedInitialize()
} }
const FilePath dir = wiz->expander()->expand(job.workDirectory); const FilePath dir = wiz->expander()->expand(job.workDirectory);
const int timeoutS = command->defaultTimeoutS() * job.timeOutFactor; const int defaultTimeoutS = 10;
const int timeoutS = defaultTimeoutS * job.timeOutFactor;
command->addJob({FilePath::fromUserInput(commandString), args}, timeoutS, dir); command->addJob({FilePath::fromUserInput(commandString), args}, timeoutS, dir);
} }