VcsBase: Move RunFlags into separate header

It is going to be used outside of VcsCommand, too.
Use RunFlags enum as an argument to several functions
instead of unsigned.

Change-Id: I355c80a845a9b5982108fbde3412754392dce702
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2022-10-05 19:08:53 +02:00
parent 3811236903
commit eec0679234
20 changed files with 196 additions and 159 deletions

View File

@@ -79,9 +79,9 @@ VcsCommand *VcsBaseClientImpl::createCommand(const FilePath &workingDirectory,
if (editor)
editor->setCommand(cmd);
if (mode == VcsWindowOutputBind) {
cmd->addFlags(VcsCommand::ShowStdOut);
cmd->addFlags(RunFlags::ShowStdOut);
if (editor) // assume that the commands output is the important thing
cmd->addFlags(VcsCommand::SilentOutput);
cmd->addFlags(RunFlags::SilentOutput);
} else if (editor) {
connect(cmd, &VcsCommand::done, editor, [editor, cmd] {
if (cmd->result() != ProcessResult::FinishedWithSuccess) {
@@ -129,13 +129,13 @@ QString VcsBaseClientImpl::stripLastNewline(const QString &in)
}
CommandResult VcsBaseClientImpl::vcsSynchronousExec(const FilePath &workingDir,
const QStringList &args, unsigned flags, int timeoutS, QTextCodec *codec) const
const QStringList &args, RunFlags flags, int timeoutS, QTextCodec *codec) const
{
return vcsSynchronousExec(workingDir, {vcsBinary(), args}, flags, timeoutS, codec);
}
CommandResult VcsBaseClientImpl::vcsSynchronousExec(const FilePath &workingDir,
const CommandLine &cmdLine, unsigned flags, int timeoutS, QTextCodec *codec) const
const CommandLine &cmdLine, RunFlags flags, int timeoutS, QTextCodec *codec) const
{
return VcsCommand::runBlocking(workingDir, processEnvironment(), cmdLine, flags,
timeoutS > 0 ? timeoutS : vcsTimeoutS(), codec);
@@ -162,7 +162,7 @@ void VcsBaseClientImpl::annotateRevisionRequested(const FilePath &workingDirecto
VcsCommand *VcsBaseClientImpl::vcsExec(const FilePath &workingDirectory,
const QStringList &arguments,
VcsBaseEditorWidget *editor, bool useOutputToWindow,
unsigned additionalFlags) const
RunFlags additionalFlags) const
{
VcsCommand *command = createCommand(workingDirectory, editor,
useOutputToWindow ? VcsWindowOutputBind : NoOutputBind);
@@ -288,7 +288,7 @@ bool VcsBaseClient::synchronousPull(const FilePath &workingDir,
{
QStringList args;
args << vcsCommandString(PullCommand) << extraOptions << srcLocation;
const unsigned flags = VcsCommand::ShowStdOut | VcsCommand::ShowSuccessMessage;
const RunFlags flags = RunFlags::ShowStdOut | RunFlags::ShowSuccessMessage;
const bool ok = vcsSynchronousExec(workingDir, args, flags).result()
== ProcessResult::FinishedWithSuccess;
if (ok)
@@ -302,7 +302,7 @@ bool VcsBaseClient::synchronousPush(const FilePath &workingDir,
{
QStringList args;
args << vcsCommandString(PushCommand) << extraOptions << dstLocation;
const unsigned flags = VcsCommand::ShowStdOut | VcsCommand::ShowSuccessMessage;
const RunFlags flags = RunFlags::ShowStdOut | RunFlags::ShowSuccessMessage;
return vcsSynchronousExec(workingDir, args, flags).result()
== ProcessResult::FinishedWithSuccess;
}