Git: Make GitClient and VcsBaseClient more similar

Use the same signature for the createCommand method in both.

Change-Id: I948a9fd1af2850730736731c53ee8d1b0b9b30bc
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Tobias Hunger
2015-03-25 15:54:09 +01:00
parent f44161bb9a
commit 5c8af1a490
2 changed files with 14 additions and 11 deletions

View File

@@ -1984,21 +1984,18 @@ bool GitClient::synchronousApplyPatch(const QString &workingDirectory,
}
// Factory function to create an asynchronous command
VcsCommand *GitClient::createCommand(const QString &workingDirectory,
VcsBaseEditorWidget* editor,
bool useOutputToWindow,
int editorLineNumber)
VcsCommand *GitClient::createCommand(const QString &workingDirectory, VcsBaseEditorWidget *editor,
JobOutputBindMode mode)
{
GitEditorWidget *gitEditor = qobject_cast<GitEditorWidget *>(editor);
auto command = new VcsCommand(vcsBinary(), workingDirectory, processEnvironment());
command->setCodec(getSourceCodec(currentDocumentPath()));
command->setCookie(QVariant(editorLineNumber));
if (gitEditor) {
gitEditor->setCommand(command);
connect(command, &VcsCommand::finished,
gitEditor, &GitEditorWidget::commandFinishedGotoLine);
}
if (useOutputToWindow) {
if (mode & VcsWindowOutputBind) {
command->addFlags(VcsBasePlugin::ShowStdOutInLogWindow);
command->addFlags(VcsBasePlugin::ShowSuccessMessage);
if (editor) // assume that the commands output is the important thing
@@ -2019,7 +2016,9 @@ VcsCommand *GitClient::executeGit(const QString &workingDirectory,
int editorLineNumber)
{
VcsOutputWindow::appendCommand(workingDirectory, vcsBinary(), arguments);
VcsCommand *command = createCommand(workingDirectory, editor, useOutputToWindow, editorLineNumber);
VcsCommand *command = createCommand(workingDirectory, editor,
useOutputToWindow ? VcsWindowOutputBind : NoOutputBind);
command->setCookie(editorLineNumber);
command->addJob(arguments, vcsTimeout() * 1000);
command->addFlags(additionalFlags);
command->execute();
@@ -3134,7 +3133,7 @@ void GitClient::asyncCommand(const QString &workingDirectory, const QStringList
// and without timeout
QString gitCommand = arguments.first();
VcsOutputWindow::appendCommand(workingDirectory, settings()->binaryPath(), arguments);
VcsCommand *command = createCommand(workingDirectory, 0, true);
VcsCommand *command = createCommand(workingDirectory, 0, VcsWindowOutputBind);
new ConflictHandler(command, workingDirectory, gitCommand);
if (hasProgress)
command->setProgressParser(new GitProgressParser);