VCS: Use runVcs for Command

* Removes duplication
* Supports all flags accepted by runVcs
* Supports output while running

Change-Id: Id067791760753184cd2516c23634564880ca5db0
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2013-08-13 08:37:27 +03:00
committed by Orgad Shaneh
parent cc2610aa71
commit f9c4889a7f
5 changed files with 39 additions and 94 deletions

View File

@@ -689,7 +689,7 @@ public:
m_command(command)
{
if (parentCommand) {
parentCommand->setExpectChanges(true);
parentCommand->addFlags(VcsBasePlugin::ExpectRepoChanges);
connect(parentCommand, SIGNAL(output(QString)), this, SLOT(readStdOut(QString)));
connect(parentCommand, SIGNAL(errorText(QString)), this, SLOT(readStdErr(QString)));
}
@@ -1246,16 +1246,6 @@ void GitClient::slotBlameRevisionRequested(const QString &source, QString change
blame(fi.absolutePath(), QStringList(), fi.fileName(), change, lineNumber);
}
void GitClient::appendOutput(const QString &text) const
{
outputWindow()->append(text);
}
void GitClient::appendOutputSilently(const QString &text) const
{
outputWindow()->appendSilently(text);
}
QTextCodec *GitClient::getSourceCodec(const QString &file) const
{
if (QFileInfo(file).isFile())
@@ -2233,15 +2223,13 @@ VcsBase::Command *GitClient::createCommand(const QString &workingDirectory,
if (editor)
connect(command, SIGNAL(finished(bool,int,QVariant)), editor, SLOT(commandFinishedGotoLine(bool,int,QVariant)));
if (useOutputToWindow) {
command->addFlags(VcsBasePlugin::ShowStdOutInLogWindow);
if (editor) // assume that the commands output is the important thing
connect(command, SIGNAL(output(QString)), this, SLOT(appendOutputSilently(QString)));
else
connect(command, SIGNAL(output(QString)), this, SLOT(appendOutput(QString)));
command->addFlags(VcsBasePlugin::SilentOutput);
} else if (editor) {
connect(command, SIGNAL(output(QString)), editor, SLOT(setPlainTextFiltered(QString)));
}
connect(command, SIGNAL(errorText(QString)), outputWindow(), SLOT(appendError(QString)));
return command;
}
@@ -2257,7 +2245,8 @@ VcsBase::Command *GitClient::executeGit(const QString &workingDirectory,
VcsBase::Command *command = createCommand(workingDirectory, editor, useOutputToWindow, editorLineNumber);
command->addJob(arguments, settings()->intValue(GitSettings::timeoutKey));
command->setUnixTerminalDisabled(false);
command->setExpectChanges(expectChanges);
if (expectChanges)
command->addFlags(VcsBasePlugin::ExpectRepoChanges);
command->execute();
return command;
}