forked from qt-creator/qt-creator
VcsBase: Use static pattern for VcsBaseOutputWindow
Also rename to VcsOutputWindow. Change-Id: I79547b1154603a8c7b3604eadc5b460930c6109c Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/execmenu.h>
|
||||
#include <vcsbase/vcsbaseoutputwindow.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <coreplugin/documentmanager.h>
|
||||
|
||||
#include <QAction>
|
||||
@@ -50,6 +50,8 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
using namespace VcsBase;
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
@@ -99,7 +101,7 @@ void BranchDialog::refresh(const QString &repository, bool force)
|
||||
m_ui->repositoryLabel->setText(StashDialog::msgRepositoryLabel(m_repository));
|
||||
QString errorMessage;
|
||||
if (!m_model->refresh(m_repository, &errorMessage))
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
|
||||
m_ui->branchView->expandAll();
|
||||
}
|
||||
|
||||
@@ -31,11 +31,13 @@
|
||||
#include "gitclient.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <vcsbase/vcsbaseoutputwindow.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <vcsbase/vcsbaseplugin.h>
|
||||
|
||||
#include <QFont>
|
||||
|
||||
using namespace VcsBase;
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
@@ -310,7 +312,7 @@ bool BranchModel::setData(const QModelIndex &index, const QVariant &value, int r
|
||||
<< newFullName.last(),
|
||||
&output, &errorMessage)) {
|
||||
node->name = oldFullName.last();
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -354,7 +356,7 @@ bool BranchModel::refresh(const QString &workingDirectory, QString *errorMessage
|
||||
args << QLatin1String("--format=%(objectname)\t%(refname)\t%(upstream:short)\t%(*objectname)");
|
||||
QString output;
|
||||
if (!m_client->synchronousForEachRefCmd(workingDirectory, args, &output, errorMessage))
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(*errorMessage);
|
||||
VcsOutputWindow::appendError(*errorMessage);
|
||||
|
||||
m_workingDirectory = workingDirectory;
|
||||
const QStringList lines = output.split(QLatin1Char('\n'));
|
||||
@@ -393,7 +395,7 @@ void BranchModel::renameBranch(const QString &oldName, const QString &newName)
|
||||
if (!m_client->synchronousBranchCmd(m_workingDirectory,
|
||||
QStringList() << QLatin1String("-m") << oldName << newName,
|
||||
&output, &errorMessage))
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
else
|
||||
refresh(m_workingDirectory, &errorMessage);
|
||||
}
|
||||
@@ -407,7 +409,7 @@ void BranchModel::renameTag(const QString &oldName, const QString &newName)
|
||||
|| !m_client->synchronousTagCmd(m_workingDirectory,
|
||||
QStringList() << QLatin1String("-d") << oldName,
|
||||
&output, &errorMessage)) {
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
} else {
|
||||
refresh(m_workingDirectory, &errorMessage);
|
||||
}
|
||||
@@ -497,7 +499,7 @@ void BranchModel::removeBranch(const QModelIndex &idx)
|
||||
|
||||
args << QLatin1String("-D") << branch;
|
||||
if (!m_client->synchronousBranchCmd(m_workingDirectory, args, &output, &errorMessage)) {
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
return;
|
||||
}
|
||||
removeNode(idx);
|
||||
@@ -515,7 +517,7 @@ void BranchModel::removeTag(const QModelIndex &idx)
|
||||
|
||||
args << QLatin1String("-d") << tag;
|
||||
if (!m_client->synchronousTagCmd(m_workingDirectory, args, &output, &errorMessage)) {
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
return;
|
||||
}
|
||||
removeNode(idx);
|
||||
@@ -544,7 +546,7 @@ bool BranchModel::branchIsMerged(const QModelIndex &idx)
|
||||
|
||||
args << QLatin1String("-a") << QLatin1String("--contains") << sha(idx);
|
||||
if (!m_client->synchronousBranchCmd(m_workingDirectory, args, &output, &errorMessage))
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
|
||||
QStringList lines = output.split(QLatin1Char('\n'), QString::SkipEmptyParts);
|
||||
foreach (const QString &l, lines) {
|
||||
@@ -589,7 +591,7 @@ QModelIndex BranchModel::addBranch(const QString &name, bool track, const QModel
|
||||
}
|
||||
|
||||
if (!m_client->synchronousBranchCmd(m_workingDirectory, args, &output, &errorMessage)) {
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
#include <coreplugin/progressmanager/futureprogress.h>
|
||||
#include <vcsbase/vcsbaseoutputwindow.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <utils/synchronousprocess.h>
|
||||
|
||||
#include <QStringList>
|
||||
@@ -59,6 +59,8 @@
|
||||
|
||||
enum { debug = 0 };
|
||||
|
||||
using namespace VcsBase;
|
||||
|
||||
namespace Gerrit {
|
||||
namespace Internal {
|
||||
|
||||
@@ -314,7 +316,7 @@ void QueryContext::startQuery(const QString &query)
|
||||
{
|
||||
QStringList arguments = m_baseArguments;
|
||||
arguments.push_back(query);
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendCommand(
|
||||
VcsBase::VcsOutputWindow::appendCommand(
|
||||
m_process.workingDirectory(), Utils::FileName::fromString(m_binary), arguments);
|
||||
m_timer.start();
|
||||
m_process.start(m_binary, arguments);
|
||||
@@ -325,7 +327,7 @@ void QueryContext::errorTermination(const QString &msg)
|
||||
{
|
||||
m_progress.reportCanceled();
|
||||
m_progress.reportFinished();
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(msg);
|
||||
VcsBase::VcsOutputWindow::appendError(msg);
|
||||
emit finished();
|
||||
}
|
||||
|
||||
@@ -335,7 +337,7 @@ void QueryContext::processError(QProcess::ProcessError e)
|
||||
if (e == QProcess::FailedToStart)
|
||||
errorTermination(msg);
|
||||
else
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(msg);
|
||||
VcsBase::VcsOutputWindow::appendError(msg);
|
||||
}
|
||||
|
||||
void QueryContext::processFinished(int exitCode, QProcess::ExitStatus es)
|
||||
@@ -363,7 +365,7 @@ void QueryContext::processFinished(int exitCode, QProcess::ExitStatus es)
|
||||
|
||||
void QueryContext::readyReadStandardError()
|
||||
{
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(QString::fromLocal8Bit(m_process.readAllStandardError()));
|
||||
VcsBase::VcsOutputWindow::appendError(QString::fromLocal8Bit(m_process.readAllStandardError()));
|
||||
}
|
||||
|
||||
void QueryContext::readyReadStandardOutput()
|
||||
@@ -601,7 +603,7 @@ static bool parseOutput(const QSharedPointer<GerritParameters> ¶meters,
|
||||
.arg(QString::fromLocal8Bit(line))
|
||||
.arg(error.errorString());
|
||||
qWarning() << errorMessage;
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
|
||||
VcsBase::VcsOutputWindow::appendError(errorMessage);
|
||||
res = false;
|
||||
continue;
|
||||
}
|
||||
@@ -649,8 +651,7 @@ static bool parseOutput(const QSharedPointer<GerritParameters> ¶meters,
|
||||
result.push_back(change);
|
||||
} else {
|
||||
qWarning("%s: Parse error: '%s'.", Q_FUNC_INFO, line.constData());
|
||||
VcsBase::VcsBaseOutputWindow::instance()
|
||||
->appendError(GerritModel::tr("Parse error: \"%1\"")
|
||||
VcsOutputWindow::appendError(GerritModel::tr("Parse error: \"%1\"")
|
||||
.arg(QString::fromLocal8Bit(line)));
|
||||
res = false;
|
||||
}
|
||||
@@ -747,7 +748,7 @@ static bool parseOutput(const QSharedPointer<GerritParameters> ¶meters,
|
||||
QString errorMessage = GerritModel::tr("Parse error: \"%1\"")
|
||||
.arg(QString::fromLocal8Bit(line));
|
||||
qWarning() << errorMessage;
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
|
||||
VcsBase::VcsOutputWindow::appendError(errorMessage);
|
||||
res = false;
|
||||
continue;
|
||||
}
|
||||
@@ -817,7 +818,7 @@ static bool parseOutput(const QSharedPointer<GerritParameters> ¶meters,
|
||||
} else {
|
||||
QString errorMessage = GerritModel::tr("Parse error in line \"%1\"")
|
||||
.arg(QString::fromLocal8Bit(line));
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
|
||||
VcsBase::VcsOutputWindow::appendError(errorMessage);
|
||||
qWarning("%s: Parse error in line '%s'.", Q_FUNC_INFO, line.constData());
|
||||
res = false;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/locator/commandlocator.h>
|
||||
|
||||
#include <vcsbase/vcsbaseoutputwindow.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
|
||||
#include <utils/synchronousprocess.h>
|
||||
|
||||
@@ -178,7 +178,7 @@ void FetchContext::start()
|
||||
m_progress.reportStarted();
|
||||
// Order: initialize future before starting the process in case error handling is invoked.
|
||||
const QStringList args = m_change->gitFetchArguments(m_parameters);
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendCommand(m_repository, m_git, args);
|
||||
VcsBase::VcsOutputWindow::appendCommand(m_repository, m_git, args);
|
||||
m_process.start(m_git.toString(), args);
|
||||
m_process.closeWriteChannel();
|
||||
}
|
||||
@@ -213,21 +213,21 @@ void FetchContext::processReadyReadStandardError()
|
||||
// Note: fetch displays progress on stderr.
|
||||
const QString errorOutput = QString::fromLocal8Bit(m_process.readAllStandardError());
|
||||
if (m_state == FetchState)
|
||||
VcsBase::VcsBaseOutputWindow::instance()->append(errorOutput);
|
||||
VcsBase::VcsOutputWindow::append(errorOutput);
|
||||
else
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorOutput);
|
||||
VcsBase::VcsOutputWindow::appendError(errorOutput);
|
||||
}
|
||||
|
||||
void FetchContext::processReadyReadStandardOutput()
|
||||
{
|
||||
const QByteArray output = m_process.readAllStandardOutput();
|
||||
VcsBase::VcsBaseOutputWindow::instance()->append(QString::fromLocal8Bit(output));
|
||||
VcsBase::VcsOutputWindow::append(QString::fromLocal8Bit(output));
|
||||
}
|
||||
|
||||
void FetchContext::handleError(const QString &e)
|
||||
{
|
||||
m_state = ErrorState;
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(e);
|
||||
VcsBase::VcsOutputWindow::appendError(e);
|
||||
m_progress.reportCanceled();
|
||||
m_progress.reportFinished();
|
||||
deleteLater();
|
||||
@@ -239,7 +239,7 @@ void FetchContext::processError(QProcess::ProcessError e)
|
||||
if (e == QProcess::FailedToStart)
|
||||
handleError(msg);
|
||||
else
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(msg);
|
||||
VcsBase::VcsOutputWindow::appendError(msg);
|
||||
}
|
||||
|
||||
void FetchContext::show()
|
||||
@@ -252,7 +252,7 @@ void FetchContext::show()
|
||||
void FetchContext::cherryPick()
|
||||
{
|
||||
// Point user to errors.
|
||||
VcsBase::VcsBaseOutputWindow::instance()->popup(IOutputPane::ModeSwitch
|
||||
VcsBase::VcsOutputWindow::instance()->popup(IOutputPane::ModeSwitch
|
||||
| IOutputPane::WithFocus);
|
||||
gitClient()->synchronousCherryPick(m_repository, QLatin1String("FETCH_HEAD"));
|
||||
}
|
||||
@@ -394,7 +394,7 @@ Utils::FileName GerritPlugin::gitBinary()
|
||||
bool ok;
|
||||
const Utils::FileName git = gitClient()->gitExecutable(&ok);
|
||||
if (!ok) {
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(tr("Git is not available."));
|
||||
VcsBase::VcsOutputWindow::appendError(tr("Git is not available."));
|
||||
return Utils::FileName();
|
||||
}
|
||||
return git;
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
#include <vcsbase/command.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <vcsbase/vcsbaseeditorparameterwidget.h>
|
||||
#include <vcsbase/vcsbaseoutputwindow.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <vcsbase/vcsbaseplugin.h>
|
||||
|
||||
#include <diffeditor/diffeditorconstants.h>
|
||||
@@ -87,6 +87,7 @@ static const char noColorOption[] = "--no-color";
|
||||
static const char decorateOption[] = "--decorate";
|
||||
|
||||
using namespace Core;
|
||||
using namespace VcsBase;
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
@@ -682,11 +683,6 @@ static inline QStringList commandOutputLinesFromLocal8Bit(const QByteArray &a)
|
||||
return output.split(newLine);
|
||||
}
|
||||
|
||||
static inline VcsBase::VcsBaseOutputWindow *outputWindow()
|
||||
{
|
||||
return VcsBase::VcsBaseOutputWindow::instance();
|
||||
}
|
||||
|
||||
static inline QString msgRepositoryNotFound(const QString &dir)
|
||||
{
|
||||
return GitClient::tr("Cannot determine the repository for \"%1\".").arg(dir);
|
||||
@@ -720,7 +716,7 @@ static inline void msgCannotRun(const QString &message, QString *errorMessage)
|
||||
if (errorMessage)
|
||||
*errorMessage = message;
|
||||
else
|
||||
outputWindow()->appendError(message);
|
||||
VcsOutputWindow::appendError(message);
|
||||
}
|
||||
|
||||
static inline void msgCannotRun(const QStringList &args, const QString &workingDirectory,
|
||||
@@ -908,8 +904,6 @@ void GitClient::slotUnstageChunk()
|
||||
|
||||
void GitClient::stage(const QString &patch, bool revert)
|
||||
{
|
||||
VcsBase::VcsBaseOutputWindow *outwin =
|
||||
VcsBase::VcsBaseOutputWindow::instance();
|
||||
QTemporaryFile patchFile;
|
||||
if (!patchFile.open())
|
||||
return;
|
||||
@@ -929,15 +923,15 @@ void GitClient::stage(const QString &patch, bool revert)
|
||||
&errorMessage, args)) {
|
||||
if (errorMessage.isEmpty()) {
|
||||
if (revert)
|
||||
outwin->append(tr("Chunk successfully unstaged"));
|
||||
VcsOutputWindow::append(tr("Chunk successfully unstaged"));
|
||||
else
|
||||
outwin->append(tr("Chunk successfully staged"));
|
||||
VcsOutputWindow::append(tr("Chunk successfully staged"));
|
||||
} else {
|
||||
outwin->append(errorMessage);
|
||||
VcsOutputWindow::append(errorMessage);
|
||||
}
|
||||
m_contextController->requestReload();
|
||||
} else {
|
||||
outwin->appendError(errorMessage);
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1090,10 +1084,9 @@ void GitClient::status(const QString &workingDirectory)
|
||||
{
|
||||
QStringList statusArgs = statusArguments();
|
||||
statusArgs << QLatin1String("-u");
|
||||
VcsBase::VcsBaseOutputWindow *outwin = outputWindow();
|
||||
outwin->setRepository(workingDirectory);
|
||||
VcsOutputWindow::setRepository(workingDirectory);
|
||||
VcsBase::Command *command = executeGit(workingDirectory, statusArgs, 0, true);
|
||||
connect(command, SIGNAL(finished(bool,int,QVariant)), outwin, SLOT(clearRepository()),
|
||||
connect(command, SIGNAL(finished(bool,int,QVariant)), VcsOutputWindow::instance(), SLOT(clearRepository()),
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
@@ -1174,7 +1167,7 @@ static inline QString msgCannotShow(const QString &sha)
|
||||
void GitClient::show(const QString &source, const QString &id, const QString &name)
|
||||
{
|
||||
if (!canShow(id)) {
|
||||
outputWindow()->appendError(msgCannotShow(id));
|
||||
VcsOutputWindow::appendError(msgCannotShow(id));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1272,7 +1265,7 @@ bool GitClient::synchronousCheckout(const QString &workingDirectory,
|
||||
QStringList arguments = setupCheckoutArguments(workingDirectory, ref);
|
||||
const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText,
|
||||
VcsBasePlugin::ExpectRepoChanges);
|
||||
outputWindow()->append(commandOutputFromLocal8Bit(outputText));
|
||||
VcsOutputWindow::append(commandOutputFromLocal8Bit(outputText));
|
||||
if (!rc) {
|
||||
msgCannotRun(arguments, workingDirectory, errorText, errorMessage);
|
||||
return false;
|
||||
@@ -1453,7 +1446,7 @@ bool GitClient::synchronousReset(const QString &workingDirectory,
|
||||
arguments << QLatin1String(HEAD) << QLatin1String("--") << files;
|
||||
const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText);
|
||||
const QString output = commandOutputFromLocal8Bit(outputText);
|
||||
outputWindow()->append(output);
|
||||
VcsOutputWindow::append(output);
|
||||
// Note that git exits with 1 even if the operation is successful
|
||||
// Assume real failure if the output does not contain "foo.cpp modified"
|
||||
// or "Unstaged changes after reset" (git 1.7.0).
|
||||
@@ -1480,9 +1473,9 @@ bool GitClient::synchronousInit(const QString &workingDirectory)
|
||||
const QStringList arguments(QLatin1String("init"));
|
||||
const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText);
|
||||
// '[Re]Initialized...'
|
||||
outputWindow()->append(commandOutputFromLocal8Bit(outputText));
|
||||
VcsOutputWindow::append(commandOutputFromLocal8Bit(outputText));
|
||||
if (!rc) {
|
||||
outputWindow()->appendError(commandOutputFromLocal8Bit(errorText));
|
||||
VcsOutputWindow::appendError(commandOutputFromLocal8Bit(errorText));
|
||||
} else {
|
||||
// TODO: Turn this into a VcsBaseClient and use resetCachedVcsInfo(...)
|
||||
VcsManager::resetVersionControlForDirectory(workingDirectory);
|
||||
@@ -1849,8 +1842,7 @@ QString GitClient::synchronousShortDescription(const QString &workingDirectory,
|
||||
<< QLatin1String("--max-count=1") << revision;
|
||||
const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputTextData, &errorText);
|
||||
if (!rc) {
|
||||
VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance();
|
||||
outputWindow->appendSilently(tr("Cannot describe revision \"%1\" in \"%2\": %3")
|
||||
VcsOutputWindow::appendSilently(tr("Cannot describe revision \"%1\" in \"%2\": %3")
|
||||
.arg(revision, workingDirectory, commandOutputFromLocal8Bit(errorText)));
|
||||
return revision;
|
||||
}
|
||||
@@ -1910,10 +1902,10 @@ QString GitClient::synchronousStash(const QString &workingDirectory, const QStri
|
||||
if (unchanged)
|
||||
*unchanged = true;
|
||||
if (!(flags & StashIgnoreUnchanged))
|
||||
outputWindow()->appendWarning(msgNoChangedFiles());
|
||||
VcsOutputWindow::appendWarning(msgNoChangedFiles());
|
||||
break;
|
||||
case StatusFailed:
|
||||
outputWindow()->appendError(errorMessage);
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
break;
|
||||
}
|
||||
if (!success)
|
||||
@@ -2234,7 +2226,7 @@ VcsBase::Command *GitClient::executeGit(const QString &workingDirectory,
|
||||
unsigned additionalFlags,
|
||||
int editorLineNumber)
|
||||
{
|
||||
outputWindow()->appendCommand(workingDirectory,
|
||||
VcsOutputWindow::appendCommand(workingDirectory,
|
||||
Utils::FileName::fromUserInput(settings()->stringValue(GitSettings::binaryPathKey)),
|
||||
arguments);
|
||||
VcsBase::Command *command = createCommand(workingDirectory, editor, useOutputToWindow, editorLineNumber);
|
||||
@@ -2603,7 +2595,7 @@ void GitClient::launchGitK(const QString &workingDirectory, const QString &fileN
|
||||
return;
|
||||
|
||||
QString gitkPath = foundBinDir.path() + QLatin1String("/gitk");
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendSilently(msgCannotLaunch(gitkPath));
|
||||
VcsOutputWindow::appendSilently(msgCannotLaunch(gitkPath));
|
||||
|
||||
if (foundBinDirIsCmdDir) {
|
||||
foundBinDir.cdUp();
|
||||
@@ -2612,7 +2604,7 @@ void GitClient::launchGitK(const QString &workingDirectory, const QString &fileN
|
||||
return;
|
||||
}
|
||||
gitkPath = foundBinDir.path() + QLatin1String("/gitk");
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendSilently(msgCannotLaunch(gitkPath));
|
||||
VcsOutputWindow::appendSilently(msgCannotLaunch(gitkPath));
|
||||
}
|
||||
|
||||
Utils::Environment sysEnv = Utils::Environment::systemEnvironment();
|
||||
@@ -2623,7 +2615,7 @@ void GitClient::launchGitK(const QString &workingDirectory, const QString &fileN
|
||||
return;
|
||||
}
|
||||
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(msgCannotLaunch(QLatin1String("gitk")));
|
||||
VcsOutputWindow::appendError(msgCannotLaunch(QLatin1String("gitk")));
|
||||
}
|
||||
|
||||
void GitClient::launchRepositoryBrowser(const QString &workingDirectory)
|
||||
@@ -2648,13 +2640,12 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
|
||||
binary = wish;
|
||||
}
|
||||
}
|
||||
VcsBase::VcsBaseOutputWindow *outwin = VcsBase::VcsBaseOutputWindow::instance();
|
||||
const QString gitkOpts = settings()->stringValue(GitSettings::gitkOptionsKey);
|
||||
if (!gitkOpts.isEmpty())
|
||||
arguments.append(Utils::QtcProcess::splitArgs(gitkOpts, Utils::HostOsInfo::hostOs()));
|
||||
if (!fileName.isEmpty())
|
||||
arguments << QLatin1String("--") << fileName;
|
||||
outwin->appendCommand(workingDirectory, Utils::FileName::fromString(binary), arguments);
|
||||
VcsOutputWindow::appendCommand(workingDirectory, Utils::FileName::fromString(binary), arguments);
|
||||
// This should always use QProcess::startDetached (as not to kill
|
||||
// the child), but that does not have an environment parameter.
|
||||
bool success = false;
|
||||
@@ -2684,7 +2675,7 @@ bool GitClient::launchGitGui(const QString &workingDirectory) {
|
||||
}
|
||||
|
||||
if (!success)
|
||||
outputWindow()->appendError(msgCannotLaunch(QLatin1String("git gui")));
|
||||
VcsOutputWindow::appendError(msgCannotLaunch(QLatin1String("git gui")));
|
||||
|
||||
return success;
|
||||
}
|
||||
@@ -2991,10 +2982,10 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory,
|
||||
const bool rc = fullySynchronousGit(repositoryDirectory, args, &outputText, &errorText);
|
||||
const QString stdErr = commandOutputFromLocal8Bit(errorText);
|
||||
if (rc) {
|
||||
outputWindow()->appendMessage(msgCommitted(amendSHA1, commitCount));
|
||||
outputWindow()->appendError(stdErr);
|
||||
VcsOutputWindow::appendMessage(msgCommitted(amendSHA1, commitCount));
|
||||
VcsOutputWindow::appendError(stdErr);
|
||||
} else {
|
||||
outputWindow()->appendError(tr("Cannot commit %n file(s): %1\n", 0, commitCount).arg(stdErr));
|
||||
VcsOutputWindow::appendError(tr("Cannot commit %n file(s): %1\n", 0, commitCount).arg(stdErr));
|
||||
}
|
||||
|
||||
return rc;
|
||||
@@ -3100,11 +3091,11 @@ void GitClient::revert(const QStringList &files, bool revertStaging)
|
||||
break;
|
||||
case RevertUnchanged: {
|
||||
const QString msg = (isDirectory || files.size() > 1) ? msgNoChangedFiles() : tr("The file is not modified.");
|
||||
outputWindow()->appendWarning(msg);
|
||||
VcsOutputWindow::appendWarning(msg);
|
||||
}
|
||||
break;
|
||||
case RevertFailed:
|
||||
outputWindow()->appendError(errorMessage);
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3165,16 +3156,15 @@ void GitClient::synchronousAbortCommand(const QString &workingDir, const QString
|
||||
QStringList(), QString(), 0, false);
|
||||
return;
|
||||
}
|
||||
VcsBase::VcsBaseOutputWindow *outwin = VcsBase::VcsBaseOutputWindow::instance();
|
||||
QStringList arguments;
|
||||
arguments << abortCommand << QLatin1String("--abort");
|
||||
QByteArray stdOut;
|
||||
QByteArray stdErr;
|
||||
const bool rc = fullySynchronousGit(workingDir, arguments, &stdOut, &stdErr,
|
||||
VcsBasePlugin::ExpectRepoChanges);
|
||||
outwin->append(commandOutputFromLocal8Bit(stdOut));
|
||||
VcsOutputWindow::append(commandOutputFromLocal8Bit(stdOut));
|
||||
if (!rc)
|
||||
outwin->appendError(commandOutputFromLocal8Bit(stdErr));
|
||||
VcsOutputWindow::appendError(commandOutputFromLocal8Bit(stdErr));
|
||||
}
|
||||
|
||||
QString GitClient::synchronousTrackingBranch(const QString &workingDirectory, const QString &branch)
|
||||
@@ -3309,7 +3299,7 @@ bool GitClient::canRebase(const QString &workingDirectory) const
|
||||
const QString gitDir = findGitDirForRepository(workingDirectory);
|
||||
if (QFileInfo(gitDir + QLatin1String("/rebase-apply")).exists()
|
||||
|| QFileInfo(gitDir + QLatin1String("/rebase-merge")).exists()) {
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(
|
||||
VcsOutputWindow::appendError(
|
||||
tr("Rebase, merge or am is in progress. Finish "
|
||||
"or abort it and then try again."));
|
||||
return false;
|
||||
@@ -3340,7 +3330,7 @@ void GitClient::asyncCommand(const QString &workingDirectory, const QStringList
|
||||
// Git might request an editor, so this must be done asynchronously
|
||||
// and without timeout
|
||||
QString gitCommand = arguments.first();
|
||||
outputWindow()->appendCommand(workingDirectory, settings()->binaryPath(), arguments);
|
||||
VcsOutputWindow::appendCommand(workingDirectory, settings()->binaryPath(), arguments);
|
||||
VcsBase::Command *command = createCommand(workingDirectory, 0, true);
|
||||
new ConflictHandler(command, workingDirectory, gitCommand);
|
||||
if (hasProgress)
|
||||
@@ -3386,7 +3376,7 @@ void GitClient::interactiveRebase(const QString &workingDirectory, const QString
|
||||
if (fixup)
|
||||
arguments << QLatin1String("--autosquash");
|
||||
arguments << commit + QLatin1Char('^');
|
||||
outputWindow()->appendCommand(workingDirectory, settings()->binaryPath(), arguments);
|
||||
VcsOutputWindow::appendCommand(workingDirectory, settings()->binaryPath(), arguments);
|
||||
if (fixup)
|
||||
m_disableEditor = true;
|
||||
asyncCommand(workingDirectory, arguments, true);
|
||||
@@ -3448,7 +3438,7 @@ bool GitClient::synchronousStashRemove(const QString &workingDirectory,
|
||||
if (rc) {
|
||||
const QString output = commandOutputFromLocal8Bit(outputText);
|
||||
if (!output.isEmpty())
|
||||
outputWindow()->append(output);
|
||||
VcsOutputWindow::append(output);
|
||||
} else {
|
||||
msgCannotRun(arguments, workingDirectory, errorText, errorMessage);
|
||||
}
|
||||
@@ -3646,7 +3636,7 @@ bool GitClient::StashInfo::init(const QString &workingDirectory, const QString &
|
||||
}
|
||||
|
||||
if (m_stashResult == StashFailed)
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
return !stashingFailed();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <vcsbase/vcsbaseoutputwindow.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <texteditor/basetextdocument.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
@@ -55,6 +55,8 @@
|
||||
|
||||
#define CHANGE_PATTERN "[a-f0-9]{7,40}"
|
||||
|
||||
using namespace VcsBase;
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
@@ -255,7 +257,6 @@ void GitEditorWidget::unstageDiffChunk()
|
||||
|
||||
void GitEditorWidget::applyDiffChunk(const VcsBase::DiffChunk& chunk, bool revert)
|
||||
{
|
||||
VcsBase::VcsBaseOutputWindow *outwin = VcsBase::VcsBaseOutputWindow::instance();
|
||||
QTemporaryFile patchFile;
|
||||
if (!patchFile.open())
|
||||
return;
|
||||
@@ -272,15 +273,15 @@ void GitEditorWidget::applyDiffChunk(const VcsBase::DiffChunk& chunk, bool rever
|
||||
QString errorMessage;
|
||||
if (client->synchronousApplyPatch(baseDir, patchFile.fileName(), &errorMessage, args)) {
|
||||
if (errorMessage.isEmpty())
|
||||
outwin->append(tr("Chunk successfully staged"));
|
||||
VcsOutputWindow::append(tr("Chunk successfully staged"));
|
||||
else
|
||||
outwin->append(errorMessage);
|
||||
VcsOutputWindow::append(errorMessage);
|
||||
if (revert)
|
||||
emit diffChunkReverted(chunk);
|
||||
else
|
||||
emit diffChunkApplied(chunk);
|
||||
} else {
|
||||
outwin->appendError(errorMessage);
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,7 +341,7 @@ QStringList GitEditorWidget::annotationPreviousVersions(const QString &revision)
|
||||
// Get the SHA1's of the file.
|
||||
if (!client->synchronousParentRevisions(workingDirectory, QStringList(fi.fileName()),
|
||||
revision, &revisions, &errorMessage)) {
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendSilently(errorMessage);
|
||||
VcsOutputWindow::appendSilently(errorMessage);
|
||||
return QStringList();
|
||||
}
|
||||
return revisions;
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
#include <vcsbase/basevcssubmiteditorfactory.h>
|
||||
#include <vcsbase/vcsbaseoutputwindow.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <vcsbase/cleandialog.h>
|
||||
#include <coreplugin/locator/commandlocator.h>
|
||||
|
||||
@@ -950,7 +950,7 @@ void GitPlugin::startCommit(CommitType commitType)
|
||||
if (raiseSubmitEditor())
|
||||
return;
|
||||
if (isCommitEditorOpen()) {
|
||||
VcsBaseOutputWindow::instance()->appendWarning(tr("Another submit is currently being executed."));
|
||||
VcsOutputWindow::appendWarning(tr("Another submit is currently being executed."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -960,7 +960,7 @@ void GitPlugin::startCommit(CommitType commitType)
|
||||
QString errorMessage, commitTemplate;
|
||||
CommitData data(commitType);
|
||||
if (!m_gitClient->getCommitData(state.topLevel(), &commitTemplate, data, &errorMessage)) {
|
||||
VcsBaseOutputWindow::instance()->appendError(errorMessage);
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -974,7 +974,7 @@ void GitPlugin::startCommit(CommitType commitType)
|
||||
saver.setAutoRemove(false);
|
||||
saver.write(commitTemplate.toLocal8Bit());
|
||||
if (!saver.finalize()) {
|
||||
VcsBaseOutputWindow::instance()->appendError(saver.errorString());
|
||||
VcsOutputWindow::appendError(saver.errorString());
|
||||
return;
|
||||
}
|
||||
m_commitMessageFileName = saver.fileName();
|
||||
@@ -1261,15 +1261,14 @@ void GitPlugin::applyPatch(const QString &workingDirectory, QString file)
|
||||
}
|
||||
}
|
||||
// Run!
|
||||
VcsBaseOutputWindow *outwin = VcsBaseOutputWindow::instance();
|
||||
QString errorMessage;
|
||||
if (m_gitClient->synchronousApplyPatch(workingDirectory, file, &errorMessage)) {
|
||||
if (errorMessage.isEmpty())
|
||||
outwin->appendMessage(tr("Patch %1 successfully applied to %2").arg(file, workingDirectory));
|
||||
VcsOutputWindow::appendMessage(tr("Patch %1 successfully applied to %2").arg(file, workingDirectory));
|
||||
else
|
||||
outwin->appendError(errorMessage);
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
} else {
|
||||
outwin->appendError(errorMessage);
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
}
|
||||
m_gitClient->endStashScope(workingDirectory);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <vcsbase/submitfilemodel.h>
|
||||
#include <vcsbase/vcsbaseoutputwindow.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
@@ -46,6 +46,8 @@
|
||||
|
||||
static const char TASK_UPDATE_COMMIT[] = "Git.UpdateCommit";
|
||||
|
||||
using namespace VcsBase;
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
@@ -251,7 +253,7 @@ void GitSubmitEditor::commitDataRetrieved(bool success)
|
||||
w->setEnabled(true);
|
||||
} else {
|
||||
// Nothing to commit left!
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(m_commitDataFetcher->errorMessage());
|
||||
VcsOutputWindow::appendError(m_commitDataFetcher->errorMessage());
|
||||
m_model->clear();
|
||||
w->setEnabled(false);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "gitplugin.h"
|
||||
#include "gitclient.h"
|
||||
|
||||
#include <vcsbase/vcsbaseoutputwindow.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <vcsbase/vcsbaseplugin.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -82,7 +82,7 @@ bool LogChangeWidget::init(const QString &repository, const QString &commit, Log
|
||||
if (m_model->rowCount() > 0)
|
||||
return true;
|
||||
if (!(flags & Silent)) {
|
||||
VcsBaseOutputWindow::instance()->appendError(
|
||||
VcsOutputWindow::appendError(
|
||||
GitPlugin::instance()->gitClient()->msgNoCommits(flags & IncludeRemotes));
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -34,12 +34,14 @@
|
||||
|
||||
#include <coreplugin/documentmanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <vcsbase/vcsbaseoutputwindow.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
#include <QPushButton>
|
||||
|
||||
using namespace VcsBase;
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
@@ -47,8 +49,7 @@ class MergeToolProcess : public QProcess
|
||||
{
|
||||
public:
|
||||
MergeToolProcess(QObject *parent = 0) :
|
||||
QProcess(parent),
|
||||
m_window(VcsBase::VcsBaseOutputWindow::instance())
|
||||
QProcess(parent)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -57,19 +58,16 @@ protected:
|
||||
{
|
||||
qint64 res = QProcess::readData(data, maxlen);
|
||||
if (res > 0)
|
||||
m_window->append(QString::fromLocal8Bit(data, res));
|
||||
VcsOutputWindow::append(QString::fromLocal8Bit(data, res));
|
||||
return res;
|
||||
}
|
||||
|
||||
qint64 writeData(const char *data, qint64 len)
|
||||
{
|
||||
if (len > 0)
|
||||
m_window->append(QString::fromLocal8Bit(data, len));
|
||||
VcsOutputWindow::append(QString::fromLocal8Bit(data, len));
|
||||
return QProcess::writeData(data, len);
|
||||
}
|
||||
|
||||
private:
|
||||
VcsBase::VcsBaseOutputWindow *m_window;
|
||||
};
|
||||
|
||||
MergeTool::MergeTool(QObject *parent) :
|
||||
@@ -103,7 +101,7 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files)
|
||||
m_process = new MergeToolProcess(this);
|
||||
m_process->setWorkingDirectory(workingDirectory);
|
||||
const Utils::FileName binary = m_gitClient->gitExecutable();
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendCommand(workingDirectory, binary, arguments);
|
||||
VcsOutputWindow::appendCommand(workingDirectory, binary, arguments);
|
||||
m_process->start(binary.toString(), arguments);
|
||||
if (m_process->waitForStarted()) {
|
||||
connect(m_process, SIGNAL(finished(int)), this, SLOT(done()));
|
||||
@@ -266,13 +264,12 @@ void MergeTool::readData()
|
||||
|
||||
void MergeTool::done()
|
||||
{
|
||||
VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance();
|
||||
const QString workingDirectory = m_process->workingDirectory();
|
||||
int exitCode = m_process->exitCode();
|
||||
if (!exitCode) {
|
||||
outputWindow->appendMessage(tr("Merge tool process finished successfully."));
|
||||
VcsOutputWindow::appendMessage(tr("Merge tool process finished successfully."));
|
||||
} else {
|
||||
outputWindow->appendError(tr("Merge tool process terminated with exit code %1")
|
||||
VcsOutputWindow::appendError(tr("Merge tool process terminated with exit code %1")
|
||||
.arg(exitCode));
|
||||
}
|
||||
m_gitClient->continueCommandIfNeeded(workingDirectory, exitCode == 0);
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "ui_remoteadditiondialog.h"
|
||||
|
||||
#include <utils/headerviewstretcher.h>
|
||||
#include <vcsbase/vcsbaseoutputwindow.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
@@ -125,7 +125,7 @@ void RemoteDialog::refresh(const QString &repository, bool force)
|
||||
} else {
|
||||
QString errorMessage;
|
||||
if (!m_remoteModel->refresh(repository, &errorMessage))
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
|
||||
VcsBase::VcsOutputWindow::appendError(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user