diff options
Diffstat (limited to 'src')
29 files changed, 214 insertions, 212 deletions
diff --git a/src/plugins/bazaar/bazaarclient.cpp b/src/plugins/bazaar/bazaarclient.cpp index ff1cbd5ba8c..bf7a2a1246b 100644 --- a/src/plugins/bazaar/bazaarclient.cpp +++ b/src/plugins/bazaar/bazaarclient.cpp @@ -126,7 +126,7 @@ bool BazaarClient::synchronousUncommit(const FilePath &workingDir, << extraOptions; const CommandResult result = vcsSynchronousExec(workingDir, args); - VcsOutputWindow::append(result.cleanedStdOut()); + VcsOutputWindow::appendSilently(workingDir, result.cleanedStdOut()); return result.result() == ProcessResult::FinishedWithSuccess; } diff --git a/src/plugins/bazaar/bazaarplugin.cpp b/src/plugins/bazaar/bazaarplugin.cpp index 589c89de03d..3f72af4a603 100644 --- a/src/plugins/bazaar/bazaarplugin.cpp +++ b/src/plugins/bazaar/bazaarplugin.cpp @@ -654,7 +654,7 @@ void BazaarPluginPrivate::showCommitWidget(const QList<VcsBaseClient::StatusItem this, &BazaarPluginPrivate::showCommitWidget); if (status.isEmpty()) { - VcsOutputWindow::appendError(Tr::tr("There are no changes to commit.")); + VcsOutputWindow::appendError(m_submitRepository, Tr::tr("There are no changes to commit.")); return; } @@ -663,20 +663,20 @@ void BazaarPluginPrivate::showCommitWidget(const QList<VcsBaseClient::StatusItem // Keep the file alive, else it removes self and forgets its name saver.setAutoRemove(false); if (const Result<> res = saver.finalize(); !res) { - VcsOutputWindow::appendError(res.error()); + VcsOutputWindow::appendError(m_submitRepository, res.error()); return; } IEditor *editor = EditorManager::openEditor(saver.filePath(), COMMIT_ID); if (!editor) { - VcsOutputWindow::appendError(Tr::tr("Unable to create an editor for the commit.")); + VcsOutputWindow::appendError(m_submitRepository, Tr::tr("Unable to create an editor for the commit.")); return; } auto commitEditor = qobject_cast<CommitEditor *>(editor); if (!commitEditor) { - VcsOutputWindow::appendError(Tr::tr("Unable to create a commit editor.")); + VcsOutputWindow::appendError(m_submitRepository, Tr::tr("Unable to create a commit editor.")); return; } setSubmitEditor(commitEditor); diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp index c00151a79f3..b2c71df3219 100644 --- a/src/plugins/clearcase/clearcaseplugin.cpp +++ b/src/plugins/clearcase/clearcaseplugin.cpp @@ -1193,7 +1193,7 @@ void ClearCasePluginPrivate::ccDiffWithPred(const FilePath &workingDir, const QS return; // done here, diff is opened in a new window } if (!m_settings.extDiffAvailable) { - VcsOutputWindow::appendError(Tr::tr("External diff is required to compare multiple files.")); + VcsOutputWindow::appendError(workingDir, Tr::tr("External diff is required to compare multiple files.")); return; } QString result; @@ -1249,11 +1249,11 @@ void ClearCasePluginPrivate::diffActivity() QTC_ASSERT(state.hasTopLevel(), return); if (Constants::debug) qDebug() << Q_FUNC_INFO; + const FilePath topLevel = state.topLevel(); if (!m_settings.extDiffAvailable) { - VcsOutputWindow::appendError(Tr::tr("External diff is required to compare multiple files.")); + VcsOutputWindow::appendError(topLevel, Tr::tr("External diff is required to compare multiple files.")); return; } - FilePath topLevel = state.topLevel(); const QString activity = QInputDialog::getText(ICore::dialogParent(), Tr::tr("Enter Activity"), Tr::tr("Activity Name"), QLineEdit::Normal, m_activity); if (activity.isEmpty()) @@ -1388,13 +1388,13 @@ void ClearCasePluginPrivate::startCheckIn(const FilePath &workingDir, const QStr return; if (isCheckInEditorOpen()) { - VcsOutputWindow::appendWarning(Tr::tr("Another check in is currently being executed.")); + VcsOutputWindow::appendWarning(workingDir, Tr::tr("Another check in is currently being executed.")); return; } // Get list of added/modified/deleted files if (files.empty()) { - VcsOutputWindow::appendWarning(Tr::tr("There are no modified files.")); + VcsOutputWindow::appendWarning(workingDir, Tr::tr("There are no modified files.")); return; } // Create a new submit change file containing the submit template @@ -1406,7 +1406,7 @@ void ClearCasePluginPrivate::startCheckIn(const FilePath &workingDir, const QStr // Create a submit saver.write(submitTemplate.toUtf8()); if (const Result<> res = saver.finalize(); !res) { - VcsOutputWindow::appendError(res.error()); + VcsOutputWindow::appendError(workingDir, res.error()); return; } m_checkInMessageFilePath = saver.filePath(); @@ -1476,9 +1476,8 @@ void ClearCasePluginPrivate::viewStatus() if (m_viewData.name.isEmpty()) m_viewData = ccGetView(m_topLevel); QTC_ASSERT(!m_viewData.name.isEmpty() && !m_settings.disableIndexer, return); - VcsOutputWindow::append(QLatin1String("Indexed files status (C=Checked Out, " - "H=Hijacked, ?=Missing)"), - VcsOutputWindow::Command, true); + VcsOutputWindow::appendMessage(m_topLevel, "Indexed files status (C=Checked Out, " + "H=Hijacked, ?=Missing)"); bool anymod = false; for (StatusMap::ConstIterator it = m_statusMap->constBegin(); it != m_statusMap->constEnd(); @@ -1492,14 +1491,14 @@ void ClearCasePluginPrivate::viewStatus() default: break; } if (cstat) { - VcsOutputWindow::append(QString::fromLatin1("%1 %2\n") + VcsOutputWindow::appendSilently(m_topLevel, QString::fromLatin1("%1 %2\n") .arg(cstat) .arg(QDir::toNativeSeparators(it.key()))); anymod = true; } } if (!anymod) - VcsOutputWindow::appendWarning(QLatin1String("No modified files found.")); + VcsOutputWindow::appendWarning(m_topLevel, QLatin1String("No modified files found.")); } void ClearCasePluginPrivate::ccUpdate(const FilePath &workingDir, const QStringList &relativePaths) @@ -1762,8 +1761,8 @@ bool ClearCasePluginPrivate::vcsOpen(const FilePath &workingDir, const QString & result = runCleartool(topLevel, args, RunFlags::ShowStdOut); } } else { - VcsOutputWindow::append(result.cleanedStdOut()); - VcsOutputWindow::appendError(result.cleanedStdErr()); + VcsOutputWindow::appendSilently(topLevel, result.cleanedStdOut()); + VcsOutputWindow::appendError(topLevel, result.cleanedStdErr()); } } diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index 27d67e431d0..b5beeecbe68 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -672,7 +672,7 @@ void CvsPluginPrivate::vcsDescribe(const FilePath &source, const QString &change { QString errorMessage; if (!describe(source.toUrlishString(), changeNr, &errorMessage)) - VcsOutputWindow::appendError(errorMessage); + VcsOutputWindow::appendError(source, errorMessage); }; bool CvsPluginPrivate::activateCommit() @@ -873,7 +873,7 @@ void CvsPluginPrivate::startCommit(const FilePath &workingDir, const QString &fi if (raiseSubmitEditor()) return; if (isCommitEditorOpen()) { - VcsOutputWindow::appendWarning(Tr::tr("Another commit is currently being executed.")); + VcsOutputWindow::appendWarning(workingDir, Tr::tr("Another commit is currently being executed.")); return; } @@ -894,7 +894,7 @@ void CvsPluginPrivate::startCommit(const FilePath &workingDir, const QString &fi } } if (statusOutput.empty()) { - VcsOutputWindow::appendWarning(Tr::tr("There are no modified files.")); + VcsOutputWindow::appendWarning(workingDir, Tr::tr("There are no modified files.")); return; } m_commitRepository = workingDir; @@ -907,7 +907,7 @@ void CvsPluginPrivate::startCommit(const FilePath &workingDir, const QString &fi // Create a submit saver.write(submitTemplate.toUtf8()); if (const Result<> res = saver.finalize(); !res) { - VcsOutputWindow::appendError(res.error()); + VcsOutputWindow::appendError(m_commitRepository, res.error()); return; } m_commitMessageFileName = saver.filePath().toUrlishString(); diff --git a/src/plugins/fossil/fossilclient.cpp b/src/plugins/fossil/fossilclient.cpp index 267c1d37252..ab88d8f5794 100644 --- a/src/plugins/fossil/fossilclient.cpp +++ b/src/plugins/fossil/fossilclient.cpp @@ -579,14 +579,14 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory, CommandResult result = vcsSynchronousExec(workingDirectory, args); if (result.result() != ProcessResult::FinishedWithSuccess) return false; - outputWindow->append(sanitizeFossilOutput(result.cleanedStdOut())); + outputWindow->appendSilently(workingDirectory, sanitizeFossilOutput(result.cleanedStdOut())); // check out the created repository file into the working directory // --force as it may be not empty e.g. when creating a project from wizard result = vcsSynchronousExec(workingDirectory, {"open", "--force", repoFilePath.toUserOutput()}); if (result.result() != ProcessResult::FinishedWithSuccess) return false; - outputWindow->append(sanitizeFossilOutput(result.cleanedStdOut())); + outputWindow->appendSilently(workingDirectory, sanitizeFossilOutput(result.cleanedStdOut())); // set user default to admin if specified if (!adminUser.isEmpty()) { @@ -594,7 +594,7 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory, {"user", "default", adminUser, "--user", adminUser}); if (result.result() != ProcessResult::FinishedWithSuccess) return false; - outputWindow->append(sanitizeFossilOutput(result.cleanedStdOut())); + outputWindow->appendSilently(workingDirectory, sanitizeFossilOutput(result.cleanedStdOut())); } resetCachedVcsInfo(workingDirectory); diff --git a/src/plugins/fossil/fossilplugin.cpp b/src/plugins/fossil/fossilplugin.cpp index 219fcc4cdfd..9225685e82c 100644 --- a/src/plugins/fossil/fossilplugin.cpp +++ b/src/plugins/fossil/fossilplugin.cpp @@ -549,7 +549,7 @@ bool FossilPluginPrivate::pullOrPush(FossilPluginPrivate::SyncMode mode) QString remoteLocation(dialog.remoteLocation()); if (remoteLocation.isEmpty() && defaultURL.isEmpty()) { - VcsOutputWindow::appendError(Tr::tr("Remote repository is not defined.")); + VcsOutputWindow::appendError(state.topLevel(), Tr::tr("Remote repository is not defined.")); return false; } else if (remoteLocation == defaultURL) { remoteLocation.clear(); @@ -621,7 +621,7 @@ void FossilPluginPrivate::showCommitWidget(const QList<VcsBaseClient::StatusItem this, &FossilPluginPrivate::showCommitWidget); if (status.isEmpty()) { - VcsOutputWindow::appendError(Tr::tr("There are no changes to commit.")); + VcsOutputWindow::appendError({}, Tr::tr("There are no changes to commit.")); return; } @@ -630,20 +630,20 @@ void FossilPluginPrivate::showCommitWidget(const QList<VcsBaseClient::StatusItem // Keep the file alive, else it removes self and forgets its name saver.setAutoRemove(false); if (const Result<> res = saver.finalize(); !res) { - VcsOutputWindow::appendError(res.error()); + VcsOutputWindow::appendError({}, res.error()); return; } IEditor *editor = EditorManager::openEditor(saver.filePath(), Constants::COMMIT_ID); if (!editor) { - VcsOutputWindow::appendError(Tr::tr("Unable to create an editor for the commit.")); + VcsOutputWindow::appendError({}, Tr::tr("Unable to create an editor for the commit.")); return; } CommitEditor *commitEditor = qobject_cast<CommitEditor *>(editor); if (!commitEditor) { - VcsOutputWindow::appendError(Tr::tr("Unable to create a commit editor.")); + VcsOutputWindow::appendError({}, Tr::tr("Unable to create a commit editor.")); return; } setSubmitEditor(commitEditor); diff --git a/src/plugins/git/branchmodel.cpp b/src/plugins/git/branchmodel.cpp index 58296821772..be6f359dd8c 100644 --- a/src/plugins/git/branchmodel.cpp +++ b/src/plugins/git/branchmodel.cpp @@ -559,7 +559,7 @@ void BranchModel::refresh(const FilePath &workingDirectory, ShowError showError) .arg("git for-each-ref") .arg(workingDirectory.toUserOutput()) .arg(process.cleanedStdErr()); - VcsBase::VcsOutputWindow::appendError(message); + VcsBase::VcsOutputWindow::appendError(workingDirectory, message); return; } const QString output = process.stdOut(); @@ -614,7 +614,7 @@ void BranchModel::renameBranch(const QString &oldName, const QString &newName) QString output; if (!gitClient().synchronousBranchCmd(d->workingDirectory, {"-m", oldName, newName}, &output, &errorMessage)) - VcsOutputWindow::appendError(errorMessage); + VcsOutputWindow::appendError(d->workingDirectory, errorMessage); else refresh(d->workingDirectory); } @@ -627,7 +627,7 @@ void BranchModel::renameTag(const QString &oldName, const QString &newName) &output, &errorMessage) || !gitClient().synchronousTagCmd(d->workingDirectory, {"-d", oldName}, &output, &errorMessage)) { - VcsOutputWindow::appendError(errorMessage); + VcsOutputWindow::appendError(d->workingDirectory, errorMessage); } else { refresh(d->workingDirectory); } @@ -753,7 +753,7 @@ void BranchModel::removeBranch(const QModelIndex &idx) if (!gitClient().synchronousBranchCmd(d->workingDirectory, {"-D", branch}, &output, &errorMessage)) { qCWarning(modelLog) << "removeBranch: git branch delete failed:" << errorMessage; - VcsOutputWindow::appendError(errorMessage); + VcsOutputWindow::appendError(d->workingDirectory, errorMessage); return; } qCDebug(modelLog) << "removeBranch: branch deleted successfully:" << branch; @@ -774,7 +774,7 @@ void BranchModel::removeTag(const QModelIndex &idx) if (!gitClient().synchronousTagCmd(d->workingDirectory, {"-d", tag}, &output, &errorMessage)) { qCWarning(modelLog) << "removeTag: git tag delete failed:" << errorMessage; - VcsOutputWindow::appendError(errorMessage); + VcsOutputWindow::appendError(d->workingDirectory, errorMessage); return; } qCDebug(modelLog) << "removeTag: tag deleted successfully:" << tag; @@ -813,7 +813,7 @@ bool BranchModel::branchIsMerged(const QModelIndex &idx) if (!gitClient().synchronousBranchCmd(d->workingDirectory, {"-a", "--contains", hash(idx)}, &output, &errorMessage)) { qCWarning(modelLog) << "branchIsMerged: git branch contains failed:" << errorMessage; - VcsOutputWindow::appendError(errorMessage); + VcsOutputWindow::appendError(d->workingDirectory, errorMessage); } const QStringList lines = output.split('\n', Qt::SkipEmptyParts); @@ -882,7 +882,7 @@ QModelIndex BranchModel::addBranch(const QString &name, bool track, const QModel if (!gitClient().synchronousBranchCmd(d->workingDirectory, args, &output, &errorMessage)) { qCWarning(modelLog) << "addBranch: git branch creation failed:" << errorMessage; - VcsOutputWindow::appendError(errorMessage); + VcsOutputWindow::appendError(d->workingDirectory, errorMessage); return {}; } diff --git a/src/plugins/git/gerrit/gerritmodel.cpp b/src/plugins/git/gerrit/gerritmodel.cpp index 056c5cf617e..d37d46c1dd0 100644 --- a/src/plugins/git/gerrit/gerritmodel.cpp +++ b/src/plugins/git/gerrit/gerritmodel.cpp @@ -255,7 +255,7 @@ QueryContext::QueryContext(const QString &query, } connect(&m_process, &Process::readyReadStandardError, this, [this] { const QString text = QString::fromLocal8Bit(m_process.readAllRawStandardError()); - VcsOutputWindow::appendError(text); + VcsOutputWindow::appendError(m_process.workingDirectory(), text); m_error.append(text); }); connect(&m_process, &Process::readyReadStandardOutput, this, [this] { @@ -304,7 +304,7 @@ void QueryContext::processDone() if (m_process.result() == ProcessResult::FinishedWithSuccess) emit resultRetrieved(m_output); else if (m_process.result() != ProcessResult::Canceled) - VcsOutputWindow::appendError(m_process.exitMessage()); + VcsOutputWindow::appendError(m_process.workingDirectory(), m_process.exitMessage()); emit finished(); } @@ -753,7 +753,7 @@ static bool parseOutput(const GerritServer &server, const QString errorMessage = Git::Tr::tr("Parse error: \"%1\" -> %2") .arg(QString::fromUtf8(output), error.errorString()); qWarning() << errorMessage; - VcsOutputWindow::appendError(errorMessage); + VcsOutputWindow::appendError({}, errorMessage); res = false; } const QJsonArray rootArray = doc.array(); @@ -774,7 +774,7 @@ static bool parseOutput(const GerritServer &server, } else { const QByteArray jsonObject = QJsonDocument(object).toJson(); qWarning("%s: Parse error: '%s'.", Q_FUNC_INFO, jsonObject.constData()); - VcsOutputWindow::appendError(Git::Tr::tr("Parse error: \"%1\"") + VcsOutputWindow::appendError({}, Git::Tr::tr("Parse error: \"%1\"") .arg(QString::fromUtf8(jsonObject))); res = false; } diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp index 0222f2b91ce..373014d2a5e 100644 --- a/src/plugins/git/gerrit/gerritplugin.cpp +++ b/src/plugins/git/gerrit/gerritplugin.cpp @@ -95,11 +95,13 @@ FetchContext::FetchContext(const std::shared_ptr<GerritChange> &change, { m_process.setUseCtrlCStub(true); connect(&m_process, &Process::done, this, &FetchContext::processDone); - connect(&m_process, &Process::readyReadStandardError, this, [this] { - VcsBase::VcsOutputWindow::append(QString::fromLocal8Bit(m_process.readAllRawStandardError())); + connect(&m_process, &Process::readyReadStandardError, this, [this, repository] { + VcsBase::VcsOutputWindow::appendSilently( + repository, QString::fromLocal8Bit(m_process.readAllRawStandardError())); }); - connect(&m_process, &Process::readyReadStandardOutput, this, [this] { - VcsBase::VcsOutputWindow::append(QString::fromLocal8Bit(m_process.readAllRawStandardOutput())); + connect(&m_process, &Process::readyReadStandardOutput, this, [this, repository] { + VcsBase::VcsOutputWindow::appendSilently( + repository, QString::fromLocal8Bit(m_process.readAllRawStandardOutput())); }); m_process.setWorkingDirectory(repository); m_process.setEnvironment(gitClient().processEnvironment(repository)); @@ -121,7 +123,7 @@ void FetchContext::processDone() if (m_process.result() != ProcessResult::FinishedWithSuccess) { if (m_process.result() != ProcessResult::Canceled) - VcsBase::VcsOutputWindow::appendError(m_process.exitMessage()); + VcsBase::VcsOutputWindow::appendError(m_repository, m_process.exitMessage()); return; } @@ -269,7 +271,7 @@ void GerritPlugin::fetch(const std::shared_ptr<GerritChange> &change, int mode) // Locate git. const Utils::FilePath git = gitClient().vcsBinary(m_dialog->repositoryPath()); if (git.isEmpty()) { - VcsBase::VcsOutputWindow::appendError(Git::Tr::tr("Git is not available.")); + VcsBase::VcsOutputWindow::appendError({}, Git::Tr::tr("Git is not available.")); return; } diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 62ed934ed20..24c51214791 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -122,15 +122,15 @@ static void stage(DiffEditorController *diffController, const QString &patch, bo &errorMessage, args)) { if (errorMessage.isEmpty()) { if (revert) - VcsOutputWindow::appendSilently(Tr::tr("Chunk successfully unstaged")); + VcsOutputWindow::appendSilently(baseDir, Tr::tr("Chunk successfully unstaged")); else - VcsOutputWindow::appendSilently(Tr::tr("Chunk successfully staged")); + VcsOutputWindow::appendSilently(baseDir, Tr::tr("Chunk successfully staged")); } else { - VcsOutputWindow::appendError(errorMessage); + VcsOutputWindow::appendError(baseDir, errorMessage); } diffController->requestReload(); } else { - VcsOutputWindow::appendError(errorMessage); + VcsOutputWindow::appendError(baseDir, errorMessage); } } @@ -759,12 +759,13 @@ static QString msgCannotLaunch(const FilePath &binary) return Tr::tr("Cannot launch \"%1\".").arg(binary.toUserOutput()); } -static inline void msgCannotRun(const QString &message, QString *errorMessage) +static inline void msgCannotRun(const FilePath &workingDirectory, const QString &message, + QString *errorMessage) { if (errorMessage) *errorMessage = message; else - VcsOutputWindow::appendError(message); + VcsOutputWindow::appendError(workingDirectory, message); } static inline void msgCannotRun(const QStringList &args, const FilePath &workingDirectory, @@ -775,7 +776,7 @@ static inline void msgCannotRun(const QStringList &args, const FilePath &working workingDirectory.toUserOutput(), error); - msgCannotRun(message, errorMessage); + msgCannotRun(workingDirectory, message, errorMessage); } // ---------------- GitClient @@ -1248,14 +1249,14 @@ static inline QString msgCannotShow(const QString &hash) void GitClient::show(const FilePath &source, const QString &id, const QString &name) { + FilePath workingDirectory = source.isDir() ? source.absoluteFilePath() : source.absolutePath(); + if (!canShow(id)) { - VcsOutputWindow::appendError(msgCannotShow(id)); + VcsOutputWindow::appendError(workingDirectory, msgCannotShow(id)); return; } const QString title = Tr::tr("Git Show \"%1\"").arg(name.isEmpty() ? id : name); - FilePath workingDirectory = - source.isDir() ? source.absoluteFilePath() : source.absolutePath(); const FilePath repoDirectory = VcsManager::findTopLevelForDirectory(workingDirectory); if (!repoDirectory.isEmpty()) workingDirectory = repoDirectory; @@ -1482,12 +1483,12 @@ void GitClient::recoverDeletedFiles(const FilePath &workingDirectory) if (result.result() == ProcessResult::FinishedWithSuccess) { const QString stdOut = result.cleanedStdOut().trimmed(); if (stdOut.isEmpty()) { - VcsOutputWindow::appendError(Tr::tr("Nothing to recover")); + VcsOutputWindow::appendError(workingDirectory, Tr::tr("Nothing to recover")); return; } const QStringList files = stdOut.split('\n'); synchronousCheckoutFiles(workingDirectory, files, QString(), nullptr, false); - VcsOutputWindow::append(Tr::tr("Files recovered"), VcsOutputWindow::Message); + VcsOutputWindow::appendMessage(workingDirectory, Tr::tr("Files recovered")); } } @@ -1510,7 +1511,7 @@ Result<QString> GitClient::synchronousLog(const FilePath &workingDirectory, return result.cleanedStdOut(); QString errorMessage; - msgCannotRun(Tr::tr("Cannot obtain log of \"%1\": %2") + msgCannotRun(workingDirectory, Tr::tr("Cannot obtain log of \"%1\": %2") .arg(workingDirectory.toUserOutput(), result.cleanedStdErr()), &errorMessage); return ResultError(errorMessage); } @@ -1560,7 +1561,7 @@ bool GitClient::synchronousReset(const FilePath &workingDirectory, const CommandResult result = vcsSynchronousExec(workingDirectory, arguments); const QString stdOut = result.cleanedStdOut(); - VcsOutputWindow::append(stdOut); + VcsOutputWindow::appendSilently(workingDirectory, stdOut); // 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). @@ -1569,8 +1570,9 @@ bool GitClient::synchronousReset(const FilePath &workingDirectory, if (files.isEmpty()) { msgCannotRun(arguments, workingDirectory, result.cleanedStdErr(), errorMessage); } else { - msgCannotRun(Tr::tr("Cannot reset %n files in \"%1\": %2", nullptr, files.size()) - .arg(workingDirectory.toUserOutput(), result.cleanedStdErr()), + msgCannotRun(workingDirectory, + Tr::tr("Cannot reset %n files in \"%1\": %2", nullptr, files.size()) + .arg(workingDirectory.toUserOutput(), result.cleanedStdErr()), errorMessage); } return false; @@ -1583,7 +1585,7 @@ bool GitClient::synchronousInit(const FilePath &workingDirectory) { const CommandResult result = vcsSynchronousExec(workingDirectory, QStringList{"init"}); // '[Re]Initialized...' - VcsOutputWindow::append(result.cleanedStdOut()); + VcsOutputWindow::appendSilently(workingDirectory, result.cleanedStdOut()); if (result.result() == ProcessResult::FinishedWithSuccess) { resetCachedVcsInfo(workingDirectory); return true; @@ -1611,7 +1613,7 @@ bool GitClient::synchronousAddGitignore(const FilePath &workingDirectory) Core::GeneratedFile gitIgnoreFile(gitIgnoreDestination); gitIgnoreFile.setBinaryContents(gitIgnoreTemplate.fileContents().value()); if (const Result<> res = gitIgnoreFile.write(); !res) { - VcsOutputWindow::appendError(res.error()); + VcsOutputWindow::appendError(workingDirectory, res.error()); return false; } @@ -1642,7 +1644,7 @@ bool GitClient::synchronousCheckoutFiles(const FilePath &workingDirectory, QStri const QString fileArg = files.join(", "); //: Meaning of the arguments: %1: revision, %2: files, %3: repository, //: %4: Error message - msgCannotRun(Tr::tr("Cannot checkout \"%1\" of %2 in \"%3\": %4") + msgCannotRun(workingDirectory, Tr::tr("Cannot checkout \"%1\" of %2 in \"%3\": %4") .arg(revision, fileArg, workingDirectory.toUserOutput(), result.cleanedStdErr()), errorMessage); return false; @@ -1881,8 +1883,9 @@ QString GitClient::synchronousShortDescription(const FilePath &workingDirectory, "--max-count=1", revision}; const CommandResult result = vcsSynchronousExec(workingDirectory, arguments, RunFlags::NoOutput); if (result.result() != ProcessResult::FinishedWithSuccess) { - VcsOutputWindow::appendSilently(Tr::tr("Cannot describe revision \"%1\" in \"%2\": %3") - .arg(revision, workingDirectory.toUserOutput(), result.cleanedStdErr())); + VcsOutputWindow::appendSilently(workingDirectory, + Tr::tr("Cannot describe revision \"%1\" in \"%2\": %3") + .arg(revision, workingDirectory.toUserOutput(), result.cleanedStdErr())); return revision; } return stripLastNewline(result.cleanedStdOut()); @@ -1935,10 +1938,10 @@ QString GitClient::synchronousStash(const FilePath &workingDirectory, const QStr if (unchanged) *unchanged = true; if (!(flags & StashIgnoreUnchanged)) - VcsOutputWindow::appendWarning(msgNoChangedFiles()); + VcsOutputWindow::appendWarning(workingDirectory, msgNoChangedFiles()); break; case StatusFailed: - VcsOutputWindow::appendError(errorMessage); + VcsOutputWindow::appendError(workingDirectory, errorMessage); break; } if (!success) @@ -1979,7 +1982,7 @@ static QString stashNameFromMessage(const FilePath &workingDirectory, const QStr return stash.name; } //: Look-up of a stash via its descriptive message failed. - msgCannotRun(Tr::tr("Cannot resolve stash message \"%1\" in \"%2\".") + msgCannotRun(workingDirectory, Tr::tr("Cannot resolve stash message \"%1\" in \"%2\".") .arg(message, workingDirectory.toUserOutput()), nullptr); return {}; } @@ -2044,7 +2047,7 @@ QMap<QString,QString> GitClient::synchronousRemotesList(const FilePath &workingD QString output; QString error; if (!synchronousRemoteCmd(workingDirectory, {"-v"}, &output, &error, true)) { - msgCannotRun(error, errorMessage); + msgCannotRun(workingDirectory, error, errorMessage); return result; } @@ -2070,7 +2073,7 @@ QStringList GitClient::synchronousSubmoduleStatus(const FilePath &workingDirecto RunFlags::NoOutput); if (result.result() != ProcessResult::FinishedWithSuccess) { - msgCannotRun(Tr::tr("Cannot retrieve submodule status of \"%1\": %2") + msgCannotRun(workingDirectory, Tr::tr("Cannot retrieve submodule status of \"%1\": %2") .arg(workingDirectory.toUserOutput(), result.cleanedStdErr()), errorMessage); return {}; } @@ -2143,7 +2146,7 @@ QByteArray GitClient::synchronousShow(const FilePath &workingDirectory, const QS RunFlags flags) const { if (!canShow(id)) { - VcsOutputWindow::appendError(msgCannotShow(id)); + VcsOutputWindow::appendError(workingDirectory, msgCannotShow(id)); return {}; } const QStringList arguments = {"show", decorateOption, noColorOption, "--no-patch", id}; @@ -2592,7 +2595,7 @@ void GitClient::handleGitKFailedToStart(const Environment &env, const FilePath &oldGitBinDir) const { QTC_ASSERT(oldTrial != None, return); - VcsOutputWindow::appendSilently(msgCannotLaunch(oldGitBinDir / "gitk")); + VcsOutputWindow::appendSilently(workingDirectory, msgCannotLaunch(oldGitBinDir / "gitk")); GitKLaunchTrial nextTrial = None; @@ -2604,7 +2607,7 @@ void GitClient::handleGitKFailedToStart(const Environment &env, } if (nextTrial == None) { - VcsOutputWindow::appendError(msgCannotLaunch("gitk")); + VcsOutputWindow::appendError(workingDirectory, msgCannotLaunch("gitk")); return; } @@ -2616,7 +2619,7 @@ bool GitClient::launchGitGui(const FilePath &workingDirectory) const QString cannotLaunchGitGui = msgCannotLaunch("git gui"); FilePath gitBinary = vcsBinary(workingDirectory); if (gitBinary.isEmpty()) { - VcsOutputWindow::appendError(cannotLaunchGitGui); + VcsOutputWindow::appendError(workingDirectory, cannotLaunchGitGui); return false; } @@ -2626,8 +2629,8 @@ bool GitClient::launchGitGui(const FilePath &workingDirectory) connect(process, &Process::done, this, [process, cannotLaunchGitGui] { if (process->result() != ProcessResult::FinishedWithSuccess) { const QString errorMessage = process->readAllStandardError(); - VcsOutputWindow::appendError(cannotLaunchGitGui); - VcsOutputWindow::appendError(errorMessage); + VcsOutputWindow::appendError(process->workingDirectory(), cannotLaunchGitGui); + VcsOutputWindow::appendError(process->workingDirectory(), errorMessage); process->deleteLater(); } }); @@ -2675,7 +2678,7 @@ bool GitClient::launchGitBash(const FilePath &workingDirectory) } if (!success) - VcsOutputWindow::appendError(msgCannotLaunch("git-bash")); + VcsOutputWindow::appendError(workingDirectory, msgCannotLaunch("git-bash")); return success; } @@ -2973,11 +2976,12 @@ bool GitClient::addAndCommit(const FilePath &repositoryDirectory, const CommandResult result = vcsSynchronousExec(repositoryDirectory, arguments, RunFlags::UseEventLoop); if (result.result() == ProcessResult::FinishedWithSuccess) { - VcsOutputWindow::appendMessage(msgCommitted(amendHash, commitCount)); + VcsOutputWindow::appendMessage(repositoryDirectory, msgCommitted(amendHash, commitCount)); updateCurrentBranch(); return true; } - VcsOutputWindow::appendError(Tr::tr("Cannot commit %n file(s).", nullptr, commitCount) + "\n"); + VcsOutputWindow::appendError(repositoryDirectory, + Tr::tr("Cannot commit %n file(s).", nullptr, commitCount) + "\n"); return false; } @@ -3004,7 +3008,8 @@ void GitClient::formatPatch(const Utils::FilePath &workingDirectory, const QStri GitClient::RevertResult GitClient::revertI(QStringList files, bool *ptrToIsDirectory, QString *errorMessage, - bool revertStaging) + bool revertStaging, + FilePath *repository) { if (files.empty()) return RevertCanceled; @@ -3018,6 +3023,7 @@ GitClient::RevertResult GitClient::revertI(QStringList files, FilePath::fromString(isDirectory ? firstFile.absoluteFilePath() : firstFile.absolutePath()); const FilePath repoDirectory = VcsManager::findTopLevelForDirectory(workingDirectory); + *repository = repoDirectory; if (repoDirectory.isEmpty()) { *errorMessage = msgRepositoryNotFound(workingDirectory); return RevertFailed; @@ -3089,7 +3095,8 @@ void GitClient::revertFiles(const QStringList &files, bool revertStaging) { bool isDirectory; QString errorMessage; - switch (revertI(files, &isDirectory, &errorMessage, revertStaging)) { + FilePath repository; + switch (revertI(files, &isDirectory, &errorMessage, revertStaging, &repository)) { case RevertOk: emitFilesChanged(files); break; @@ -3097,11 +3104,11 @@ void GitClient::revertFiles(const QStringList &files, bool revertStaging) break; case RevertUnchanged: { const QString msg = (isDirectory || files.size() > 1) ? msgNoChangedFiles() : Tr::tr("The file is not modified."); - VcsOutputWindow::appendWarning(msg); + VcsOutputWindow::appendWarning(repository, msg); } break; case RevertFailed: - VcsOutputWindow::appendError(errorMessage); + VcsOutputWindow::appendError(repository, errorMessage); break; } } @@ -3160,7 +3167,7 @@ void GitClient::synchronousAbortCommand(const FilePath &workingDir, const QStrin const CommandResult result = vcsSynchronousExec(workingDir, {abortCommand, "--abort"}, RunFlags::ExpectRepoChanges | RunFlags::ShowSuccessMessage); - VcsOutputWindow::append(result.cleanedStdOut()); + VcsOutputWindow::appendSilently(workingDir, result.cleanedStdOut()); } QString GitClient::synchronousTrackingBranch(const FilePath &workingDirectory, const QString &branch) @@ -3364,7 +3371,7 @@ bool GitClient::canRebase(const FilePath &workingDirectory) const const FilePath gitDir = findGitDirForRepository(workingDirectory); if (gitDir.pathAppended("rebase-apply").exists() || gitDir.pathAppended("rebase-merge").exists()) { - VcsOutputWindow::appendError( + VcsOutputWindow::appendError(workingDirectory, Tr::tr("Rebase, merge or am is in progress. Finish " "or abort it and then try again.")); return false; @@ -3498,7 +3505,7 @@ bool GitClient::synchronousStashRemove(const FilePath &workingDirectory, const Q if (result.result() == ProcessResult::FinishedWithSuccess) { const QString output = result.cleanedStdOut(); if (!output.isEmpty()) - VcsOutputWindow::append(output); + VcsOutputWindow::appendSilently(workingDirectory, output); return true; } msgCannotRun(arguments, workingDirectory, result.cleanedStdErr(), errorMessage); @@ -3634,7 +3641,7 @@ bool GitClient::StashInfo::init(const FilePath &workingDirectory, const QString } if (m_stashResult == StashFailed) - VcsOutputWindow::appendError(errorMessage); + VcsOutputWindow::appendError(m_workingDir, errorMessage); return !stashingFailed(); } @@ -3753,7 +3760,7 @@ QString GitClient::suggestedLocalBranchName( if (res) initialName = res.value().trimmed(); else - VcsOutputWindow::appendError(res.error()); + VcsOutputWindow::appendError(workingDirectory, res.error()); } QString suggestedName = initialName; int i = 2; @@ -3797,7 +3804,7 @@ void GitClient::addChangeActions(QMenu *menu, const FilePath &source, const QStr if (!gitClient().synchronousBranchCmd(workingDir, {"--no-track", newBranch, change}, &output, &errorMessage)) { - VcsOutputWindow::appendError(errorMessage); + VcsOutputWindow::appendError(workingDir, errorMessage); return; } @@ -3842,9 +3849,9 @@ void GitClient::addChangeActions(QMenu *menu, const FilePath &source, const QStr return QStringList{"-a", "-m", annotation, tag, change}; }; gitClient().synchronousTagCmd(workingDir, args(), &output, &errorMessage); - VcsOutputWindow::append(output); + VcsOutputWindow::appendSilently(workingDir, output); if (!errorMessage.isEmpty()) - VcsOutputWindow::append(errorMessage, VcsOutputWindow::MessageStyle::Error); + VcsOutputWindow::appendError(workingDir, errorMessage); }); auto resetChange = [workingDir, change](const QByteArray &resetType) { diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index 49a47afb7d2..412ccae26d9 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -387,7 +387,8 @@ private: RevertResult revertI(QStringList files, bool *isDirectory, QString *errorMessage, - bool revertStaging); + bool revertStaging, + Utils::FilePath *repository); bool executeAndHandleConflicts(const Utils::FilePath &workingDirectory, const QStringList &arguments, const QString &abortCommand = {}) const; void tryLaunchingGitK(const Utils::Environment &env, diff --git a/src/plugins/git/giteditor.cpp b/src/plugins/git/giteditor.cpp index acd20993722..a6588c42100 100644 --- a/src/plugins/git/giteditor.cpp +++ b/src/plugins/git/giteditor.cpp @@ -215,13 +215,13 @@ void GitEditorWidget::applyDiffChunk(const DiffChunk& chunk, PatchAction patchAc QString errorMessage; if (gitClient().synchronousApplyPatch(baseDir, patchFile.fileName(), &errorMessage, args)) { if (errorMessage.isEmpty()) - VcsOutputWindow::append(Tr::tr("Chunk successfully staged")); + VcsOutputWindow::appendSilently(baseDir, Tr::tr("Chunk successfully staged")); else - VcsOutputWindow::append(errorMessage); + VcsOutputWindow::appendError(baseDir, errorMessage); if (patchAction == PatchAction::Revert) emit diffChunkReverted(); } else { - VcsOutputWindow::appendError(errorMessage); + VcsOutputWindow::appendError(baseDir, errorMessage); } } @@ -277,12 +277,12 @@ QString GitEditorWidget::decorateVersion(const QString &revision) const QStringList GitEditorWidget::annotationPreviousVersions(const QString &revision) const { + const Utils::FilePath &repository = sourceWorkingDirectory(); QStringList revisions; QString errorMessage; // Get the hashes of the file. - if (!gitClient().synchronousParentRevisions( - sourceWorkingDirectory(), revision, &revisions, &errorMessage)) { - VcsOutputWindow::appendSilently(errorMessage); + if (!gitClient().synchronousParentRevisions(repository, revision, &revisions, &errorMessage)) { + VcsOutputWindow::appendSilently(repository, errorMessage); return {}; } return revisions; diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index b08b32c2a83..9532815716c 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -1398,7 +1398,7 @@ void GitPluginPrivate::startCommit(CommitType commitType) if (raiseSubmitEditor()) return; if (isCommitEditorOpen()) { - VcsOutputWindow::appendWarning(Tr::tr("Another submit is currently being executed.")); + VcsOutputWindow::appendWarning({}, Tr::tr("Another submit is currently being executed.")); return; } @@ -1407,7 +1407,7 @@ void GitPluginPrivate::startCommit(CommitType commitType) const Result<CommitData> res = gitClient().getCommitData(commitType, state.topLevel()); if (!res) { - VcsOutputWindow::appendError(res.error()); + VcsOutputWindow::appendError(state.topLevel(), res.error()); return; } const CommitData data = res.value(); @@ -1424,7 +1424,7 @@ void GitPluginPrivate::startCommit(CommitType commitType) saver.setAutoRemove(false); saver.write(data.commitTemplate.toLocal8Bit()); if (const Result<> res = saver.finalize(); !res) { - VcsOutputWindow::appendError(res.error()); + VcsOutputWindow::appendError(m_submitRepository, res.error()); return; } m_commitMessageFileName = saver.filePath(); @@ -1671,12 +1671,13 @@ void GitPluginPrivate::applyPatch(const FilePath &workingDirectory, QString file QString errorMessage; if (gitClient().synchronousApplyPatch(workingDirectory, file, &errorMessage)) { if (errorMessage.isEmpty()) - VcsOutputWindow::appendMessage(Tr::tr("Patch %1 successfully applied to %2") - .arg(file, workingDirectory.toUserOutput())); + VcsOutputWindow::appendMessage(workingDirectory, + Tr::tr("Patch %1 successfully applied to %2") + .arg(file, workingDirectory.toUserOutput())); else - VcsOutputWindow::appendError(errorMessage); + VcsOutputWindow::appendError(workingDirectory, errorMessage); } else { - VcsOutputWindow::appendError(errorMessage); + VcsOutputWindow::appendError(workingDirectory, errorMessage); } gitClient().endStashScope(workingDirectory); } diff --git a/src/plugins/git/gitsubmiteditor.cpp b/src/plugins/git/gitsubmiteditor.cpp index 59b08a95e6f..fde00cb3b90 100644 --- a/src/plugins/git/gitsubmiteditor.cpp +++ b/src/plugins/git/gitsubmiteditor.cpp @@ -220,7 +220,7 @@ void GitSubmitEditor::performFileAction(const Utils::FilePath &filePath, FileAct const QString message = (action == FileRevertDeletion) ? Tr::tr("File \"%1\" recovered.\n").arg(filePath.toUserOutput()) : Tr::tr("File \"%1\" reverted.\n").arg(filePath.toUserOutput()); - VcsOutputWindow::append(message, VcsOutputWindow::Message); + VcsOutputWindow::appendMessage(m_workingDirectory, message); refresh = true; } break; @@ -305,7 +305,7 @@ void GitSubmitEditor::commitDataRetrieved() w->setEnabled(true); } else { // Nothing to commit left! - VcsOutputWindow::appendError(result.error()); + VcsOutputWindow::appendError(m_workingDirectory, result.error()); m_model->clear(); w->setEnabled(false); } diff --git a/src/plugins/git/logchangedialog.cpp b/src/plugins/git/logchangedialog.cpp index 8ef4eb72da7..4499e5ac2f6 100644 --- a/src/plugins/git/logchangedialog.cpp +++ b/src/plugins/git/logchangedialog.cpp @@ -85,7 +85,7 @@ bool LogChangeWidget::init(const FilePath &repository, const QString &commit, Lo if (m_model->rowCount() > 0) return true; if (!(flags & Silent)) - VcsOutputWindow::appendError(GitClient::msgNoCommits(flags & IncludeRemotes)); + VcsOutputWindow::appendError(repository, GitClient::msgNoCommits(flags & IncludeRemotes)); return false; } @@ -194,7 +194,7 @@ bool LogChangeWidget::populateLog(const FilePath &repository, const QString &com const Result<QString> res = gitClient().synchronousLog(repository, arguments, RunFlags::NoOutput); if (!res) { - VcsOutputWindow::appendError(res.error()); + VcsOutputWindow::appendError(repository, res.error()); return false; } diff --git a/src/plugins/git/mergetool.cpp b/src/plugins/git/mergetool.cpp index 138943ef2cc..3abbcda2b95 100644 --- a/src/plugins/git/mergetool.cpp +++ b/src/plugins/git/mergetool.cpp @@ -169,7 +169,7 @@ void MergeTool::readData() { QString newData = QString::fromLocal8Bit(m_process.readAllRawStandardOutput()); newData.remove('\r'); - VcsOutputWindow::append(newData); + VcsOutputWindow::appendSilently(m_process.workingDirectory(), newData); QString data = m_unfinishedLine + newData; m_unfinishedLine.clear(); for (;;) { @@ -215,13 +215,13 @@ void MergeTool::readLine(const QString &line) void MergeTool::done() { + const FilePath workingDirectory = m_process.workingDirectory(); const bool success = m_process.result() == ProcessResult::FinishedWithSuccess; if (success) - VcsOutputWindow::appendMessage(m_process.exitMessage()); + VcsOutputWindow::appendMessage(workingDirectory, m_process.exitMessage()); else - VcsOutputWindow::appendError(m_process.exitMessage()); + VcsOutputWindow::appendError(workingDirectory, m_process.exitMessage()); - const FilePath workingDirectory = m_process.workingDirectory(); gitClient().continueCommandIfNeeded(workingDirectory, success); emitRepositoryChanged(workingDirectory); deleteLater(); @@ -230,7 +230,7 @@ void MergeTool::done() void MergeTool::write(const QString &str) { m_process.write(str); - VcsOutputWindow::append(str); + VcsOutputWindow::appendSilently(m_process.workingDirectory(), str); } } // Git::Internal diff --git a/src/plugins/git/remotedialog.cpp b/src/plugins/git/remotedialog.cpp index 2bb8b7e29d5..ff953ee4ff6 100644 --- a/src/plugins/git/remotedialog.cpp +++ b/src/plugins/git/remotedialog.cpp @@ -202,7 +202,7 @@ void RemoteDialog::refresh(const FilePath &repository, bool force) } else { QString errorMessage; if (!m_remoteModel->refresh(repository, &errorMessage)) - VcsBase::VcsOutputWindow::appendError(errorMessage); + VcsBase::VcsOutputWindow::appendError(repository, errorMessage); } } diff --git a/src/plugins/gitlab/gitlabplugin.cpp b/src/plugins/gitlab/gitlabplugin.cpp index 4d94c64da04..c9b5515dfc2 100644 --- a/src/plugins/gitlab/gitlabplugin.cpp +++ b/src/plugins/gitlab/gitlabplugin.cpp @@ -236,8 +236,9 @@ void GitLabPluginPrivate::handleEvents(const Events &events, const QDateTime &ti return; if (!events.error.message.isEmpty()) { - VcsBase::VcsOutputWindow::appendError("GitLab: Error while fetching events. " - + events.error.message + '\n'); + const Utils::FilePath workingDirectory = project->projectDirectory(); + VcsBase::VcsOutputWindow::appendError(workingDirectory, + "GitLab: Error while fetching events. " + events.error.message); return; } @@ -245,7 +246,8 @@ void GitLabPluginPrivate::handleEvents(const Events &events, const QDateTime &ti for (const Event &event : events.events) { const QDateTime eventTimeStamp = QDateTime::fromString(event.timeStamp, Qt::ISODateWithMs); if (!timeStamp.isValid() || timeStamp < eventTimeStamp) { - VcsBase::VcsOutputWindow::appendMessage("GitLab: " + event.toMessage()); + const Utils::FilePath workingDirectory = project->projectDirectory(); + VcsBase::VcsOutputWindow::appendMessage(workingDirectory, "GitLab: " + event.toMessage()); if (!lastTimeStamp.isValid() || lastTimeStamp < eventTimeStamp) lastTimeStamp = eventTimeStamp; } diff --git a/src/plugins/gitlab/queryrunner.cpp b/src/plugins/gitlab/queryrunner.cpp index a266e164db6..f162080e918 100644 --- a/src/plugins/gitlab/queryrunner.cpp +++ b/src/plugins/gitlab/queryrunner.cpp @@ -108,7 +108,7 @@ QueryRunner::QueryRunner(const Query &query, const Id &id, QObject *parent) start(); return; } - VcsBase::VcsOutputWindow::appendError(m_process.exitMessage()); + VcsBase::VcsOutputWindow::appendError(m_process.workingDirectory(), m_process.exitMessage()); } else { emit resultRetrieved(m_process.rawStdOut()); } diff --git a/src/plugins/mercurial/mercurialclient.cpp b/src/plugins/mercurial/mercurialclient.cpp index bb32871d57e..8412ec25445 100644 --- a/src/plugins/mercurial/mercurialclient.cpp +++ b/src/plugins/mercurial/mercurialclient.cpp @@ -136,13 +136,15 @@ user: ... // Obtain first line and split by blank-delimited tokens const QStringList lines = result.cleanedStdOut().split(QLatin1Char('\n')); if (lines.size() < 1) { - VcsOutputWindow::appendSilently(msgParentRevisionFailed(workingDirectory, revision, + VcsOutputWindow::appendSilently(workingDirectory, + msgParentRevisionFailed(workingDirectory, revision, msgParseParentsOutputFailed(result.cleanedStdOut()))); return {}; } const QStringList changeSets = lines.front().simplified().split(QLatin1Char(' ')); if (changeSets.size() < 2) { - VcsOutputWindow::appendSilently(msgParentRevisionFailed(workingDirectory, revision, + VcsOutputWindow::appendSilently(workingDirectory, + msgParentRevisionFailed(workingDirectory, revision, msgParseParentsOutputFailed(result.cleanedStdOut()))); return {}; } diff --git a/src/plugins/mercurial/mercurialplugin.cpp b/src/plugins/mercurial/mercurialplugin.cpp index 723f4a34a1c..bd19b39a6e9 100644 --- a/src/plugins/mercurial/mercurialplugin.cpp +++ b/src/plugins/mercurial/mercurialplugin.cpp @@ -556,7 +556,7 @@ void MercurialPluginPrivate::showCommitWidget(const QList<VcsBaseClient::StatusI this, &MercurialPluginPrivate::showCommitWidget); if (status.isEmpty()) { - VcsOutputWindow::appendError(Tr::tr("There are no changes to commit.")); + VcsOutputWindow::appendError(m_submitRepository, Tr::tr("There are no changes to commit.")); return; } @@ -565,13 +565,13 @@ void MercurialPluginPrivate::showCommitWidget(const QList<VcsBaseClient::StatusI // Keep the file alive, else it removes self and forgets its name saver.setAutoRemove(false); if (const Result<> res = saver.finalize(); !res) { - VcsOutputWindow::appendError(res.error()); + VcsOutputWindow::appendError(m_submitRepository, res.error()); return; } Core::IEditor *editor = Core::EditorManager::openEditor(saver.filePath(), Constants::COMMIT_ID); if (!editor) { - VcsOutputWindow::appendError(Tr::tr("Unable to create an editor for the commit.")); + VcsOutputWindow::appendError(m_submitRepository, Tr::tr("Unable to create an editor for the commit.")); return; } diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index dfaae6e7c2d..9266a5cb01c 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -655,7 +655,8 @@ void PerforcePluginPrivate::updateCheckout(const FilePath &workingDir, const QSt void PerforcePluginPrivate::printOpenedFileList() { - const PerforceResponse perforceResponse = runP4Cmd(settings().topLevel(), {"opened"}, + const Utils::FilePath repository = settings().topLevel(); + const PerforceResponse perforceResponse = runP4Cmd(repository, {"opened"}, CommandToWindow|StdErrToWindow|ErrorToWindow); if (perforceResponse.error || perforceResponse.stdOut.isEmpty()) return; @@ -670,9 +671,9 @@ void PerforcePluginPrivate::printOpenedFileList() if (delimiterPos > 0) mapped = fileNameFromPerforceName(line.left(delimiterPos), true); if (mapped.isEmpty()) - VcsOutputWindow::appendSilently(line); + VcsOutputWindow::appendSilently(repository, line); else - VcsOutputWindow::appendSilently(mapped + QLatin1Char(' ') + line.mid(delimiterPos)); + VcsOutputWindow::appendSilently(repository, mapped + ' ' + line.mid(delimiterPos)); } VcsOutputWindow::instance()->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus); } @@ -686,7 +687,7 @@ void PerforcePluginPrivate::startSubmitProject() return; if (isCommitEditorOpen()) { - VcsOutputWindow::appendWarning(Tr::tr("Another submit is currently executed.")); + VcsOutputWindow::appendWarning({}, Tr::tr("Another submit is currently executed.")); return; } @@ -694,13 +695,14 @@ void PerforcePluginPrivate::startSubmitProject() QTC_ASSERT(state.hasProject(), return); // Revert all unchanged files. - if (!revertProject(state.currentProjectTopLevel(), perforceRelativeProjectDirectory(state), true)) + const Utils::FilePath &repository = state.currentProjectTopLevel(); + if (!revertProject(repository, perforceRelativeProjectDirectory(state), true)) return; // Start a change QStringList args; args << QLatin1String("change") << QLatin1String("-o"); - PerforceResponse result = runP4Cmd(state.currentProjectTopLevel(), args, + PerforceResponse result = runP4Cmd(repository, args, RunFullySynchronous|CommandToWindow|StdErrToWindow|ErrorToWindow); if (result.error) { cleanCommitMessageFile(); @@ -711,7 +713,7 @@ void PerforcePluginPrivate::startSubmitProject() saver.setAutoRemove(false); saver.write(result.stdOut.toLatin1()); if (const Result<> res = saver.finalize(); !res) { - VcsOutputWindow::appendError(res.error()); + VcsOutputWindow::appendError(repository, res.error()); cleanCommitMessageFile(); return; } @@ -720,7 +722,7 @@ void PerforcePluginPrivate::startSubmitProject() args.clear(); args << QLatin1String("files"); args.append(perforceRelativeProjectDirectory(state)); - PerforceResponse filesResult = runP4Cmd(state.currentProjectTopLevel(), args, + PerforceResponse filesResult = runP4Cmd(repository, args, RunFullySynchronous|CommandToWindow|StdErrToWindow|ErrorToWindow); if (filesResult.error) { cleanCommitMessageFile(); @@ -734,7 +736,7 @@ void PerforcePluginPrivate::startSubmitProject() depotFileNames.append(line.left(line.lastIndexOf(regexp))); } if (depotFileNames.isEmpty()) { - VcsOutputWindow::appendWarning(Tr::tr("Project has no files")); + VcsOutputWindow::appendWarning(repository, Tr::tr("Project has no files")); cleanCommitMessageFile(); return; } @@ -1172,18 +1174,18 @@ PerforceResponse PerforcePluginPrivate::synchronousProcess(const FilePath &worki if (flags & OverrideDiffEnvironment) process.setEnvironment(overrideDiffEnvironmentVariable()); if (!workingDir.isEmpty()) - process.setWorkingDirectory(workingDir); // connect stderr to the output window if desired if (flags & StdErrToWindow) - process.setStdErrCallback([](const QString &lines) { VcsOutputWindow::append(lines); }); + process.setStdErrCallback([workingDir](const QString &lines) { + VcsOutputWindow::appendError(workingDir, lines); + }); // connect stdout to the output window if desired if (flags & StdOutToWindow) { - if (flags & SilentStdOut) - process.setStdOutCallback(&VcsOutputWindow::appendSilently); - else - process.setStdOutCallback([](const QString &lines) { VcsOutputWindow::append(lines); }); + process.setStdOutCallback([workingDir](const QString &lines) { + VcsOutputWindow::appendSilently(workingDir, lines); + }); } process.setTimeOutMessageBoxEnabled(true); process.setCommand({settings().p4BinaryPath(), args}); @@ -1200,7 +1202,7 @@ PerforceResponse PerforcePluginPrivate::synchronousProcess(const FilePath &worki response.stdOut = process.cleanedStdOut(); if (response.error && (flags & ErrorToWindow)) - VcsOutputWindow::appendError(process.exitMessage()); + VcsOutputWindow::appendError(workingDir, process.exitMessage()); return response; } @@ -1212,7 +1214,7 @@ PerforceResponse PerforcePluginPrivate::runP4Cmd(const FilePath &workingDir, const TextEncoding &encoding) const { if (!settings().isValid()) { - VcsOutputWindow::appendError(Tr::tr("Perforce is not correctly configured.")); + VcsOutputWindow::appendError(workingDir, Tr::tr("Perforce is not correctly configured.")); return {}; } QStringList actualArgs = settings().commonP4Arguments(workingDir.toUrlishString()); @@ -1416,21 +1418,22 @@ bool PerforcePluginPrivate::activateCommit() return false; // Pipe file into p4 submit -i + const Utils::FilePath workingDirectory = settings().topLevelSymLinkTarget(); const Result<QByteArray> contents = FilePath::fromString(m_commitMessageFileName).fileContents(); if (!contents) { - VcsOutputWindow::appendError(contents.error()); + VcsOutputWindow::appendError(workingDirectory, contents.error()); return false; } QStringList submitArgs; submitArgs << QLatin1String("submit") << QLatin1String("-i"); - const PerforceResponse submitResponse = runP4Cmd(settings().topLevelSymLinkTarget(), submitArgs, + const PerforceResponse submitResponse = runP4Cmd(workingDirectory, submitArgs, LongTimeOut|RunFullySynchronous|CommandToWindow|StdErrToWindow|ErrorToWindow|ShowBusyCursor, {}, normalizeNewlines(contents.value())); if (submitResponse.error) return false; - VcsOutputWindow::append(submitResponse.stdOut); + VcsOutputWindow::appendSilently(workingDirectory, submitResponse.stdOut); if (submitResponse.stdOut.contains(QLatin1String("Out of date files must be resolved or reverted)"))) QMessageBox::warning(perforceEditor->widget(), Tr::tr("Pending change"), Tr::tr("Could not submit the change, because your workspace was out of date. Created a pending submit instead.")); @@ -1473,7 +1476,8 @@ QString fileNameFromPerforceName(const QString &perforceName, bool quiet) unsigned flags = RunFullySynchronous; if (!quiet) flags |= CommandToWindow|StdErrToWindow|ErrorToWindow; - const PerforceResponse response = dd->runP4Cmd(settings().topLevelSymLinkTarget(), args, flags); + const Utils::FilePath workingDirectory = settings().topLevelSymLinkTarget(); + const PerforceResponse response = dd->runP4Cmd(workingDirectory, args, flags); if (response.error) return {}; @@ -1487,7 +1491,7 @@ QString fileNameFromPerforceName(const QString &perforceName, bool quiet) if (!quiet) { //: Failed to run p4 "where" to resolve a Perforce file name to a local //: file system name. - VcsOutputWindow::appendError( + VcsOutputWindow::appendError(workingDirectory, Tr::tr("Error running \"where\" on %1: The file is not mapped.") .arg(QDir::toNativeSeparators(perforceName))); } @@ -1505,12 +1509,12 @@ void PerforcePluginPrivate::setTopLevel(const FilePath &topLevel) settings().setTopLevel(topLevel.toUrlishString()); const QString msg = Tr::tr("Perforce repository: %1").arg(topLevel.toUserOutput()); - VcsOutputWindow::appendSilently(msg); + VcsOutputWindow::appendSilently(topLevel, msg); } void PerforcePluginPrivate::slotTopLevelFailed(const QString &errorMessage) { - VcsOutputWindow::appendSilently(Tr::tr("Perforce: Unable to determine the repository: %1").arg(errorMessage)); + VcsOutputWindow::appendSilently({}, Tr::tr("Perforce: Unable to determine the repository: %1").arg(errorMessage)); } void PerforcePluginPrivate::getTopLevel(const FilePath &workingDirectory, bool isSync) diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index cf1cbfc534a..9b0b05bea4c 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -684,7 +684,7 @@ void SubversionPluginPrivate::startCommit(const FilePath &workingDir, const QStr if (raiseSubmitEditor()) return; if (isCommitEditorOpen()) { - VcsOutputWindow::appendWarning(Tr::tr("Another commit is currently being executed.")); + VcsOutputWindow::appendWarning(workingDir, Tr::tr("Another commit is currently being executed.")); return; } @@ -699,7 +699,7 @@ void SubversionPluginPrivate::startCommit(const FilePath &workingDir, const QStr // Get list of added/modified/deleted files const StatusList statusOutput = parseStatusOutput(response.cleanedStdOut()); if (statusOutput.empty()) { - VcsOutputWindow::appendWarning(Tr::tr("There are no modified files.")); + VcsOutputWindow::appendWarning(workingDir, Tr::tr("There are no modified files.")); return; } m_commitRepository = workingDir; @@ -711,7 +711,7 @@ void SubversionPluginPrivate::startCommit(const FilePath &workingDir, const QStr // Create a submit saver.write(submitTemplate.toUtf8()); if (const Result<> res = saver.finalize(); !res) { - VcsOutputWindow::appendError(res.error()); + VcsOutputWindow::appendError(m_commitRepository, res.error()); return; } m_commitMessageFileName = saver.filePath().toUrlishString(); diff --git a/src/plugins/vcsbase/cleandialog.cpp b/src/plugins/vcsbase/cleandialog.cpp index ae0b14a7ba8..4cd8866676b 100644 --- a/src/plugins/vcsbase/cleandialog.cpp +++ b/src/plugins/vcsbase/cleandialog.cpp @@ -69,7 +69,7 @@ static void removeFileRecursion(QPromise<void> &promise, const QFileInfo &f, // Cleaning files in the background static void runCleanFiles(QPromise<void> &promise, const FilePath &repository, const QStringList &files, - const std::function<void(const QString&)> &errorHandler) + const std::function<void(const FilePath &, const QString &)> &errorHandler) { QString errorMessage; promise.setProgressRange(0, files.size()); @@ -87,14 +87,14 @@ static void runCleanFiles(QPromise<void> &promise, const FilePath &repository, .arg(repository.toUserOutput()); errorMessage.insert(0, QLatin1Char('\n')); errorMessage.insert(0, msg); - errorHandler(errorMessage); + errorHandler(repository, errorMessage); } } -static void handleError(const QString &errorMessage) +static void handleError(const Utils::FilePath &repository, const QString &errorMessage) { - QTimer::singleShot(0, VcsOutputWindow::instance(), [errorMessage] { - VcsOutputWindow::instance()->appendSilently(errorMessage); + QTimer::singleShot(0, VcsOutputWindow::instance(), [repository, errorMessage] { + VcsOutputWindow::instance()->appendSilently(repository, errorMessage); }); } diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index afd24e6e4ab..93dea6501a8 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -270,7 +270,7 @@ bool VcsBaseClient::synchronousCreateRepository(const FilePath &workingDirectory const CommandResult result = vcsSynchronousExec(workingDirectory, args); if (result.result() != ProcessResult::FinishedWithSuccess) return false; - VcsOutputWindow::append(result.cleanedStdOut()); + VcsOutputWindow::appendSilently(workingDirectory, result.cleanedStdOut()); resetCachedVcsInfo(workingDirectory); diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp index a5bab7a7c93..0d0c19f4038 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp @@ -434,7 +434,7 @@ void VcsBaseSubmitEditor::accept(VersionControlBase *plugin) QString errorMessage; const bool canCommit = checkSubmitMessage(&errorMessage) && submitWidget->canSubmit(&errorMessage); if (!canCommit) { - VcsOutputWindow::appendError(plugin->commitErrorMessage(errorMessage)); + VcsOutputWindow::appendError({}, plugin->commitErrorMessage(errorMessage)); } else if (plugin->activateCommit()) { close(); } @@ -536,8 +536,8 @@ bool VcsBaseSubmitEditor::runSubmitMessageCheckScript(const FilePath &checkScrip return false; } // Run check process - VcsOutputWindow::appendShellCommandLine(msgCheckScript(d->m_checkScriptWorkingDirectory, - checkScript)); + VcsOutputWindow::appendShellCommandLine(d->m_checkScriptWorkingDirectory, + msgCheckScript(d->m_checkScriptWorkingDirectory, checkScript)); Process checkProcess; if (!d->m_checkScriptWorkingDirectory.isEmpty()) checkProcess.setWorkingDirectory(d->m_checkScriptWorkingDirectory); @@ -547,10 +547,10 @@ bool VcsBaseSubmitEditor::runSubmitMessageCheckScript(const FilePath &checkScrip const QString stdOut = checkProcess.stdOut(); if (!stdOut.isEmpty()) - VcsOutputWindow::appendSilently(stdOut); + VcsOutputWindow::appendSilently(d->m_checkScriptWorkingDirectory, stdOut); const QString stdErr = checkProcess.stdErr(); if (!stdErr.isEmpty()) - VcsOutputWindow::appendSilently(stdErr); + VcsOutputWindow::appendSilently(d->m_checkScriptWorkingDirectory, stdErr); if (!succeeded) *errorMessage = checkProcess.exitMessage(); diff --git a/src/plugins/vcsbase/vcscommand.cpp b/src/plugins/vcsbase/vcscommand.cpp index 254693d33cb..917391c2507 100644 --- a/src/plugins/vcsbase/vcscommand.cpp +++ b/src/plugins/vcsbase/vcscommand.cpp @@ -82,14 +82,12 @@ public: void VcsCommandPrivate::setup() { - VcsOutputWindow::setRepository(m_defaultWorkingDirectory); if (m_flags & RunFlags::ExpectRepoChanges) GlobalFileChangeBlocker::instance()->forceBlocked(true); } void VcsCommandPrivate::cleanup() { - VcsOutputWindow::clearRepository(); if (m_flags & RunFlags::ExpectRepoChanges) GlobalFileChangeBlocker::instance()->forceBlocked(false); } @@ -127,9 +125,8 @@ void VcsCommandPrivate::installStdCallbacks(Process *process) || m_progressParser || !(m_flags & RunFlags::SuppressStdErr))) { process->setTextChannelMode(Channel::Error, TextChannelMode::MultiLine); connect(process, &Process::textOnStandardError, this, [this](const QString &text) { - VcsOutputWindow::setRepository(m_defaultWorkingDirectory); if (!(m_flags & RunFlags::SuppressStdErr)) - VcsOutputWindow::appendError(text); + VcsOutputWindow::appendError(m_defaultWorkingDirectory, text); if (m_flags & RunFlags::ProgressiveOutput) emit q->stdErrText(text); }); @@ -138,9 +135,8 @@ void VcsCommandPrivate::installStdCallbacks(Process *process) || m_flags & RunFlags::ShowStdOut) { process->setTextChannelMode(Channel::Output, TextChannelMode::MultiLine); connect(process, &Process::textOnStandardOutput, this, [this](const QString &text) { - VcsOutputWindow::setRepository(m_defaultWorkingDirectory); if (m_flags & RunFlags::ShowStdOut) - VcsOutputWindow::append(text); + VcsOutputWindow::appendSilently(m_defaultWorkingDirectory, text); if (m_flags & RunFlags::ProgressiveOutput) emit q->stdOutText(text); }); @@ -163,19 +159,20 @@ ProcessResult VcsCommandPrivate::handleDone(Process *process, const Job &job) co } else { result = process->result(); } + const Utils::FilePath workingDirectory = process->workingDirectory(); const QString message = Process::exitMessage(process->commandLine(), result, process->exitCode(), process->processDuration()); // Success/Fail message in appropriate window? if (result == ProcessResult::FinishedWithSuccess) { if (m_flags & RunFlags::ShowSuccessMessage) - VcsOutputWindow::appendMessage(message); + VcsOutputWindow::appendMessage(workingDirectory, message); } else if (!(m_flags & RunFlags::SuppressFailMessage)) { - VcsOutputWindow::appendError(message); + VcsOutputWindow::appendError(workingDirectory, message); } if (m_flags & RunFlags::ExpectRepoChanges) { // TODO tell the document manager that the directory now received all expected changes - // DocumentManager::unexpectDirectoryChange(d->m_workingDirectory); - VcsManager::emitRepositoryChanged(process->workingDirectory()); + // DocumentManager::unexpectDirectoryChange(workingDirectory); + VcsManager::emitRepositoryChanged(workingDirectory); } return result; } @@ -306,7 +303,6 @@ CommandResult VcsCommand::runBlockingHelper(const CommandLine &command, int time return {}; const Internal::VcsCommandPrivate::Job job{command, timeoutS, d->m_defaultWorkingDirectory}; - VcsOutputWindow::setRepository(d->m_defaultWorkingDirectory); d->setupProcess(&process, job); const EventLoopMode eventLoopMode = d->eventLoopMode(); diff --git a/src/plugins/vcsbase/vcsoutputwindow.cpp b/src/plugins/vcsbase/vcsoutputwindow.cpp index db9be51d8c1..d5f194eed80 100644 --- a/src/plugins/vcsbase/vcsoutputwindow.cpp +++ b/src/plugins/vcsbase/vcsoutputwindow.cpp @@ -228,7 +228,6 @@ class VcsOutputWindowPrivate { public: Internal::OutputWindowPlainTextEdit widget; - FilePath repository; const QRegularExpression passwordRegExp = QRegularExpression("://([^@:]+):([^@]+)@"); }; @@ -338,33 +337,34 @@ void VcsOutputWindow::setData(const QByteArray &data) setText(TextEncoding::encodingForLocale().decode(data)); } -void VcsOutputWindow::append(const QString &text, MessageStyle style, bool silently) +void VcsOutputWindow::append(const Utils::FilePath &workingDirectory, const QString &text, + MessageStyle style, bool silently) { const QString lines = (text.endsWith('\n') || text.endsWith('\r')) ? text : text + '\n'; - d->widget.appendLines(lines, style, d->repository); + d->widget.appendLines(lines, style, workingDirectory); if (!silently && !d->widget.isVisible()) m_instance->popup(IOutputPane::NoModeSwitch); } -void VcsOutputWindow::appendSilently(const QString &text) +void VcsOutputWindow::appendSilently(const FilePath &workingDirectory, const QString &text) { - append(text, None, true); + append(workingDirectory, text, None, true); } -void VcsOutputWindow::appendMessage(const QString &text) +void VcsOutputWindow::appendMessage(const FilePath &workingDirectory, const QString &text) { - append(text, Message, true); + append(workingDirectory, text, Message, true); } -void VcsOutputWindow::appendWarning(const QString &text) +void VcsOutputWindow::appendWarning(const FilePath &workingDirectory, const QString &text) { - append(text, Warning, false); + append(workingDirectory, text, Warning, false); } -void VcsOutputWindow::appendError(const QString &text) +void VcsOutputWindow::appendError(const FilePath &workingDirectory, const QString &text) { - append(text, Error, false); + append(workingDirectory, text, Error, false); } // Helper to format arguments for log windows hiding common password options. @@ -401,14 +401,14 @@ QString VcsOutputWindow::msgExecutionLogEntry(const FilePath &workingDir, const return Tr::tr("Running in \"%1\": %2").arg(workingDir.toUserOutput(), maskedCmdline) + '\n'; } -void VcsOutputWindow::appendShellCommandLine(const QString &text) +void VcsOutputWindow::appendShellCommandLine(const FilePath &workingDirectory, const QString &text) { - append(filterPasswordFromUrls(text), Command, true); + append(workingDirectory, filterPasswordFromUrls(text), Command, true); } void VcsOutputWindow::appendCommand(const FilePath &workingDirectory, const CommandLine &command) { - appendShellCommandLine(msgExecutionLogEntry(workingDirectory, command)); + appendShellCommandLine(workingDirectory, msgExecutionLogEntry(workingDirectory, command)); } void VcsOutputWindow::destroy() @@ -424,14 +424,4 @@ VcsOutputWindow *VcsOutputWindow::instance() return m_instance; } -void VcsOutputWindow::setRepository(const FilePath &repository) -{ - d->repository = repository; -} - -void VcsOutputWindow::clearRepository() -{ - d->repository.clear(); -} - } // namespace VcsBase diff --git a/src/plugins/vcsbase/vcsoutputwindow.h b/src/plugins/vcsbase/vcsoutputwindow.h index 837d020bbaf..0e89b67227e 100644 --- a/src/plugins/vcsbase/vcsoutputwindow.h +++ b/src/plugins/vcsbase/vcsoutputwindow.h @@ -52,34 +52,27 @@ public: }; public slots: - static void setRepository(const Utils::FilePath &repository); - static void clearRepository(); - // Set the whole text. static void setText(const QString &text); // Set text from QProcess' output data using the Locale's converter. static void setData(const QByteArray &data); - // Append text with a certain style (none by default), - // and maybe pop up (silent by default) - static void append(const QString &text, MessageStyle style = None, bool silently = false); - // Silently append text, do not pop up. - static void appendSilently(const QString &text); + static void appendSilently(const Utils::FilePath &workingDirectory, const QString &text); // Append a blue message text and pop up. - static void appendMessage(const QString &text); + static void appendMessage(const Utils::FilePath &workingDirectory, const QString &text); // Append dark-yellow warning text and pop up. - static void appendWarning(const QString &text); + static void appendWarning(const Utils::FilePath &workingDirectory, const QString &text); // Append red error text and pop up. - static void appendError(const QString &text); + static void appendError(const Utils::FilePath &workingDirectory, const QString &text); // Append a command, prepended by a log time stamp. "Executing: vcs -diff" // will result in "10:00 Executing: vcs -diff" in bold // Filter passwords from URLs while doing this. - static void appendShellCommandLine(const QString &text); + static void appendShellCommandLine(const Utils::FilePath &workingDirectory, const QString &text); // Append a standard-formatted entry for command execution // (see msgExecutionLogEntry). @@ -87,6 +80,11 @@ public slots: const Utils::CommandLine &command); private: + // Append text with a certain style (none by default), + // and maybe pop up (silent by default) + static void append(const Utils::FilePath &workingDirectory, const QString &text, + MessageStyle style = None, bool silently = false); + friend class Internal::VcsPlugin; static void destroy(); |