Change GitClient::executeGit() to take flags instead of bool.

Change-Id: I3cb83914be7e9665f49baf9f563c753c6c3919f1
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Friedemann Kleint
2013-11-28 10:54:39 +01:00
parent f967c3b5d2
commit 6c02c27e9e
2 changed files with 12 additions and 8 deletions

View File

@@ -1537,7 +1537,7 @@ void GitClient::blame(const QString &workingDirectory,
arguments << QLatin1String("--") << fileName; arguments << QLatin1String("--") << fileName;
if (!revision.isEmpty()) if (!revision.isEmpty())
arguments << revision; arguments << revision;
executeGit(workingDirectory, arguments, editor, false, false, lineNumber); executeGit(workingDirectory, arguments, editor, false, 0, lineNumber);
} }
bool GitClient::synchronousCheckout(const QString &workingDirectory, bool GitClient::synchronousCheckout(const QString &workingDirectory,
@@ -1567,7 +1567,10 @@ void GitClient::reset(const QString &workingDirectory, const QString &argument,
if (!commit.isEmpty()) if (!commit.isEmpty())
arguments << commit; arguments << commit;
executeGit(workingDirectory, arguments, 0, true, argument == QLatin1String("--hard")); unsigned flags = 0;
if (argument == QLatin1String("--hard"))
flags |= VcsBasePlugin::ExpectRepoChanges;
executeGit(workingDirectory, arguments, 0, true, flags);
} }
void GitClient::addFile(const QString &workingDirectory, const QString &fileName) void GitClient::addFile(const QString &workingDirectory, const QString &fileName)
@@ -2427,14 +2430,13 @@ VcsBase::Command *GitClient::executeGit(const QString &workingDirectory,
const QStringList &arguments, const QStringList &arguments,
VcsBase::VcsBaseEditorWidget* editor, VcsBase::VcsBaseEditorWidget* editor,
bool useOutputToWindow, bool useOutputToWindow,
bool expectChanges, unsigned additionalFlags,
int editorLineNumber) int editorLineNumber)
{ {
outputWindow()->appendCommand(workingDirectory, settings()->stringValue(GitSettings::binaryPathKey), arguments); outputWindow()->appendCommand(workingDirectory, settings()->stringValue(GitSettings::binaryPathKey), arguments);
VcsBase::Command *command = createCommand(workingDirectory, editor, useOutputToWindow, editorLineNumber); VcsBase::Command *command = createCommand(workingDirectory, editor, useOutputToWindow, editorLineNumber);
command->addJob(arguments, settings()->intValue(GitSettings::timeoutKey)); command->addJob(arguments, settings()->intValue(GitSettings::timeoutKey));
if (expectChanges) command->addFlags(additionalFlags);
command->addFlags(VcsBasePlugin::ExpectRepoChanges);
command->execute(); command->execute();
return command; return command;
} }
@@ -2563,7 +2565,8 @@ void GitClient::updateSubmodulesIfNeeded(const QString &workingDirectory, bool p
QStringList arguments; QStringList arguments;
arguments << QLatin1String("submodule") << QLatin1String("update"); arguments << QLatin1String("submodule") << QLatin1String("update");
VcsBase::Command *cmd = executeGit(workingDirectory, arguments, 0, true, true); VcsBase::Command *cmd = executeGit(workingDirectory, arguments, 0, true,
VcsBasePlugin::ExpectRepoChanges);
connect(cmd, SIGNAL(finished(bool,int,QVariant)), this, SLOT(finishSubmoduleUpdate())); connect(cmd, SIGNAL(finished(bool,int,QVariant)), this, SLOT(finishSubmoduleUpdate()));
} }
@@ -3510,7 +3513,8 @@ void GitClient::stashPop(const QString &workingDirectory, const QString &stash)
arguments << QLatin1String("pop"); arguments << QLatin1String("pop");
if (!stash.isEmpty()) if (!stash.isEmpty())
arguments << stash; arguments << stash;
VcsBase::Command *cmd = executeGit(workingDirectory, arguments, 0, true, true); VcsBase::Command *cmd = executeGit(workingDirectory, arguments, 0, true,
VcsBasePlugin::ExpectRepoChanges);
new ConflictHandler(cmd, workingDirectory); new ConflictHandler(cmd, workingDirectory);
} }

View File

@@ -367,7 +367,7 @@ private:
const QStringList &arguments, const QStringList &arguments,
VcsBase::VcsBaseEditorWidget* editor = 0, VcsBase::VcsBaseEditorWidget* editor = 0,
bool useOutputToWindow = false, bool useOutputToWindow = false,
bool expectChanges = false, unsigned additionalFlags = 0,
int editorLineNumber = -1); int editorLineNumber = -1);
// Fully synchronous git execution (QProcess-based). // Fully synchronous git execution (QProcess-based).