From 21580dae57709995363cc4e8d50ec4f14025c59c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 16 Nov 2016 09:38:33 +0000 Subject: [PATCH 001/133] Initial empty repository From dea25a6b62d97ddbe4a94c028c3431d91dac5b86 Mon Sep 17 00:00:00 2001 From: Artur Shepilko Date: Wed, 16 Nov 2016 12:51:32 -0600 Subject: [PATCH 002/133] Vcs: Add Fossil SCM integration plugin * Qt Creator base-commit: f77af5e3362cc6c4360ea1d197fb834cd5b072fa * Stand-alone plugin source tree for integration into qtc super-project * Original release: https://github.com/nomadbyte/qtcreator-plugin-fossil * Adapted from Bazaar plugin implementation Configuring Fossil ------------------ 1. Download the [Fossil SCM client](http://fossil-scm.org) and install `fossil` executable file in your `PATH`. 2. Create or designate a directory to store local Fossil repositories and remote clones. For example: `~/fossils/qt`. 3. Configure Version Control Options for the Fossil plugin to use the designated directory as `Local Repositories Default path`. Now Fossil should become available as a VCS choice to create new local repositories, as well as a choice in `New File or Project` to clone a remote Fossil repository. Change-Id: I630184c1b344184d9e08ae2fc24a5e4766f834b9 Reviewed-by: Eike Ziller --- doc/src/vcs/creator-vcs-fossil.qdoc | 87 ++ fossil.pro | 2 + plugins/fossil/Fossil.json.in | 19 + plugins/fossil/annotationhighlighter.cpp | 51 + plugins/fossil/annotationhighlighter.h | 46 + plugins/fossil/branchinfo.cpp | 57 + plugins/fossil/branchinfo.h | 59 + plugins/fossil/commiteditor.cpp | 89 ++ plugins/fossil/commiteditor.h | 57 + plugins/fossil/configuredialog.cpp | 99 ++ plugins/fossil/configuredialog.h | 55 + plugins/fossil/configuredialog.ui | 132 ++ plugins/fossil/constants.h | 114 ++ plugins/fossil/fossil.pro | 45 + plugins/fossil/fossil.qrc | 6 + plugins/fossil/fossil_dependencies.pri | 9 + plugins/fossil/fossilclient.cpp | 1201 +++++++++++++++++ plugins/fossil/fossilclient.h | 132 ++ plugins/fossil/fossilcommitpanel.ui | 177 +++ plugins/fossil/fossilcommitwidget.cpp | 169 +++ plugins/fossil/fossilcommitwidget.h | 76 ++ plugins/fossil/fossilcontrol.cpp | 289 ++++ plugins/fossil/fossilcontrol.h | 78 ++ plugins/fossil/fossileditor.cpp | 115 ++ plugins/fossil/fossileditor.h | 53 + plugins/fossil/fossilplugin.cpp | 819 +++++++++++ plugins/fossil/fossilplugin.h | 146 ++ plugins/fossil/fossilsettings.cpp | 68 + plugins/fossil/fossilsettings.h | 69 + plugins/fossil/optionspage.cpp | 86 ++ plugins/fossil/optionspage.h | 63 + plugins/fossil/optionspage.ui | 226 ++++ plugins/fossil/pullorpushdialog.cpp | 110 ++ plugins/fossil/pullorpushdialog.h | 66 + plugins/fossil/pullorpushdialog.ui | 235 ++++ plugins/fossil/revertdialog.ui | 106 ++ plugins/fossil/revisioninfo.cpp | 37 + plugins/fossil/revisioninfo.h | 47 + plugins/fossil/wizard/fossiljsextension.cpp | 128 ++ plugins/fossil/wizard/fossiljsextension.h | 61 + plugins/fossil/wizard/projects/vcs/icon.png | Bin 0 -> 14500 bytes .../fossil/wizard/projects/vcs/wizard.json | 255 ++++ 42 files changed, 5739 insertions(+) create mode 100644 doc/src/vcs/creator-vcs-fossil.qdoc create mode 100644 fossil.pro create mode 100644 plugins/fossil/Fossil.json.in create mode 100644 plugins/fossil/annotationhighlighter.cpp create mode 100644 plugins/fossil/annotationhighlighter.h create mode 100644 plugins/fossil/branchinfo.cpp create mode 100644 plugins/fossil/branchinfo.h create mode 100644 plugins/fossil/commiteditor.cpp create mode 100644 plugins/fossil/commiteditor.h create mode 100644 plugins/fossil/configuredialog.cpp create mode 100644 plugins/fossil/configuredialog.h create mode 100644 plugins/fossil/configuredialog.ui create mode 100644 plugins/fossil/constants.h create mode 100644 plugins/fossil/fossil.pro create mode 100644 plugins/fossil/fossil.qrc create mode 100644 plugins/fossil/fossil_dependencies.pri create mode 100644 plugins/fossil/fossilclient.cpp create mode 100644 plugins/fossil/fossilclient.h create mode 100644 plugins/fossil/fossilcommitpanel.ui create mode 100644 plugins/fossil/fossilcommitwidget.cpp create mode 100644 plugins/fossil/fossilcommitwidget.h create mode 100644 plugins/fossil/fossilcontrol.cpp create mode 100644 plugins/fossil/fossilcontrol.h create mode 100644 plugins/fossil/fossileditor.cpp create mode 100644 plugins/fossil/fossileditor.h create mode 100644 plugins/fossil/fossilplugin.cpp create mode 100644 plugins/fossil/fossilplugin.h create mode 100644 plugins/fossil/fossilsettings.cpp create mode 100644 plugins/fossil/fossilsettings.h create mode 100644 plugins/fossil/optionspage.cpp create mode 100644 plugins/fossil/optionspage.h create mode 100644 plugins/fossil/optionspage.ui create mode 100644 plugins/fossil/pullorpushdialog.cpp create mode 100644 plugins/fossil/pullorpushdialog.h create mode 100644 plugins/fossil/pullorpushdialog.ui create mode 100644 plugins/fossil/revertdialog.ui create mode 100644 plugins/fossil/revisioninfo.cpp create mode 100644 plugins/fossil/revisioninfo.h create mode 100644 plugins/fossil/wizard/fossiljsextension.cpp create mode 100644 plugins/fossil/wizard/fossiljsextension.h create mode 100644 plugins/fossil/wizard/projects/vcs/icon.png create mode 100644 plugins/fossil/wizard/projects/vcs/wizard.json diff --git a/doc/src/vcs/creator-vcs-fossil.qdoc b/doc/src/vcs/creator-vcs-fossil.qdoc new file mode 100644 index 00000000000..a5281803b40 --- /dev/null +++ b/doc/src/vcs/creator-vcs-fossil.qdoc @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +// ********************************************************************** +// NOTE: the sections are not ordered by their logical order to avoid +// reshuffling the file each time the index order changes (i.e., often). +// Run the fixnavi.pl script to adjust the links to the index order. +// ********************************************************************** + +/*! + \contentspage {Qt Creator Manual} + \previouspage creator-vcs-cvs.html + \page creator-vcs-fossil.html + \nextpage creator-vcs-git.html + + \title Using Fossil + + Fossil is an open source distributed version control system, designed + and developed by the creator of SQLite. A stand-alone Fossil executable + contains a source control management engine, web interface, issue tracker, + wiki, and built-in web server. Fossil is available for Linux, Windows, + and \macos. + + \section1 Configuring Fossil + + \list 1 + \li Download the \l{http://fossil-scm.org}{Fossil SCM client} and install + the \c fossil executable file in your \c PATH. + + \li Create or designate a directory to store local Fossil repositories and + remote clones. For example: \c ~/fossils/qt. + + \li Configure \uicontrol {Version Control Options} for the Fossil plugin to use + the designated directory as \uicontrol {Local Repositories Default path}. + \endlist + + Now Fossil should become available as a VCS choice to create new local + repositories, as well as a choice in \uicontrol {New File or Project} to + clone a remote Fossil repository. + + \section1 Additional Fossil Functions + + In addition to the standard version control system functions described in + \l{Using Common Functions}, the \uicontrol Fossil submenu contains + the following items: + \table + \header + \li Menu Item + \li Description + \row + \li \uicontrol Pull + \li Pull changes from the remote repository. + \row + \li \uicontrol Push + \li Push committed changes to the remote repository. + \row + \li \uicontrol Update + \li Change the version of the current checkout. Any uncommitted + changes are retained and applied to the new checkout. + \row + \li \uicontrol Settings + \li Configure the settings of the local repository. + \endtable + +*/ diff --git a/fossil.pro b/fossil.pro new file mode 100644 index 00000000000..bf71d0294c5 --- /dev/null +++ b/fossil.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS += plugins/fossil diff --git a/plugins/fossil/Fossil.json.in b/plugins/fossil/Fossil.json.in new file mode 100644 index 00000000000..166fd522a8e --- /dev/null +++ b/plugins/fossil/Fossil.json.in @@ -0,0 +1,19 @@ +{ + \"Name\" : \"Fossil\", + \"Version\" : \"$$QTCREATOR_VERSION\", + \"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\", + \"Vendor\" : \"Artur Shepilko\", + \"Copyright\" : \"(C) 2016 Artur Shepilko\", + \"License\" : [ \"Commercial Usage\", + \"\", + \"Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and The Qt Company.\", + \"\", + \"GNU General Public License Usage\", + \"\", + \"Alternatively, this plugin may be used under the terms of the GNU General Public License version 3 as published by the Free Software Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT included in the packaging of this plugin. Please review the following information to ensure the GNU General Public License requirements will be met: https://www.gnu.org/licenses/gpl-3.0.html.\" + ], + \"Category\" : \"Version Control\", + \"Description\" : \"Fossil SCM integration.\", + \"Url\" : \"http://www.qt.io\", + $$dependencyList +} diff --git a/plugins/fossil/annotationhighlighter.cpp b/plugins/fossil/annotationhighlighter.cpp new file mode 100644 index 00000000000..31f3f54ecab --- /dev/null +++ b/plugins/fossil/annotationhighlighter.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "annotationhighlighter.h" +#include "constants.h" + +#include + +namespace Fossil { +namespace Internal { + +FossilAnnotationHighlighter::FossilAnnotationHighlighter(const ChangeNumbers &changeNumbers, + QTextDocument *document) : + VcsBase::BaseAnnotationHighlighter(changeNumbers, document), + m_changesetIdPattern(Constants::CHANGESET_ID) +{ + QTC_CHECK(m_changesetIdPattern.isValid()); +} + +QString FossilAnnotationHighlighter::changeNumber(const QString &block) const +{ + QRegularExpressionMatch changesetIdMatch = m_changesetIdPattern.match(block); + if (changesetIdMatch.hasMatch()) + return changesetIdMatch.captured(1); + return QString(); +} + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/annotationhighlighter.h b/plugins/fossil/annotationhighlighter.h new file mode 100644 index 00000000000..474f3e11c63 --- /dev/null +++ b/plugins/fossil/annotationhighlighter.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include +#include + +namespace Fossil { +namespace Internal { + +class FossilAnnotationHighlighter : public VcsBase::BaseAnnotationHighlighter +{ +public: + explicit FossilAnnotationHighlighter(const ChangeNumbers &changeNumbers, + QTextDocument *document = nullptr); + +private: + QString changeNumber(const QString &block) const final; + QRegularExpression m_changesetIdPattern; +}; + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/branchinfo.cpp b/plugins/fossil/branchinfo.cpp new file mode 100644 index 00000000000..39a25c2591b --- /dev/null +++ b/plugins/fossil/branchinfo.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "branchinfo.h" + +namespace Fossil { +namespace Internal { + +BranchInfo::BranchInfo(const QString &name, BranchFlags flags) : + m_name(name), + m_flags(flags) +{ } + +const QString &BranchInfo::name() const +{ + return m_name; +} + +bool BranchInfo::isCurrent() const +{ + return m_flags.testFlag(Current); +} + +bool BranchInfo::isClosed() const +{ + return m_flags.testFlag(Closed); +} + +bool BranchInfo::isPrivate() const +{ + return m_flags.testFlag(Private); +} + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/branchinfo.h b/plugins/fossil/branchinfo.h new file mode 100644 index 00000000000..535c81b712d --- /dev/null +++ b/plugins/fossil/branchinfo.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include + +namespace Fossil { +namespace Internal { + +class BranchInfo +{ +public: + enum BranchFlag { + Current = 0x01, + Closed = 0x02, + Private = 0x04 + }; + Q_DECLARE_FLAGS(BranchFlags, BranchFlag) + + explicit BranchInfo(const QString &name = QString(), BranchFlags flags = 0); + +public: + const QString &name() const; + bool isCurrent() const; + bool isClosed() const; + bool isPrivate() const; + +private: + QString m_name; + BranchFlags m_flags; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(BranchInfo::BranchFlags) + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/commiteditor.cpp b/plugins/fossil/commiteditor.cpp new file mode 100644 index 00000000000..0e9a4594198 --- /dev/null +++ b/plugins/fossil/commiteditor.cpp @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "branchinfo.h" +#include "commiteditor.h" +#include "constants.h" +#include "fossilcommitwidget.h" + +#include +#include +#include +#include + +namespace Fossil { +namespace Internal { + +CommitEditor::CommitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters) : + VcsBase::VcsBaseSubmitEditor(parameters, new FossilCommitWidget) +{ + document()->setPreferredDisplayName(tr("Commit Editor")); +} + +FossilCommitWidget *CommitEditor::commitWidget() +{ + return static_cast(widget()); +} + +void CommitEditor::setFields(const QString &repositoryRoot, const BranchInfo &branch, + const QStringList &tags, const QString &userName, + const QList &repoStatus) +{ + FossilCommitWidget *fossilWidget = commitWidget(); + QTC_ASSERT(fossilWidget, return); + + fossilWidget->setFields(repositoryRoot, branch, tags, userName); + + m_fileModel = new VcsBase::SubmitFileModel(this); + m_fileModel->setRepositoryRoot(repositoryRoot); + m_fileModel->setFileStatusQualifier([](const QString &status, const QVariant &) + -> VcsBase::SubmitFileModel::FileStatusHint + { + if (status == Constants::FSTATUS_ADDED + || status == Constants::FSTATUS_ADDED_BY_MERGE + || status == Constants::FSTATUS_ADDED_BY_INTEGRATE) { + return VcsBase::SubmitFileModel::FileAdded; + } else if (status == Constants::FSTATUS_EDITED + || status == Constants::FSTATUS_UPDATED_BY_MERGE + || status == Constants::FSTATUS_UPDATED_BY_INTEGRATE) { + return VcsBase::SubmitFileModel::FileModified; + } else if (status == Constants::FSTATUS_DELETED) { + return VcsBase::SubmitFileModel::FileDeleted; + } else if (status == Constants::FSTATUS_RENAMED) { + return VcsBase::SubmitFileModel::FileRenamed; + } + return VcsBase::SubmitFileModel::FileStatusUnknown; + } ); + + const QList toAdd = Utils::filtered(repoStatus, + [](const VcsBase::VcsBaseClient::StatusItem &item) { return item.flags != Constants::FSTATUS_UNKNOWN; }); + for (const VcsBase::VcsBaseClient::StatusItem &item : toAdd) + m_fileModel->addFile(item.file, item.flags); + + setFileModel(m_fileModel); +} + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/commiteditor.h b/plugins/fossil/commiteditor.h new file mode 100644 index 00000000000..2fa6a55f057 --- /dev/null +++ b/plugins/fossil/commiteditor.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include +#include + +namespace VcsBase { class SubmitFileModel; } + +namespace Fossil { +namespace Internal { + +class BranchInfo; +class FossilCommitWidget; + +class CommitEditor : public VcsBase::VcsBaseSubmitEditor +{ + Q_OBJECT + +public: + explicit CommitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters); + + void setFields(const QString &repositoryRoot, const BranchInfo &branch, + const QStringList &tags, const QString &userName, + const QList &repoStatus); + + FossilCommitWidget *commitWidget(); + +private: + VcsBase::SubmitFileModel *m_fileModel = nullptr; +}; + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/configuredialog.cpp b/plugins/fossil/configuredialog.cpp new file mode 100644 index 00000000000..49ab100e82c --- /dev/null +++ b/plugins/fossil/configuredialog.cpp @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "configuredialog.h" +#include "ui_configuredialog.h" + +#include "fossilsettings.h" + +#include + +#include + +namespace Fossil { +namespace Internal { + +class ConfigureDialogPrivate { +public: + RepositorySettings settings() { + m_settings.user = m_ui.userLineEdit->text().trimmed(); + m_settings.sslIdentityFile = m_ui.sslIdentityFilePathChooser->path(); + m_settings.autosync = + (m_ui.disableAutosyncCheckBox->isChecked() ? RepositorySettings::AutosyncOff + : RepositorySettings::AutosyncOn); + return m_settings; + } + + void updateUi() { + m_ui.userLineEdit->setText(m_settings.user.trimmed()); + m_ui.userLineEdit->selectAll(); + m_ui.sslIdentityFilePathChooser->setPath(QDir::toNativeSeparators(m_settings.sslIdentityFile)); + m_ui.disableAutosyncCheckBox->setChecked(m_settings.autosync == RepositorySettings::AutosyncOff); + } + + Ui::ConfigureDialog m_ui; + RepositorySettings m_settings; +}; + +ConfigureDialog::ConfigureDialog(QWidget *parent) : QDialog(parent), + d(new ConfigureDialogPrivate) +{ + d->m_ui.setupUi(this); + d->m_ui.sslIdentityFilePathChooser->setExpectedKind(Utils::PathChooser::File); + d->m_ui.sslIdentityFilePathChooser->setPromptDialogTitle(tr("SSL/TLS Identity Key")); + setWindowTitle(tr("Configure Repository")); + d->updateUi(); +} + +ConfigureDialog::~ConfigureDialog() +{ + delete d; +} + +const RepositorySettings ConfigureDialog::settings() const +{ + return d->settings(); +} + +void ConfigureDialog::setSettings(const RepositorySettings &settings) +{ + d->m_settings = settings; + d->updateUi(); +} + +void ConfigureDialog::changeEvent(QEvent *e) +{ + QDialog::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + d->m_ui.retranslateUi(this); + break; + default: + break; + } +} + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/configuredialog.h b/plugins/fossil/configuredialog.h new file mode 100644 index 00000000000..fe725701a7b --- /dev/null +++ b/plugins/fossil/configuredialog.h @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include + +namespace Fossil { +namespace Internal { + +struct RepositorySettings; +class ConfigureDialogPrivate; + +class ConfigureDialog : public QDialog +{ + Q_OBJECT + +public: + explicit ConfigureDialog(QWidget *parent = nullptr); + ~ConfigureDialog() final; + + const RepositorySettings settings() const; + void setSettings(const RepositorySettings &settings); + +protected: + void changeEvent(QEvent *e) final; + +private: + ConfigureDialogPrivate *d = nullptr; +}; + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/configuredialog.ui b/plugins/fossil/configuredialog.ui new file mode 100644 index 00000000000..d68ad2f6b5f --- /dev/null +++ b/plugins/fossil/configuredialog.ui @@ -0,0 +1,132 @@ + + + Fossil::Internal::ConfigureDialog + + + + 0 + 0 + 385 + 202 + + + + Configure Repository + + + + + + Repository User + + + + + + User: + + + + + + + Existing user to become an author of changes made to the repository. + + + + + + + + + + Repository Settings + + + + + + SSL/TLS identity: + + + + + + + SSL/TLS client identity key to use if requested by the server. + + + + + + + Disable automatic pull prior to commit or update and automatic push after commit or tag or branch creation. + + + Disable auto-sync + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + Utils::PathChooser + QWidget +
utils/pathchooser.h
+ 1 + + editingFinished() + browsingFinished() + +
+
+ + + + buttonBox + accepted() + Fossil::Internal::ConfigureDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Fossil::Internal::ConfigureDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +
diff --git a/plugins/fossil/constants.h b/plugins/fossil/constants.h new file mode 100644 index 00000000000..b18a85ed571 --- /dev/null +++ b/plugins/fossil/constants.h @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include + +namespace Fossil { +namespace Constants { + +const char VCS_ID_FOSSIL[] = "I.Fossil"; + +const char FOSSIL[] = "fossil"; +#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) +const char FOSSILREPO[] = "_FOSSIL_"; +#else +const char FOSSILREPO[] = ".fslckout"; +#endif +const char FOSSILDEFAULT[] = "fossil"; +const char FOSSIL_CONTEXT[] = "Fossil Context"; + +const char FOSSIL_FILE_SUFFIX[] = ".fossil"; +const char FOSSIL_FILE_FILTER[] = "Fossil Repositories (*.fossil *.fsl);;All Files (*)"; + +//changeset identifiers +const char CHANGESET_ID[] = "([0-9a-f]{5,40})"; // match and capture +const char CHANGESET_ID_EXACT[] = "[0-9a-f]{5,40}"; // match + +//diff chunk identifiers +const char DIFFFILE_ID_EXACT[] = "[+]{3} (.*)\\s*"; // match and capture + +//BaseEditorParameters +const char FILELOG_ID[] = "Fossil File Log Editor"; +const char FILELOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Fossil File Log Editor"); +const char LOGAPP[] = "text/vnd.qtcreator.fossil.log"; + +const char ANNOTATELOG_ID[] = "Fossil Annotation Editor"; +const char ANNOTATELOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Fossil Annotation Editor"); +const char ANNOTATEAPP[] = "text/vnd.qtcreator.fossil.annotation"; + +const char DIFFLOG_ID[] = "Fossil Diff Editor"; +const char DIFFLOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Fossil Diff Editor"); +const char DIFFAPP[] = "text/x-patch"; + +//SubmitEditorParameters +const char COMMIT_ID[] = "Fossil Commit Log Editor"; +const char COMMIT_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Fossil Commit Log Editor"); +const char COMMITMIMETYPE[] = "text/vnd.qtcreator.fossil.commit"; + +//menu items +//File menu actions +const char ADD[] = "Fossil.AddSingleFile"; +const char DELETE[] = "Fossil.DeleteSingleFile"; +const char ANNOTATE[] = "Fossil.Annotate"; +const char DIFF[] = "Fossil.DiffSingleFile"; +const char LOG[] = "Fossil.LogSingleFile"; +const char REVERT[] = "Fossil.RevertSingleFile"; +const char STATUS[] = "Fossil.Status"; + +//directory menu Actions +const char DIFFMULTI[] = "Fossil.Action.DiffMulti"; +const char REVERTMULTI[] = "Fossil.Action.RevertAll"; +const char STATUSMULTI[] = "Fossil.Action.StatusMulti"; +const char LOGMULTI[] = "Fossil.Action.LogMulti"; + +//repository menu actions +const char PULL[] = "Fossil.Action.Pull"; +const char PUSH[] = "Fossil.Action.Push"; +const char UPDATE[] = "Fossil.Action.Update"; +const char COMMIT[] = "Fossil.Action.Commit"; +const char CONFIGURE_REPOSITORY[] = "Fossil.Action.Settings"; +const char CREATE_REPOSITORY[] = "Fossil.Action.CreateRepository"; + +//submit editor actions +const char DIFFEDITOR[] = "Fossil.Action.Editor.Diff"; + +// File status hint +const char FSTATUS_ADDED[] = "Added"; +const char FSTATUS_ADDED_BY_MERGE[] = "Added by Merge"; +const char FSTATUS_ADDED_BY_INTEGRATE[] = "Added by Integrate"; +const char FSTATUS_DELETED[] = "Deleted"; +const char FSTATUS_EDITED[] = "Edited"; +const char FSTATUS_UPDATED_BY_MERGE[] = "Updated by Merge"; +const char FSTATUS_UPDATED_BY_INTEGRATE[] = "Updated by Integrate"; +const char FSTATUS_RENAMED[] = "Renamed"; +const char FSTATUS_UNKNOWN[] = "Unknown"; + +// Fossil Json Wizards +const char WIZARD_PATH[] = ":/fossil/wizard"; + +} // namespace Constants +} // namespace Fossil diff --git a/plugins/fossil/fossil.pro b/plugins/fossil/fossil.pro new file mode 100644 index 00000000000..31946520b1a --- /dev/null +++ b/plugins/fossil/fossil.pro @@ -0,0 +1,45 @@ +isEmpty(IDE_SOURCE_TREE): IDE_SOURCE_TREE = $$(QTC_SOURCE) +isEmpty(IDE_SOURCE_TREE): error("You need to set the environment variable QTC_SOURCE to point to the directory where the Qt Creator sources are") + +isEmpty(IDE_BUILD_TREE): IDE_BUILD_TREE = $$(QTC_BUILD) +isEmpty(IDE_BUILD_TREE): error("You need to set the environment variable QTC_BUILD to point to the directory where Qt Creator was built") + +include($$IDE_SOURCE_TREE/src/qtcreatorplugin.pri) +SOURCES += \ + fossilclient.cpp \ + fossilcontrol.cpp \ + fossilplugin.cpp \ + optionspage.cpp \ + fossilsettings.cpp \ + commiteditor.cpp \ + fossilcommitwidget.cpp \ + fossileditor.cpp \ + annotationhighlighter.cpp \ + pullorpushdialog.cpp \ + branchinfo.cpp \ + configuredialog.cpp \ + revisioninfo.cpp \ + wizard/fossiljsextension.cpp +HEADERS += \ + fossilclient.h \ + constants.h \ + fossilcontrol.h \ + fossilplugin.h \ + optionspage.h \ + fossilsettings.h \ + commiteditor.h \ + fossilcommitwidget.h \ + fossileditor.h \ + annotationhighlighter.h \ + pullorpushdialog.h \ + branchinfo.h \ + configuredialog.h \ + revisioninfo.h \ + wizard/fossiljsextension.h +FORMS += \ + optionspage.ui \ + revertdialog.ui \ + fossilcommitpanel.ui \ + pullorpushdialog.ui \ + configuredialog.ui +RESOURCES += fossil.qrc diff --git a/plugins/fossil/fossil.qrc b/plugins/fossil/fossil.qrc new file mode 100644 index 00000000000..4e195731423 --- /dev/null +++ b/plugins/fossil/fossil.qrc @@ -0,0 +1,6 @@ + + + wizard/projects/vcs/icon.png + wizard/projects/vcs/wizard.json + + diff --git a/plugins/fossil/fossil_dependencies.pri b/plugins/fossil/fossil_dependencies.pri new file mode 100644 index 00000000000..44d52129d93 --- /dev/null +++ b/plugins/fossil/fossil_dependencies.pri @@ -0,0 +1,9 @@ +QTC_PLUGIN_NAME = Fossil +QTC_LIB_DEPENDS += \ + extensionsystem \ + utils +QTC_PLUGIN_DEPENDS += \ + texteditor \ + projectexplorer \ + coreplugin \ + vcsbase diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp new file mode 100644 index 00000000000..6e881660545 --- /dev/null +++ b/plugins/fossil/fossilclient.cpp @@ -0,0 +1,1201 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "fossilclient.h" +#include "constants.h" + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace Fossil { +namespace Internal { + +// Parameter widget controlling whitespace diff mode, associated with a parameter +class FossilDiffConfig : public VcsBase::VcsBaseEditorConfig +{ + Q_OBJECT + +public: + FossilDiffConfig(FossilClient *client, QToolBar *toolBar) : + VcsBase::VcsBaseEditorConfig(toolBar) + { + QTC_ASSERT(client, return); + + VcsBase::VcsBaseClientSettings &settings = client->settings(); + FossilClient::SupportedFeatures features = client->supportedFeatures(); + + if (features.testFlag(FossilClient::DiffIgnoreWhiteSpaceFeature)) { + mapSetting(addToggleButton("-w", tr("Ignore All Whitespace")), + settings.boolPointer(FossilSettings::diffIgnoreAllWhiteSpaceKey)); + mapSetting(addToggleButton("--strip-trailing-cr", tr("Strip Trailing CR")), + settings.boolPointer(FossilSettings::diffStripTrailingCRKey)); + } + } +}; + +// Parameter widget controlling annotate/blame mode +class FossilAnnotateConfig : public VcsBase::VcsBaseEditorConfig +{ + Q_OBJECT + +public: + FossilAnnotateConfig(FossilClient *client, QToolBar *toolBar) : + VcsBase::VcsBaseEditorConfig(toolBar) + { + QTC_ASSERT(client, return); + + VcsBase::VcsBaseClientSettings &settings = client->settings(); + FossilClient::SupportedFeatures features = client->supportedFeatures(); + + if (features.testFlag(FossilClient::AnnotateBlameFeature)) { + mapSetting(addToggleButton("|BLAME|", tr("Show Committers")), + settings.boolPointer(FossilSettings::annotateShowCommittersKey)); + } + } +}; + +class FossilLogCurrentFileConfig : public VcsBase::VcsBaseEditorConfig +{ + Q_OBJECT + +public: + FossilLogCurrentFileConfig(FossilClient *client, QToolBar *toolBar) : + VcsBase::VcsBaseEditorConfig(toolBar) + { + QTC_ASSERT(client, return); + } + +}; + +class FossilLogConfig : public VcsBase::VcsBaseEditorConfig +{ + Q_OBJECT + +public: + FossilLogConfig(FossilClient *client, QToolBar *toolBar) : + VcsBase::VcsBaseEditorConfig(toolBar), + m_client(client) + { + QTC_ASSERT(client, return); + + addLineageComboBox(); + addVerboseToggleButton(); + addItemTypeComboBox(); + } + + void addLineageComboBox() + { + VcsBase::VcsBaseClientSettings &settings = m_client->settings(); + + // ancestors/descendants filter + // This is a positional argument not an option. + // Normally it takes the checkin/branch/tag as an additional parameter + // (trunk by default) + // So we kludge this by coding it as a meta-option (pipe-separated), + // then parse it out in arguments. + // All-choice is a blank argument with no additional parameters + QList lineageFilterChoices; + lineageFilterChoices << ComboBoxItem(tr("Ancestors"), "ancestors") + << ComboBoxItem(tr("Descendants"), "descendants") + << ComboBoxItem(tr("Unfiltered"), ""); + mapSetting(addComboBox(QStringList("|LINEAGE|%1|current"), lineageFilterChoices), + settings.stringPointer(FossilSettings::timelineLineageFilterKey)); + } + + void addVerboseToggleButton() + { + VcsBase::VcsBaseClientSettings &settings = m_client->settings(); + + // show files + mapSetting(addToggleButton("-showfiles", tr("Verbose"), + tr("Show files changed in each revision")), + settings.boolPointer(FossilSettings::timelineVerboseKey)); + } + + void addItemTypeComboBox() + { + VcsBase::VcsBaseClientSettings &settings = m_client->settings(); + + // option: -t + const QList itemTypeChoices = { + ComboBoxItem(tr("All Items"), "all"), + ComboBoxItem(tr("File Commits"), "ci"), + ComboBoxItem(tr("Technical Notes"), "e"), + ComboBoxItem(tr("Tags"), "g"), + ComboBoxItem(tr("Tickets"), "t"), + ComboBoxItem(tr("Wiki Commits"), "w") + }; + + // here we setup the ComboBox to map to the "-t ", which will produce + // the enquoted option-values (e.g "-t all"). + // Fossil expects separate arguments for option and value ( i.e. "-t" "all") + // so we need to handle the splitting explicitly in arguments(). + mapSetting(addComboBox(QStringList("-t %1"), itemTypeChoices), + settings.stringPointer(FossilSettings::timelineItemTypeKey)); + } + + QStringList arguments() const final + { + QStringList args; + + // split "-t val" => "-t" "val" + foreach (const QString &arg, VcsBaseEditorConfig::arguments()) { + if (arg.startsWith("-t")) { + args << arg.split(' '); + + } else if (arg.startsWith('|')){ + // meta-option: "|OPT|val|extra1|..." + QStringList params = arg.split('|'); + QString option = params[1]; + for (int i = 2; i < params.size(); ++i) { + if (option == "LINEAGE" && params[i].isEmpty()) { + // empty lineage filter == Unfiltered + break; + } + args << params[i]; + } + + } else { + args << arg; + } + } + + return args; + } + +private: + FossilClient *m_client; +}; + +unsigned FossilClient::makeVersionNumber(int major, int minor, int patch) +{ + return (QString().setNum(major).toUInt(0,16) << 16) + + (QString().setNum(minor).toUInt(0,16) << 8) + + (QString().setNum(patch).toUInt(0,16)); +} + +static inline QString versionPart(unsigned part) +{ + return QString::number(part & 0xff, 16); +} + +QString FossilClient::makeVersionString(unsigned version) +{ + return QString::fromLatin1("%1.%2.%3") + .arg(versionPart(version >> 16)) + .arg(versionPart(version >> 8)) + .arg(versionPart(version)); +} + +FossilClient::FossilClient() : VcsBase::VcsBaseClient(new FossilSettings) +{ + setDiffConfigCreator([this](QToolBar *toolBar) { + return new FossilDiffConfig(this, toolBar); + }); +} + +unsigned int FossilClient::synchronousBinaryVersion() const +{ + if (settings().binaryPath().isEmpty()) + return 0; + + QStringList args("version"); + + const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(QString(), args); + if (response.result != Utils::SynchronousProcessResponse::Finished) + return 0; + + QString output = response.stdOut(); + output = output.trimmed(); + + // fossil version: + // "This is fossil version 1.27 [ccdefa355b] 2013-09-30 11:47:18 UTC" + QRegularExpression versionPattern("(\\d+)\\.(\\d+)"); + QTC_ASSERT(versionPattern.isValid(), return 0); + QRegularExpressionMatch versionMatch = versionPattern.match(output); + QTC_ASSERT(versionMatch.hasMatch(), return 0); + const int major = versionMatch.captured(1).toInt(); + const int minor = versionMatch.captured(2).toInt(); + const int patch = 0; + return makeVersionNumber(major,minor,patch); +} + +QList FossilClient::branchListFromOutput(const QString &output, const BranchInfo::BranchFlags defaultFlags) +{ + // Branch list format: + // " branch-name" + // "* current-branch" + return Utils::transform(output.split('\n', QString::SkipEmptyParts), [=](const QString& l) { + const QString &name = l.mid(2); + QTC_ASSERT(!name.isEmpty(), return BranchInfo()); + const BranchInfo::BranchFlags flags = (l.startsWith("* ") ? defaultFlags | BranchInfo::Current : defaultFlags); + return BranchInfo(name, flags); + }); +} + +BranchInfo FossilClient::synchronousCurrentBranch(const QString &workingDirectory) +{ + if (workingDirectory.isEmpty()) + return BranchInfo(); + + // First try to get the current branch from the list of open branches + const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, {"branch", "list"}); + if (response.result != Utils::SynchronousProcessResponse::Finished) + return BranchInfo(); + + const QString output = sanitizeFossilOutput(response.stdOut()); + BranchInfo currentBranch = Utils::findOrDefault(branchListFromOutput(output), [](const BranchInfo &b) { + return b.isCurrent(); + }); + + if (!currentBranch.isCurrent()) { + // If not available from open branches, request it from the list of closed branches. + const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, {"branch", "list", "--closed"}); + if (response.result != Utils::SynchronousProcessResponse::Finished) + return BranchInfo(); + + const QString output = sanitizeFossilOutput(response.stdOut()); + currentBranch = Utils::findOrDefault(branchListFromOutput(output, BranchInfo::Closed), [](const BranchInfo &b) { + return b.isCurrent(); + }); + } + + return currentBranch; +} + +QList FossilClient::synchronousBranchQuery(const QString &workingDirectory) +{ + // Return a list of all branches, including the closed ones. + // Sort the list by branch name. + + if (workingDirectory.isEmpty()) + return QList(); + + // First get list of open branches + Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, {"branch", "list"}); + if (response.result != Utils::SynchronousProcessResponse::Finished) + return QList(); + + QString output = sanitizeFossilOutput(response.stdOut()); + QList branches = branchListFromOutput(output); + + // Append a list of closed branches. + response = vcsFullySynchronousExec(workingDirectory, {"branch", "list", "--closed"}); + if (response.result != Utils::SynchronousProcessResponse::Finished) + return QList(); + + output = sanitizeFossilOutput(response.stdOut()); + branches.append(branchListFromOutput(output, BranchInfo::Closed)); + + std::sort(branches.begin(), branches.end(), + [](const BranchInfo &a, const BranchInfo &b) { return a.name() < b.name(); }); + return branches; +} + +RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirectory, const QString &id) +{ + // Query details of the given revision/check-out id, + // if none specified, provide information about current revision + if (workingDirectory.isEmpty()) + return RevisionInfo(); + + QStringList args("info"); + if (!id.isEmpty()) + args << id; + + const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); + if (response.result != Utils::SynchronousProcessResponse::Finished) + return RevisionInfo(); + + const QString output = sanitizeFossilOutput(response.stdOut()); + + QString revisionId; + QString parentId; + + const QRegularExpression idRx("([0-9a-f]{5,40})"); + QTC_ASSERT(idRx.isValid(), return RevisionInfo()); + + for (const QString &l : output.split('\n', QString::SkipEmptyParts)) { + if (l.startsWith("checkout: ", Qt::CaseInsensitive) + || l.startsWith("uuid: ", Qt::CaseInsensitive)) { + const QRegularExpressionMatch idMatch = idRx.match(l); + QTC_ASSERT(idMatch.hasMatch(), return RevisionInfo()); + revisionId = idMatch.captured(1); + + } else if (l.startsWith("parent: ", Qt::CaseInsensitive)){ + const QRegularExpressionMatch idMatch = idRx.match(l); + if (idMatch.hasMatch()) + parentId = idMatch.captured(1); + } + } + + // make sure id at least partially matches the retrieved revisionId + QTC_ASSERT(revisionId.startsWith(id, Qt::CaseInsensitive), return RevisionInfo()); + + if (parentId.isEmpty()) + parentId = revisionId; // root + + return RevisionInfo(revisionId, parentId); +} + +QStringList FossilClient::synchronousTagQuery(const QString &workingDirectory, const QString &id) +{ + // Return a list of tags for the given revision. + // If no revision specified, all defined tags are listed. + // Tag list includes branch names. + + if (workingDirectory.isEmpty()) + return QStringList(); + + QStringList args({"tag", "list"}); + + if (!id.isEmpty()) + args << id; + + const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); + if (response.result != Utils::SynchronousProcessResponse::Finished) + return QStringList(); + + const QString output = sanitizeFossilOutput(response.stdOut()); + + return output.split('\n', QString::SkipEmptyParts); +} + +RepositorySettings FossilClient::synchronousSettingsQuery(const QString &workingDirectory) +{ + if (workingDirectory.isEmpty()) + return RepositorySettings(); + + RepositorySettings repoSettings; + + repoSettings.user = synchronousUserDefaultQuery(workingDirectory); + if (repoSettings.user.isEmpty()) + repoSettings.user = settings().stringValue(FossilSettings::userNameKey); + + const QStringList args("settings"); + + const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); + if (response.result != Utils::SynchronousProcessResponse::Finished) + return RepositorySettings(); + + const QString output = sanitizeFossilOutput(response.stdOut()); + + for (const QString &line : output.split('\n', QString::SkipEmptyParts)) { + // parse settings line: + // <(local|global)> + // Fossil properties are case-insensitive; force them to lower-case. + // Values may be in mixed-case; force lower-case for fixed values. + const QStringList fields = line.split(' ', QString::SkipEmptyParts); + + const QString property = fields.at(0).toLower(); + const QString value = (fields.size() >= 3 ? fields.at(2) : QString()); + const QString lcValue = value.toLower(); + + if (property == "autosync") { + if (lcValue == "on" + || lcValue == "1") + repoSettings.autosync = RepositorySettings::AutosyncOn; + else if (lcValue == "off" + || lcValue == "0") + repoSettings.autosync = RepositorySettings::AutosyncOff; + else if (lcValue == "pullonly" + || lcValue == "2") + repoSettings.autosync = RepositorySettings::AutosyncPullOnly; + } + + if (property == "ssl-identity") { + repoSettings.sslIdentityFile = value; + } + } + + return repoSettings; +} + +bool FossilClient::synchronousSetSetting(const QString &workingDirectory, + const QString &property, const QString &value, bool isGlobal) +{ + // set a repository property to the given value + // if no value is given, unset the property + + if (workingDirectory.isEmpty() || property.isEmpty()) + return false; + + QStringList args; + if (value.isEmpty()) + args << "unset" << property; + else + args << "settings" << property << value; + + if (isGlobal) + args << "--global"; + + const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); + return (response.result == Utils::SynchronousProcessResponse::Finished); +} + + +bool FossilClient::synchronousConfigureRepository(const QString &workingDirectory, const RepositorySettings &newSettings, + const RepositorySettings ¤tSettings) +{ + if (workingDirectory.isEmpty()) + return false; + + // apply updated settings vs. current setting if given + const bool applyAll = (currentSettings == RepositorySettings()); + + if (!newSettings.user.isEmpty() + && (applyAll + || newSettings.user != currentSettings.user) + && !synchronousSetUserDefault(workingDirectory, newSettings.user)){ + return false; + } + + if ((applyAll + || newSettings.sslIdentityFile != currentSettings.sslIdentityFile) + && !synchronousSetSetting(workingDirectory, "ssl-identity", newSettings.sslIdentityFile)){ + return false; + } + + if (applyAll + || newSettings.autosync != currentSettings.autosync) { + QString value; + switch (newSettings.autosync) { + case RepositorySettings::AutosyncOff: + value = "off"; + break; + case RepositorySettings::AutosyncOn: + value = "on"; + break; + case RepositorySettings::AutosyncPullOnly: + value = "pullonly"; + break; + } + + if (!synchronousSetSetting(workingDirectory, "autosync", value)) + return false; + } + + return true; +} + +QString FossilClient::synchronousUserDefaultQuery(const QString &workingDirectory) +{ + if (workingDirectory.isEmpty()) + return QString(); + + const QStringList args({"user", "default"}); + + const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); + if (response.result != Utils::SynchronousProcessResponse::Finished) + return QString(); + + QString output = sanitizeFossilOutput(response.stdOut()); + + return output.trimmed(); +} + +bool FossilClient::synchronousSetUserDefault(const QString &workingDirectory, const QString &userName) +{ + if (workingDirectory.isEmpty() || userName.isEmpty()) + return false; + + // set repository-default user + const QStringList args({"user", "default", userName, "--user", userName}); + const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); + return (response.result == Utils::SynchronousProcessResponse::Finished); +} + +QString FossilClient::synchronousGetRepositoryURL(const QString &workingDirectory) +{ + if (workingDirectory.isEmpty()) + return QString(); + + const QStringList args("remote-url"); + + const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); + if (response.result != Utils::SynchronousProcessResponse::Finished) + return QString(); + + QString output = sanitizeFossilOutput(response.stdOut()); + output = output.trimmed(); + + // Fossil returns "off" when no remote-url is set. + if (output.isEmpty() || output.toLower() == "off") + return QString(); + + return output; +} + +struct TopicData +{ + QDateTime timeStamp; + QString topic; +}; + +QString FossilClient::synchronousTopic(const QString &workingDirectory) +{ + static QMap topicCache; + + if (workingDirectory.isEmpty()) + return QString(); + + // return current branch name + + const QString topLevel = findTopLevelForFile(workingDirectory); + const QFileInfo currentStateFile(topLevel + "/" + Constants::FOSSILREPO); + + TopicData &data = topicCache[workingDirectory]; + const QDateTime lastModified = currentStateFile.lastModified(); + if (lastModified == data.timeStamp) + return data.topic; + + const BranchInfo branchInfo = synchronousCurrentBranch(workingDirectory); + if (branchInfo.name().isEmpty()) + return QString(); + + data.timeStamp = lastModified; + data.topic = branchInfo.name(); + return data.topic; +} + +bool FossilClient::synchronousCreateRepository(const QString &workingDirectory, const QStringList &extraOptions) +{ + VcsBase::VcsOutputWindow *outputWindow = VcsBase::VcsOutputWindow::instance(); + + // init repository file of the same name as the working directory + // use the configured default repository location for path + // use the configured default user for admin + + const QString repoName = QDir(workingDirectory).dirName().simplified(); + const QString repoPath = settings().stringValue(FossilSettings::defaultRepoPathKey); + const QString adminUser = settings().stringValue(FossilSettings::userNameKey); + + if (repoName.isEmpty() || repoPath.isEmpty()) + return false; + + // @TODO: handle spaces in the path + // @TODO: what about --template options? + + const Utils::FileName repoFilePath = Utils::FileName::fromString(repoPath) + .appendPath(Utils::FileName::fromString(repoName, Constants::FOSSIL_FILE_SUFFIX).toString()); + QStringList args(vcsCommandString(CreateRepositoryCommand)); + if (!adminUser.isEmpty()) + args << "--admin-user" << adminUser; + args << extraOptions << repoFilePath.toUserOutput(); + Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); + if (response.result != Utils::SynchronousProcessResponse::Finished) + return false; + + QString output = sanitizeFossilOutput(response.stdOut()); + outputWindow->append(output); + + // check out the created repository file into the working directory + + args.clear(); + response.clear(); + output.clear(); + + args << "open" << repoFilePath.toUserOutput(); + response = vcsFullySynchronousExec(workingDirectory, args); + if (response.result != Utils::SynchronousProcessResponse::Finished) + return false; + + output = sanitizeFossilOutput(response.stdOut()); + outputWindow->append(output); + + // set user default to admin if specified + + if (!adminUser.isEmpty()) { + args.clear(); + response.clear(); + output.clear(); + + args << "user" << "default" << adminUser << "--user" << adminUser; + response = vcsFullySynchronousExec(workingDirectory, args); + if (response.result != Utils::SynchronousProcessResponse::Finished) + return false; + + QString output = sanitizeFossilOutput(response.stdOut()); + outputWindow->append(output); + } + + resetCachedVcsInfo(workingDirectory); + + return true; +} + +bool FossilClient::synchronousMove(const QString &workingDir, + const QString &from, const QString &to, + const QStringList &extraOptions) +{ + // Fossil move does not rename actual file on disk, only changes it in repo + // So try to move the actual file first, then move it in repo to preserve + // history in case actual move fails. + + if (!QFile::rename(from, to)) + return false; + + QStringList args(vcsCommandString(MoveCommand)); + args << extraOptions << from << to; + const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDir, args); + return (response.result == Utils::SynchronousProcessResponse::Finished); +} + +bool FossilClient::synchronousPull(const QString &workingDir, const QString &srcLocation, const QStringList &extraOptions) +{ + const QString remoteLocation = (!srcLocation.isEmpty() ? srcLocation : synchronousGetRepositoryURL(workingDir)); + if (remoteLocation.isEmpty()) + return false; + + QStringList args({vcsCommandString(PullCommand), remoteLocation}); + args << extraOptions; + // Disable UNIX terminals to suppress SSH prompting + const unsigned flags = + VcsBase::VcsCommand::SshPasswordPrompt + | VcsBase::VcsCommand::ShowStdOut + | VcsBase::VcsCommand::ShowSuccessMessage; + const Utils::SynchronousProcessResponse resp = vcsSynchronousExec(workingDir, args, flags); + const bool success = (resp.result == Utils::SynchronousProcessResponse::Finished); + if (success) + emit changed(QVariant(workingDir)); + return success; +} + +bool FossilClient::synchronousPush(const QString &workingDir, const QString &dstLocation, const QStringList &extraOptions) +{ + const QString remoteLocation = (!dstLocation.isEmpty() ? dstLocation : synchronousGetRepositoryURL(workingDir)); + if (remoteLocation.isEmpty()) + return false; + + QStringList args({vcsCommandString(PushCommand), remoteLocation}); + args << extraOptions; + // Disable UNIX terminals to suppress SSH prompting + const unsigned flags = + VcsBase::VcsCommand::SshPasswordPrompt + | VcsBase::VcsCommand::ShowStdOut + | VcsBase::VcsCommand::ShowSuccessMessage; + const Utils::SynchronousProcessResponse resp = vcsSynchronousExec(workingDir, args, flags); + return (resp.result == Utils::SynchronousProcessResponse::Finished); +} + +void FossilClient::commit(const QString &repositoryRoot, const QStringList &files, + const QString &commitMessageFile, const QStringList &extraOptions) +{ + VcsBaseClient::commit(repositoryRoot, files, commitMessageFile, + QStringList(extraOptions) << "-M" << commitMessageFile); +} + +VcsBase::VcsBaseEditorWidget *FossilClient::annotate( + const QString &workingDir, const QString &file, const QString &revision, + int lineNumber, const QStringList &extraOptions) +{ + // 'fossil annotate' command has a variant 'fossil blame'. + // blame command attributes a committing username to source lines, + // annotate shows line numbers + + QString vcsCmdString = vcsCommandString(AnnotateCommand); + const Core::Id kind = vcsEditorKind(AnnotateCommand); + const QString id = VcsBase::VcsBaseEditor::getSource(workingDir, QStringList(file)); + const QString title = vcsEditorTitle(vcsCmdString, id); + const QString source = VcsBase::VcsBaseEditor::getSource(workingDir, file); + + VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, + VcsBase::VcsBaseEditor::getCodec(source), + vcsCmdString.toLatin1().constData(), id); + QStringList effectiveArgs = extraOptions; + if (!editor->configurationAdded()) { + if (VcsBase::VcsBaseEditorConfig *editorConfig = createAnnotateEditor(editor)) { + // editor has been just created, createVcsEditor() didn't set a configuration widget yet + connect(editorConfig, &VcsBase::VcsBaseEditorConfig::commandExecutionRequested, + [=] { return this->annotate(workingDir, file, revision, lineNumber, extraOptions + editorConfig->arguments()); } ); + effectiveArgs += editorConfig->arguments(); + editor->setConfigurationAdded(); + } + } + + VcsBase::VcsCommand *cmd = createCommand(workingDir, editor); + cmd->setCookie(lineNumber); + + // here we introduce a "|BLAME|" meta-option to allow both annotate and blame modes + int pos = effectiveArgs.indexOf("|BLAME|"); + if (pos != -1) { + vcsCmdString = "blame"; + effectiveArgs.removeAt(pos); + } + QStringList args(vcsCmdString); + args << revisionSpec(revision) << effectiveArgs << "--log" << file; + + enqueueJob(cmd, args); + return editor; +} + +bool FossilClient::isVcsFileOrDirectory(const Utils::FileName &fileName) const +{ + // true for any dir or file other than fossil checkout db-file + return !(fileName.toFileInfo().isFile() + && fileName.fileName().compare(Constants::FOSSILREPO, Utils::HostOsInfo::fileNameCaseSensitivity())); +} + +QString FossilClient::findTopLevelForFile(const QFileInfo &file) const +{ + const QString repositoryCheckFile = Constants::FOSSILREPO; + return file.isDir() ? + VcsBase::VcsBasePlugin::findRepositoryForDirectory(file.absoluteFilePath(), + repositoryCheckFile) : + VcsBase::VcsBasePlugin::findRepositoryForDirectory(file.absolutePath(), + repositoryCheckFile); +} + +bool FossilClient::managesFile(const QString &workingDirectory, const QString &fileName) const +{ + const QStringList args({"finfo", fileName}); + const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); + if (response.result != Utils::SynchronousProcessResponse::Finished) + return false; + QString output = sanitizeFossilOutput(response.stdOut()); + return !output.startsWith("no history for file"); +} + +unsigned int FossilClient::binaryVersion() const +{ + static unsigned int cachedBinaryVersion = 0; + static QString cachedBinaryPath; + + const QString currentBinaryPath = settings().binaryPath().toString(); + + if (currentBinaryPath.isEmpty()) + return 0; + + // Invalidate cache on failed version result. + // Assume that fossil client options have been changed and will change again. + if (!cachedBinaryVersion + || currentBinaryPath != cachedBinaryPath) { + cachedBinaryVersion = synchronousBinaryVersion(); + if (cachedBinaryVersion) + cachedBinaryPath = currentBinaryPath; + else + cachedBinaryPath.clear(); + } + + return cachedBinaryVersion; +} + +QString FossilClient::binaryVersionString() const +{ + const unsigned int version = binaryVersion(); + + // Fossil itself does not report patch version, only maj.min + // Here we include the patch part for general convention consistency + + return makeVersionString(version); +} + +FossilClient::SupportedFeatures FossilClient::supportedFeatures() const +{ + // use for legacy client support to test for feature presence + // e.g. supportedFeatures().testFlag(TimelineWidthFeature) + + SupportedFeatures features = AllSupportedFeatures; // all inclusive by default (~0U) + + const unsigned int version = binaryVersion(); + + if (version < 0x13000) { + features &= ~TimelinePathFeature; + if (version < 0x12900) + features &= ~DiffIgnoreWhiteSpaceFeature; + if (version < 0x12800) { + features &= ~AnnotateBlameFeature; + features &= ~TimelineWidthFeature; + } + } + return features; +} + +void FossilClient::view(const QString &source, const QString &id, const QStringList &extraOptions) +{ + QStringList args("diff"); + + const QFileInfo fi(source); + const QString workingDirectory = fi.isFile() ? fi.absolutePath() : source; + + RevisionInfo revisionInfo = synchronousRevisionQuery(workingDirectory,id); + + args << "--from" << revisionInfo.parentId + << "--to" << revisionInfo.id + << "-v" + << extraOptions; + + const Core::Id kind = vcsEditorKind(DiffCommand); + const QString title = vcsEditorTitle(vcsCommandString(DiffCommand), id); + + VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, + VcsBase::VcsBaseEditor::getCodec(source), "view", id); + editor->setWorkingDirectory(workingDirectory); + + enqueueJob(createCommand(workingDirectory, editor), args); +} + +class FossilLogHighlighter : QSyntaxHighlighter +{ +public: + explicit FossilLogHighlighter(QTextDocument *parent); + virtual void highlightBlock(const QString &text) final; + +private: + const QRegularExpression m_revisionIdRx; + const QRegularExpression m_dateRx; +}; + +FossilLogHighlighter::FossilLogHighlighter(QTextDocument * parent) : + QSyntaxHighlighter(parent), + m_revisionIdRx(Constants::CHANGESET_ID), + m_dateRx("([0-9]{4}-[0-9]{2}-[0-9]{2})") +{ + QTC_CHECK(m_revisionIdRx.isValid()); + QTC_CHECK(m_dateRx.isValid()); +} + +void FossilLogHighlighter::highlightBlock(const QString &text) +{ + // Match the revision-ids and dates -- highlight them for convenience. + + // Format revision-ids + QRegularExpressionMatchIterator i = m_revisionIdRx.globalMatch(text); + while (i.hasNext()) { + const QRegularExpressionMatch revisionIdMatch = i.next(); + QTextCharFormat charFormat = format(0); + charFormat.setForeground(Qt::darkBlue); + //charFormat.setFontItalic(true); + setFormat(revisionIdMatch.capturedStart(0), revisionIdMatch.capturedLength(0), charFormat); + } + + // Format dates + i = m_dateRx.globalMatch(text); + while (i.hasNext()) { + const QRegularExpressionMatch dateMatch = i.next(); + QTextCharFormat charFormat = format(0); + charFormat.setForeground(Qt::darkBlue); + charFormat.setFontWeight(QFont::DemiBold); + setFormat(dateMatch.capturedStart(0), dateMatch.capturedLength(0), charFormat); + } +} + +void FossilClient::log(const QString &workingDir, const QStringList &files, + const QStringList &extraOptions, + bool enableAnnotationContextMenu) +{ + // Show timeline for both repository and a file or path (--path ) + // When used for log repository, the files list is empty + + // LEGACY:fallback to log current file with legacy clients + SupportedFeatures features = supportedFeatures(); + if (!files.isEmpty() + && !features.testFlag(TimelinePathFeature)) { + logCurrentFile(workingDir, files, extraOptions, enableAnnotationContextMenu); + return; + } + + const QString vcsCmdString = vcsCommandString(LogCommand); + const Core::Id kind = vcsEditorKind(LogCommand); + const QString id = VcsBase::VcsBaseEditor::getTitleId(workingDir, files); + const QString title = vcsEditorTitle(vcsCmdString, id); + const QString source = VcsBase::VcsBaseEditor::getSource(workingDir, files); + VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, + VcsBase::VcsBaseEditor::getCodec(source), + vcsCmdString.toLatin1().constData(), id); + editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu); + + QStringList effectiveArgs = extraOptions; + if (!editor->configurationAdded()) { + if (VcsBase::VcsBaseEditorConfig *editorConfig = createLogEditor(editor)) { + // editor has been just created, createVcsEditor() didn't set a configuration widget yet + connect(editorConfig, &VcsBase::VcsBaseEditorConfig::commandExecutionRequested, + [=]() { this->log(workingDir, files, extraOptions + editorConfig->arguments(), enableAnnotationContextMenu); } ); + effectiveArgs += editorConfig->arguments(); + editor->setConfigurationAdded(); + } + } + + //@TODO: move highlighter and widgets to fossil editor sources. + + new FossilLogHighlighter(editor->document()); + + QStringList args(vcsCmdString); + args << effectiveArgs; + if (!files.isEmpty()) + args << "--path" << files; + enqueueJob(createCommand(workingDir, editor), args); +} + +void FossilClient::logCurrentFile(const QString &workingDir, const QStringList &files, + const QStringList &extraOptions, + bool enableAnnotationContextMenu) +{ + // Show commit history for the given file/file-revision + // NOTE: 'fossil finfo' shows full history from all branches. + + // With newer clients, 'fossil timeline' can handle both repository and file + SupportedFeatures features = supportedFeatures(); + if (features.testFlag(TimelinePathFeature)) { + log(workingDir, files, extraOptions, enableAnnotationContextMenu); + return; + } + + const QString vcsCmdString = "finfo"; + const Core::Id kind = vcsEditorKind(LogCommand); + const QString id = VcsBase::VcsBaseEditor::getTitleId(workingDir, files); + const QString title = vcsEditorTitle(vcsCmdString, id); + const QString source = VcsBase::VcsBaseEditor::getSource(workingDir, files); + VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, + VcsBase::VcsBaseEditor::getCodec(source), + vcsCmdString.toLatin1().constData(), id); + editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu); + + QStringList effectiveArgs = extraOptions; + if (!editor->configurationAdded()) { + if (VcsBase::VcsBaseEditorConfig *editorConfig = createLogEditor(editor)) { + // editor has been just created, createVcsEditor() didn't set a configuration widget yet + connect(editorConfig, &VcsBase::VcsBaseEditorConfig::commandExecutionRequested, + [=]() { this->logCurrentFile(workingDir, files, extraOptions + editorConfig->arguments(), enableAnnotationContextMenu); } ); + effectiveArgs += editorConfig->arguments(); + editor->setConfigurationAdded(); + } + } + + //@TODO: move highlighter and widgets to fossil editor sources. + + new FossilLogHighlighter(editor->document()); + + QStringList args(vcsCmdString); + args << effectiveArgs << files; + enqueueJob(createCommand(workingDir, editor), args); +} + +void FossilClient::revertFile(const QString &workingDir, + const QString &file, + const QString &revision, + const QStringList &extraOptions) +{ + QStringList args(vcsCommandString(RevertCommand)); + if (!revision.isEmpty()) + args << "-r" << revision; + + args << extraOptions << file; + + // Indicate file list + VcsBase::VcsCommand *cmd = createCommand(workingDir); + cmd->setCookie(QStringList(workingDir + "/" + file)); + connect(cmd, &VcsBase::VcsCommand::success, this, &VcsBase::VcsBaseClient::changed, Qt::QueuedConnection); + enqueueJob(cmd, args); +} + +void FossilClient::revertAll(const QString &workingDir, const QString &revision, const QStringList &extraOptions) +{ + // Fossil allows whole tree revert to latest revision (effectively undoing uncommitted changes). + // However it disallows revert to a specific revision for the whole tree, only for selected files. + // Use checkout --force command for such case. + // NOTE: all uncommitted changes will not be backed up by checkout, unlike revert. + // Thus undo for whole tree revert should not be possible. + + QStringList args; + if (revision.isEmpty()) { + args << vcsCommandString(RevertCommand) + << extraOptions; + + } else { + args << "checkout" << revision + << "--force" + << extraOptions; + } + + // Indicate repository change + VcsBase::VcsCommand *cmd = createCommand(workingDir); + cmd->setCookie(QStringList(workingDir)); + connect(cmd, &VcsBase::VcsCommand::success, this, &VcsBase::VcsBaseClient::changed, Qt::QueuedConnection); + enqueueJob(createCommand(workingDir), args); +} + +QString FossilClient::sanitizeFossilOutput(const QString &output) const +{ +#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) + // Strip possible extra '\r' in output from the Fossil client on Windows. + + // Fossil client contained a long-standing bug which caused an extraneous '\r' + // added to output lines from certain commands in excess of the expected . + // While the output appeared normal on a terminal, in non-interactive context + // it would get incorrectly split, resulting in extra empty lines. + // Bug fix is fairly recent, so for compatibility we need to strip the '\r'. + QString result(output); + return result.remove('\r'); +#else + return output; +#endif +} + +QString FossilClient::vcsCommandString(VcsCommandTag cmd) const +{ + // override specific client commands + // otherwise return baseclient command + + switch (cmd) { + case RemoveCommand: return QString("rm"); + case MoveCommand: return QString("mv"); + case LogCommand: return QString("timeline"); + + default: return VcsBaseClient::vcsCommandString(cmd); + } +} + +Core::Id FossilClient::vcsEditorKind(VcsCommandTag cmd) const +{ + switch (cmd) { + case AnnotateCommand: + return Constants::ANNOTATELOG_ID; + case DiffCommand: + return Constants::DIFFLOG_ID; + case LogCommand: + return Constants::FILELOG_ID; + default: + return Core::Id(); + } +} + +QStringList FossilClient::revisionSpec(const QString &revision) const +{ + // Pass the revision verbatim. + // Fossil uses a variety of ways to spec the revisions. + // In most cases revision is passed directly (SHA1) or via tag. + // Tag name may need to be prefixed with tag: to disambiguate it from hex (beef). + // Handle the revision option per specific command (e.g. diff, revert ). + + QStringList args; + if (!revision.isEmpty()) + args << revision; + return args; +} + +FossilClient::StatusItem FossilClient::parseStatusLine(const QString &line) const +{ + StatusItem item; + + // Ref: fossil source 'src/checkin.c' status_report() + // Expect at least one non-leading blank space. + + int pos = line.indexOf(' '); + + if (line.isEmpty() || pos < 1) + return StatusItem(); + + QString label(line.left(pos)); + QString flags; + + if (label == "EDITED") + flags = Constants::FSTATUS_EDITED; + else if (label == "ADDED") + flags = Constants::FSTATUS_ADDED; + else if (label == "RENAMED") + flags = Constants::FSTATUS_RENAMED; + else if (label == "DELETED") + flags = Constants::FSTATUS_DELETED; + else if (label == "MISSING") + flags = "Missing"; + else if (label == "ADDED_BY_MERGE") + flags = Constants::FSTATUS_ADDED_BY_MERGE; + else if (label == "UPDATED_BY_MERGE") + flags = Constants::FSTATUS_UPDATED_BY_MERGE; + else if (label == "ADDED_BY_INTEGRATE") + flags = Constants::FSTATUS_ADDED_BY_INTEGRATE; + else if (label == "UPDATED_BY_INTEGRATE") + flags = Constants::FSTATUS_UPDATED_BY_INTEGRATE; + else if (label == "CONFLICT") + flags = "Conflict"; + else if (label == "EXECUTABLE") + flags = "Set Exec"; + else if (label == "SYMLINK") + flags = "Set Symlink"; + else if (label == "UNEXEC") + flags = "Unset Exec"; + else if (label == "UNLINK") + flags = "Unset Symlink"; + else if (label == "NOT_A_FILE") + flags = Constants::FSTATUS_UNKNOWN; + + + if (flags.isEmpty()) + return StatusItem(); + + // adjust the position to the last space before the file name + for (int size = line.size(); (pos+1) < size && line[pos+1].isSpace(); ++pos) {} + + item.flags = flags; + item.file = line.mid(pos + 1); + + return item; +} + +VcsBase::VcsBaseEditorConfig *FossilClient::createAnnotateEditor(VcsBase::VcsBaseEditorWidget *editor) +{ + return new FossilAnnotateConfig(this, editor->toolBar()); +} + +VcsBase::VcsBaseEditorConfig *FossilClient::createLogCurrentFileEditor(VcsBase::VcsBaseEditorWidget *editor) +{ + SupportedFeatures features = supportedFeatures(); + + if (features.testFlag(TimelinePathFeature)) + return createLogEditor(editor); + + return new FossilLogCurrentFileConfig(this, editor->toolBar()); +} + +VcsBase::VcsBaseEditorConfig *FossilClient::createLogEditor(VcsBase::VcsBaseEditorWidget *editor) +{ + return new FossilLogConfig(this, editor->toolBar()); +} + +} // namespace Internal +} // namespace Fossil + +#include "fossilclient.moc" diff --git a/plugins/fossil/fossilclient.h b/plugins/fossil/fossilclient.h new file mode 100644 index 00000000000..73420196cd4 --- /dev/null +++ b/plugins/fossil/fossilclient.h @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include "fossilsettings.h" +#include "branchinfo.h" +#include "revisioninfo.h" + +#include + +#include + +namespace Fossil { +namespace Internal { + +class FossilSettings; +class FossilControl; + +class FossilClient : public VcsBase::VcsBaseClient +{ + Q_OBJECT +public: + enum SupportedFeature { + AnnotateBlameFeature = 0x2, + TimelineWidthFeature = 0x4, + DiffIgnoreWhiteSpaceFeature = 0x8, + TimelinePathFeature = 0x10, + AllSupportedFeatures = // | all defined features + AnnotateBlameFeature + | TimelineWidthFeature + | DiffIgnoreWhiteSpaceFeature + | TimelinePathFeature + }; + Q_DECLARE_FLAGS(SupportedFeatures, SupportedFeature) + + static unsigned makeVersionNumber(int major, int minor, int patch); + static QString makeVersionString(unsigned version); + + FossilClient(); + + unsigned int synchronousBinaryVersion() const; + BranchInfo synchronousCurrentBranch(const QString &workingDirectory); + QList synchronousBranchQuery(const QString &workingDirectory); + RevisionInfo synchronousRevisionQuery(const QString &workingDirectory, const QString &id = QString()); + QStringList synchronousTagQuery(const QString &workingDirectory, const QString &id = QString()); + RepositorySettings synchronousSettingsQuery(const QString &workingDirectory); + bool synchronousSetSetting(const QString &workingDirectory, const QString &property, + const QString &value = QString(), bool isGlobal = false); + bool synchronousConfigureRepository(const QString &workingDirectory, const RepositorySettings &newSettings, + const RepositorySettings ¤tSettings = RepositorySettings()); + QString synchronousUserDefaultQuery(const QString &workingDirectory); + bool synchronousSetUserDefault(const QString &workingDirectory, const QString &userName); + QString synchronousGetRepositoryURL(const QString &workingDirectory); + QString synchronousTopic(const QString &workingDirectory); + bool synchronousCreateRepository(const QString &workingDirectory, + const QStringList &extraOptions = QStringList()) final; + bool synchronousMove(const QString &workingDir, + const QString &from, const QString &to, + const QStringList &extraOptions = QStringList()) final; + bool synchronousPull(const QString &workingDir, + const QString &srcLocation, + const QStringList &extraOptions = QStringList()) final; + bool synchronousPush(const QString &workingDir, + const QString &dstLocation, + const QStringList &extraOptions = QStringList()) final; + void commit(const QString &repositoryRoot, const QStringList &files, + const QString &commitMessageFile, const QStringList &extraOptions = QStringList()) final; + VcsBase::VcsBaseEditorWidget *annotate( + const QString &workingDir, const QString &file, const QString &revision = QString(), + int lineNumber = -1, const QStringList &extraOptions = QStringList()) final; + void log(const QString &workingDir, const QStringList &files = QStringList(), + const QStringList &extraOptions = QStringList(), + bool enableAnnotationContextMenu = false) final; + void logCurrentFile(const QString &workingDir, const QStringList &files = QStringList(), + const QStringList &extraOptions = QStringList(), + bool enableAnnotationContextMenu = false); + void revertFile(const QString &workingDir, const QString &file, + const QString &revision = QString(), + const QStringList &extraOptions = QStringList()) final; + void revertAll(const QString &workingDir, const QString &revision = QString(), + const QStringList &extraOptions = QStringList()) final; + bool isVcsFileOrDirectory(const Utils::FileName &fileName) const; + QString findTopLevelForFile(const QFileInfo &file) const final; + bool managesFile(const QString &workingDirectory, const QString &fileName) const; + unsigned int binaryVersion() const; + QString binaryVersionString() const; + SupportedFeatures supportedFeatures() const; + void view(const QString &source, const QString &id, + const QStringList &extraOptions = QStringList()) final; + +private: + static QList branchListFromOutput(const QString &output, const BranchInfo::BranchFlags defaultFlags = 0); + + QString sanitizeFossilOutput(const QString &output) const; + QString vcsCommandString(VcsCommandTag cmd) const final; + Core::Id vcsEditorKind(VcsCommandTag cmd) const final; + QStringList revisionSpec(const QString &revision) const final; + StatusItem parseStatusLine(const QString &line) const final; + VcsBase::VcsBaseEditorConfig *createAnnotateEditor(VcsBase::VcsBaseEditorWidget *editor); + VcsBase::VcsBaseEditorConfig *createLogCurrentFileEditor(VcsBase::VcsBaseEditorWidget *editor); + VcsBase::VcsBaseEditorConfig *createLogEditor(VcsBase::VcsBaseEditorWidget *editor); + + friend class FossilControl; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(FossilClient::SupportedFeatures) + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/fossilcommitpanel.ui b/plugins/fossil/fossilcommitpanel.ui new file mode 100644 index 00000000000..b08e7883a5f --- /dev/null +++ b/plugins/fossil/fossilcommitpanel.ui @@ -0,0 +1,177 @@ + + + Fossil::Internal::FossilCommitPanel + + + + 0 + 0 + 374 + 270 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Current Information + + + + QFormLayout::ExpandingFieldsGrow + + + + + Local root: + + + + + + + Qt::NoFocus + + + true + + + + + + + Branch: + + + + + + + Qt::NoFocus + + + true + + + + + + + Tags: + + + + + + + Qt::NoFocus + + + true + + + + + + + + + + Commit Information + + + + + + New branch: + + + + + + + + + + + 50 + 20 + + + + + + + :/projectexplorer/images/compile_error.png + + + + + + + Create a private check-in that is never synced. +Children of private check-ins are automatically private. +Private check-ins are not pushed to the remote repository by default. + + + Private + + + + + + + Tags: + + + + + + + Tag names to apply; comma-separated. + + + + + + + Author: + + + + + + + + + + Qt::Horizontal + + + + 160 + 20 + + + + + + + + + + + + diff --git a/plugins/fossil/fossilcommitwidget.cpp b/plugins/fossil/fossilcommitwidget.cpp new file mode 100644 index 00000000000..8e831274dd5 --- /dev/null +++ b/plugins/fossil/fossilcommitwidget.cpp @@ -0,0 +1,169 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "fossilcommitwidget.h" +#include "branchinfo.h" + +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +namespace Fossil { +namespace Internal { + +// Retrieve the comment char format from the text editor. +static QTextCharFormat commentFormat() +{ + const TextEditor::FontSettings settings = TextEditor::TextEditorSettings::instance()->fontSettings(); + return settings.toTextCharFormat(TextEditor::C_COMMENT); +} + +// Highlighter for Fossil submit messages. +// Marks up [ticket-id] fields in the message. +class FossilSubmitHighlighter : QSyntaxHighlighter +{ +public: + explicit FossilSubmitHighlighter(Utils::CompletingTextEdit *parent); + void highlightBlock(const QString &text) final; + +private: + const QTextCharFormat m_commentFormat; + const QRegularExpression m_keywordPattern; +}; + +FossilSubmitHighlighter::FossilSubmitHighlighter(Utils::CompletingTextEdit *parent) : QSyntaxHighlighter(parent), + m_commentFormat(commentFormat()), + m_keywordPattern("\\[([0-9a-f]{5,40})\\]") +{ + QTC_CHECK(m_keywordPattern.isValid()); +} + +void FossilSubmitHighlighter::highlightBlock(const QString &text) +{ + // Fossil commit message allows listing of [ticket-id], + // where ticket-id is a partial SHA1. + // Match the ticket-ids and highlight them for convenience. + + // Format keywords + QRegularExpressionMatchIterator i = m_keywordPattern.globalMatch(text); + while (i.hasNext()) { + const QRegularExpressionMatch keywordMatch = i.next(); + QTextCharFormat charFormat = format(0); + charFormat.setFontItalic(true); + setFormat(keywordMatch.capturedStart(0), keywordMatch.capturedLength(0), charFormat); + } +} + + +FossilCommitWidget::FossilCommitWidget() : m_commitPanel(new QWidget) +{ + m_commitPanelUi.setupUi(m_commitPanel); + insertTopWidget(m_commitPanel); + new FossilSubmitHighlighter(descriptionEdit()); + m_branchValidator = new QRegularExpressionValidator(QRegularExpression("[^\\n]*"), this); + + connect(m_commitPanelUi.branchLineEdit, &QLineEdit::textChanged, + this, &FossilCommitWidget::branchChanged); +} + +void FossilCommitWidget::setFields(const QString &repoPath, const BranchInfo &branch, + const QStringList &tags, const QString &userName) +{ + m_commitPanelUi.localRootLineEdit->setText(QDir::toNativeSeparators(repoPath)); + m_commitPanelUi.currentBranchLineEdit->setText(branch.name()); + const QString tagsText = tags.join(", "); + m_commitPanelUi.currentTagsLineEdit->setText(tagsText); + m_commitPanelUi.authorLineEdit->setText(userName); + + branchChanged(); +} + +QString FossilCommitWidget::newBranch() const +{ + const QString branchName = m_commitPanelUi.branchLineEdit->text().trimmed(); + return branchName; +} + +QStringList FossilCommitWidget::tags() const +{ + QString tagsText = m_commitPanelUi.tagsLineEdit->text().trimmed(); + if (tagsText.isEmpty()) + return QStringList(); + + tagsText.replace(',', ' '); + const QStringList tags = tagsText.split(' ', QString::SkipEmptyParts); + return tags; +} + +QString FossilCommitWidget::committer() const +{ + const QString author = m_commitPanelUi.authorLineEdit->text(); + if (author.isEmpty()) + return QString(); + + const QString user = author; + return user; +} + +bool FossilCommitWidget::isPrivateOptionEnabled() const +{ + return m_commitPanelUi.isPrivateCheckBox->isChecked(); +} + +bool FossilCommitWidget::canSubmit() const +{ + QString message = cleanupDescription(descriptionText()).trimmed(); + + if (m_commitPanelUi.invalidBranchLabel->isVisible() || message.isEmpty()) + return false; + + return VcsBase::SubmitEditorWidget::canSubmit(); +} + +void FossilCommitWidget::branchChanged() +{ + m_commitPanelUi.invalidBranchLabel->setVisible(!isValidBranch()); + + updateSubmitAction(); +} + +bool FossilCommitWidget::isValidBranch() const +{ + int pos = m_commitPanelUi.branchLineEdit->cursorPosition(); + QString text = m_commitPanelUi.branchLineEdit->text(); + return m_branchValidator->validate(text, pos) == QValidator::Acceptable; +} + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/fossilcommitwidget.h b/plugins/fossil/fossilcommitwidget.h new file mode 100644 index 00000000000..55ef70f6308 --- /dev/null +++ b/plugins/fossil/fossilcommitwidget.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include "ui_fossilcommitpanel.h" + +#include + +QT_BEGIN_NAMESPACE +class QValidator; +QT_END_NAMESPACE + + +namespace Fossil { +namespace Internal { + +class BranchInfo; + +/*submit editor widget based on git SubmitEditor + Some extra fields have been added to the standard SubmitEditorWidget, + to help to conform to the commit style that is used by both git and Fossil*/ + +class FossilCommitWidget : public VcsBase::SubmitEditorWidget +{ + Q_OBJECT + +public: + FossilCommitWidget(); + + void setFields(const QString &repoPath, + const BranchInfo &newBranch, const QStringList &tags, const QString &userName); + + QString newBranch() const; + QStringList tags() const; + QString committer() const; + bool isPrivateOptionEnabled() const; + +protected: + bool canSubmit() const; + +private slots: + void branchChanged(); + +private: + bool isValidBranch() const; + + QWidget *m_commitPanel; + Ui::FossilCommitPanel m_commitPanelUi; + QValidator *m_branchValidator; +}; + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/fossilcontrol.cpp b/plugins/fossil/fossilcontrol.cpp new file mode 100644 index 00000000000..45ef0c2fb6b --- /dev/null +++ b/plugins/fossil/fossilcontrol.cpp @@ -0,0 +1,289 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "constants.h" +#include "fossilcontrol.h" +#include "fossilclient.h" +#include "fossilplugin.h" +#include "wizard/fossiljsextension.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +using namespace Fossil::Internal; + +FossilControl::FossilControl(FossilClient *client) : + m_client(client) +{ } + +QString FossilControl::displayName() const +{ + return tr("Fossil"); +} + +Core::Id FossilControl::id() const +{ + return Core::Id(Constants::VCS_ID_FOSSIL); +} + +bool FossilControl::isVcsFileOrDirectory(const Utils::FileName &fileName) const +{ + return m_client->isVcsFileOrDirectory(fileName); +} + +bool FossilControl::managesDirectory(const QString &directory, QString *topLevel) const +{ + QFileInfo dir(directory); + const QString topLevelFound = m_client->findTopLevelForFile(dir); + if (topLevel) + *topLevel = topLevelFound; + return !topLevelFound.isEmpty(); +} + +bool FossilControl::managesFile(const QString &workingDirectory, const QString &fileName) const +{ + return m_client->managesFile(workingDirectory, fileName); +} + +bool FossilControl::isConfigured() const +{ + const Utils::FileName binary = m_client->vcsBinary(); + if (binary.isEmpty()) + return false; + + const QFileInfo fi = binary.toFileInfo(); + if ( !(fi.exists() && fi.isFile() && fi.isExecutable()) ) + return false; + + // Local repositories default path must be set and exist + const QString repoPath = m_client->settings().stringValue(FossilSettings::defaultRepoPathKey); + if (repoPath.isEmpty()) + return false; + + const QDir dir(repoPath); + if (!dir.exists()) + return false; + + return true; +} + +bool FossilControl::supportsOperation(Operation operation) const +{ + bool supported = isConfigured(); + + switch (operation) { + case Core::IVersionControl::AddOperation: + case Core::IVersionControl::DeleteOperation: + case Core::IVersionControl::MoveOperation: + case Core::IVersionControl::CreateRepositoryOperation: + case Core::IVersionControl::AnnotateOperation: + case Core::IVersionControl::InitialCheckoutOperation: + break; + case Core::IVersionControl::SnapshotOperations: + supported = false; + break; + } + return supported; +} + +bool FossilControl::vcsOpen(const QString &filename) +{ + Q_UNUSED(filename) + return true; +} + +bool FossilControl::vcsAdd(const QString &filename) +{ + const QFileInfo fi(filename); + return m_client->synchronousAdd(fi.absolutePath(), fi.fileName()); +} + +bool FossilControl::vcsDelete(const QString &filename) +{ + const QFileInfo fi(filename); + return m_client->synchronousRemove(fi.absolutePath(), fi.fileName()); +} + +bool FossilControl::vcsMove(const QString &from, const QString &to) +{ + const QFileInfo fromInfo(from); + const QFileInfo toInfo(to); + return m_client->synchronousMove(fromInfo.absolutePath(), + fromInfo.absoluteFilePath(), + toInfo.absoluteFilePath()); +} + +bool FossilControl::vcsCreateRepository(const QString &directory) +{ + return m_client->synchronousCreateRepository(directory); +} + +bool FossilControl::vcsAnnotate(const QString &file, int line) +{ + const QFileInfo fi(file); + m_client->annotate(fi.absolutePath(), fi.fileName(), QString(), line); + return true; +} + +QString FossilControl::vcsTopic(const QString &directory) +{ + return m_client->synchronousTopic(directory); +} + +Core::ShellCommand *FossilControl::createInitialCheckoutCommand(const QString &sourceUrl, + const Utils::FileName &baseDirectory, + const QString &localName, + const QStringList &extraArgs) +{ + QMap options; + FossilJsExtension::parseArgOptions(extraArgs, options); + + // Two operating modes: + // 1) CloneCheckout: + // -- clone from remote-URL or a local-fossil a repository into a local-clone fossil. + // -- open/checkout the local-clone fossil + // The local-clone fossil must not point to an existing repository. + // Clone URL may be either schema-based (http, ssh, file) or an absolute local path. + // + // 2) LocalCheckout: + // -- open/checkout an existing local fossil + // Clone URL is an absolute local path and is the same as the local fossil. + + const QString checkoutPath = Utils::FileName(baseDirectory).appendPath(localName).toString(); + const QString fossilFile = options.value("fossil-file"); + const Utils::FileName fossilFileName = Utils::FileName::fromUserInput(QDir::fromNativeSeparators(fossilFile)); + const QString fossilFileNative = fossilFileName.toUserOutput(); + const QFileInfo cloneRepository(fossilFileName.toString()); + + // Check when requested to clone a local repository and clone-into repository file is the same + // or not specified. + // In this case handle it as local fossil checkout request. + const QUrl url(sourceUrl); + bool isLocalRepository = (options.value("repository-type") == "localRepo"); + + if (url.isLocalFile() || url.isRelative()) { + const QFileInfo sourcePath(url.path()); + isLocalRepository = (sourcePath.canonicalFilePath() == cloneRepository.canonicalFilePath()); + } + + // set clone repository admin user to configured user name + // OR override it with the specified user from clone panel + const QString adminUser = options.value("admin-user"); + const bool disableAutosync = (options.value("settings-autosync") == "off"); + const QString checkoutBranch = options.value("branch-tag"); + + // first create the checkout directory, + // as it needs to become a working directory for wizard command jobs + + const QDir checkoutDir(checkoutPath); + checkoutDir.mkpath(checkoutPath); + + // Setup the wizard page command job + auto command = new VcsBase::VcsCommand(checkoutDir.path(), m_client->processEnvironment()); + + if (!isLocalRepository + && !cloneRepository.exists()) { + + const QString sslIdentityFile = options.value("ssl-identity"); + const Utils::FileName sslIdentityFileName = Utils::FileName::fromUserInput(QDir::fromNativeSeparators(sslIdentityFile)); + const bool includePrivate = (options.value("include-private") == "true"); + + QStringList extraOptions; + if (includePrivate) + extraOptions << "--private"; + if (!sslIdentityFile.isEmpty()) + extraOptions << "--ssl-identity" << sslIdentityFileName.toUserOutput(); + if (!adminUser.isEmpty()) + extraOptions << "--admin-user" << adminUser; + + // Fossil allows saving the remote address and login. This is used to + // facilitate autosync (commit/update) functionality. + // When no password is given, it prompts for that. + // When both username and password are specified, it prompts whether to + // save them. + // NOTE: In non-interactive context, these prompts won't work. + // Fossil currently does not support SSH_ASKPASS way for login query. + // + // Alternatively, "--once" option does not save the remote details. + // In such case remote details must be provided on the command-line every + // time. This also precludes autosync. + // + // So here we want Fossil to save the remote details when specified. + + QStringList args; + args << m_client->vcsCommandString(FossilClient::CloneCommand) + << extraOptions + << sourceUrl + << fossilFileNative; + command->addJob(m_client->vcsBinary(), args, -1); + } + + // check out the cloned repository file into the working copy directory; + // by default the latest revision is checked out + + QStringList args({"open", fossilFileNative}); + if (!checkoutBranch.isEmpty()) + args << checkoutBranch; + command->addJob(m_client->vcsBinary(), args, -1); + + // set user default to admin user if specified + if (!isLocalRepository + && !adminUser.isEmpty()) { + const QStringList args({ "user", "default", adminUser, "--user", adminUser}); + command->addJob(m_client->vcsBinary(), args, -1); + } + + // turn-off autosync if requested + if (!isLocalRepository + && disableAutosync) { + const QStringList args({"settings", "autosync", "off"}); + command->addJob(m_client->vcsBinary(), args, -1); + } + + return command; +} + +void FossilControl::changed(const QVariant &v) +{ + switch (v.type()) { + case QVariant::String: + emit repositoryChanged(v.toString()); + break; + case QVariant::StringList: + emit filesChanged(v.toStringList()); + break; + default: + break; + } +} diff --git a/plugins/fossil/fossilcontrol.h b/plugins/fossil/fossilcontrol.h new file mode 100644 index 00000000000..8a3e53f9088 --- /dev/null +++ b/plugins/fossil/fossilcontrol.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include + +QT_BEGIN_NAMESPACE +class QVariant; +QT_END_NAMESPACE + +namespace Fossil { +namespace Internal { + +class FossilClient; + +//Implements just the basics of the Version Control Interface +//FossilClient handles all the work +class FossilControl: public Core::IVersionControl +{ + Q_OBJECT + +public: + explicit FossilControl(FossilClient *fossilClient); + + QString displayName() const final; + Core::Id id() const final; + + bool isVcsFileOrDirectory(const Utils::FileName &fileName) const final; + bool managesDirectory(const QString &filename, QString *topLevel = 0) const final; + bool managesFile(const QString &workingDirectory, const QString &fileName) const final; + bool isConfigured() const final; + bool supportsOperation(Operation operation) const final; + bool vcsOpen(const QString &fileName) final; + bool vcsAdd(const QString &filename) final; + bool vcsDelete(const QString &filename) final; + bool vcsMove(const QString &from, const QString &to) final; + bool vcsCreateRepository(const QString &directory) final; + bool vcsAnnotate(const QString &file, int line) final; + QString vcsTopic(const QString &directory) final; + Core::ShellCommand *createInitialCheckoutCommand(const QString &sourceUrl, + const Utils::FileName &baseDirectory, + const QString &localName, + const QStringList &extraArgs) final; + + // To be connected to the VcsTask's success signal to emit the repository/ + // files changed signals according to the variant's type: + // String -> repository, StringList -> files + void changed(const QVariant &); + +private: + FossilClient *const m_client; +}; + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/fossileditor.cpp b/plugins/fossil/fossileditor.cpp new file mode 100644 index 00000000000..c379fd95879 --- /dev/null +++ b/plugins/fossil/fossileditor.cpp @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "fossileditor.h" +#include "annotationhighlighter.h" +#include "constants.h" +#include "fossilplugin.h" +#include "fossilclient.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace Fossil { +namespace Internal { + +FossilEditorWidget::FossilEditorWidget() : + m_exactChangesetId(Constants::CHANGESET_ID_EXACT), + m_firstChangesetId(QString("\n") + Constants::CHANGESET_ID + " "), + m_nextChangesetId(m_firstChangesetId) +{ + QTC_ASSERT(m_exactChangesetId.isValid(), return); + QTC_ASSERT(m_firstChangesetId.isValid(), return); + QTC_ASSERT(m_nextChangesetId.isValid(), return); + + setAnnotateRevisionTextFormat(tr("&Annotate %1")); + setAnnotatePreviousRevisionTextFormat(tr("Annotate &Parent Revision %1")); + + const QRegExp exactDiffFileIdPattern(Constants::DIFFFILE_ID_EXACT); + QTC_ASSERT(exactDiffFileIdPattern.isValid(), return); + setDiffFilePattern(exactDiffFileIdPattern); + + const QRegExp logChangePattern("^.*\\[([0-9a-f]{5,40})\\]"); + QTC_ASSERT(logChangePattern.isValid(), return); + setLogEntryPattern(logChangePattern); +} + +QSet FossilEditorWidget::annotationChanges() const +{ + + const QString txt = toPlainText(); + if (txt.isEmpty()) + return QSet(); + + // extract changeset id at the beginning of each annotated line: + // ...: + + QSet changes; + + QRegularExpressionMatch firstChangesetIdMatch = m_firstChangesetId.match(txt); + if (firstChangesetIdMatch.hasMatch()) { + QString changeId = firstChangesetIdMatch.captured(1); + changes.insert(changeId); + + QRegularExpressionMatchIterator i = m_nextChangesetId.globalMatch(txt); + while (i.hasNext()) { + const QRegularExpressionMatch nextChangesetIdMatch = i.next(); + changeId = nextChangesetIdMatch.captured(1); + changes.insert(changeId); + } + } + return changes; +} + +QString FossilEditorWidget::changeUnderCursor(const QTextCursor &cursorIn) const +{ + QTextCursor cursor = cursorIn; + cursor.select(QTextCursor::WordUnderCursor); + if (cursor.hasSelection()) { + const QString change = cursor.selectedText(); + QRegularExpressionMatch exactChangesetIdMatch = m_exactChangesetId.match(change); + if (exactChangesetIdMatch.hasMatch()) + return change; + } + return QString(); +} + + +VcsBase::BaseAnnotationHighlighter *FossilEditorWidget::createAnnotationHighlighter(const QSet &changes) const +{ + return new FossilAnnotationHighlighter(changes); +} + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/fossileditor.h b/plugins/fossil/fossileditor.h new file mode 100644 index 00000000000..e052b93a9d2 --- /dev/null +++ b/plugins/fossil/fossileditor.h @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include + +#include + +namespace Fossil { +namespace Internal { + +class FossilEditorWidget : public VcsBase::VcsBaseEditorWidget +{ + Q_OBJECT + +public: + FossilEditorWidget(); + +private: + QSet annotationChanges() const final; + QString changeUnderCursor(const QTextCursor &cursor) const final; + VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet &changes) const final; + + const QRegularExpression m_exactChangesetId; + const QRegularExpression m_firstChangesetId; + const QRegularExpression m_nextChangesetId; +}; + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp new file mode 100644 index 00000000000..2fab29b722f --- /dev/null +++ b/plugins/fossil/fossilplugin.cpp @@ -0,0 +1,819 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "fossilplugin.h" +#include "constants.h" +#include "fossilclient.h" +#include "fossilcontrol.h" +#include "optionspage.h" +#include "fossilcommitwidget.h" +#include "fossileditor.h" +#include "pullorpushdialog.h" +#include "configuredialog.h" +#include "commiteditor.h" +#include "wizard/fossiljsextension.h" + +#include "ui_revertdialog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Fossil { +namespace Internal { + +static const VcsBase::VcsBaseEditorParameters editorParameters[] = { + { VcsBase::LogOutput, + Constants::FILELOG_ID, + Constants::FILELOG_DISPLAY_NAME, + Constants::LOGAPP}, + + { VcsBase::AnnotateOutput, + Constants::ANNOTATELOG_ID, + Constants::ANNOTATELOG_DISPLAY_NAME, + Constants::ANNOTATEAPP}, + + { VcsBase::DiffOutput, + Constants::DIFFLOG_ID, + Constants::DIFFLOG_DISPLAY_NAME, + Constants::DIFFAPP} +}; + +static const VcsBase::VcsBaseSubmitEditorParameters submitEditorParameters = { + Constants::COMMITMIMETYPE, + Constants::COMMIT_ID, + Constants::COMMIT_DISPLAY_NAME, + VcsBase::VcsBaseSubmitEditorParameters::DiffFiles +}; + + +FossilPlugin *FossilPlugin::m_instance = nullptr; + +FossilPlugin::FossilPlugin() +{ + m_instance = this; +} + +FossilPlugin::~FossilPlugin() +{ + delete m_client; + m_client = nullptr; + m_instance = nullptr; +} + +bool FossilPlugin::initialize(const QStringList &arguments, QString *errorMessage) +{ + Q_UNUSED(arguments); + Q_UNUSED(errorMessage); + + Core::Context context(Constants::FOSSIL_CONTEXT); + + m_client = new FossilClient; + auto vcsCtrl = new FossilControl(m_client); + initializeVcs(vcsCtrl, context); + connect(m_client, &VcsBase::VcsBaseClient::changed, vcsCtrl, &FossilControl::changed); + + addAutoReleasedObject(new OptionsPage(vcsCtrl)); + + const auto describeFunc = [this](const QString &source, const QString &id) { + m_client->view(source, id); + }; + + const int editorCount = sizeof(editorParameters) / sizeof(VcsBase::VcsBaseEditorParameters); + const auto widgetCreator = []() { return new FossilEditorWidget; }; + for (int i = 0; i < editorCount; i++) + addAutoReleasedObject(new VcsBase::VcsEditorFactory(editorParameters + i, widgetCreator, describeFunc)); + + addAutoReleasedObject(new VcsBase::VcsSubmitEditorFactory(&submitEditorParameters, + []() { return new CommitEditor(&submitEditorParameters); })); + + m_commandLocator = new Core::CommandLocator("Fossil", "fossil", "fossil"); + addAutoReleasedObject(m_commandLocator); + + ProjectExplorer::JsonWizardFactory::addWizardPath(Utils::FileName::fromString(Constants::WIZARD_PATH)); + Core::JsExpander::registerQObjectForJs("Fossil", new FossilJsExtension); + + createMenu(context); + + createSubmitEditorActions(); + + return true; +} + +FossilPlugin *FossilPlugin::instance() +{ + return m_instance; +} + +FossilClient *FossilPlugin::client() const +{ + return m_client; +} + + +void FossilPlugin::createMenu(const Core::Context &context) +{ + // Create menu item for Fossil + m_fossilContainer = Core::ActionManager::createMenu("Fossil.FossilMenu"); + QMenu *menu = m_fossilContainer->menu(); + menu->setTitle(tr("&Fossil")); + + createFileActions(context); + m_fossilContainer->addSeparator(context); + createDirectoryActions(context); + m_fossilContainer->addSeparator(context); + createRepositoryActions(context); + m_fossilContainer->addSeparator(context); + + // Request the Tools menu and add the Fossil menu to it + Core::ActionContainer *toolsMenu = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS); + toolsMenu->addMenu(m_fossilContainer); + m_menuAction = m_fossilContainer->menu()->menuAction(); +} + +void FossilPlugin::createFileActions(const Core::Context &context) +{ + Core::Command *command; + + m_annotateFile = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); + command = Core::ActionManager::registerAction(m_annotateFile, Constants::ANNOTATE, context); + command->setAttribute(Core::Command::CA_UpdateText); + connect(m_annotateFile, &QAction::triggered, this, &FossilPlugin::annotateCurrentFile); + m_fossilContainer->addAction(command); + m_commandLocator->appendCommand(command); + + m_diffFile = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); + command = Core::ActionManager::registerAction(m_diffFile, Constants::DIFF, context); + command->setAttribute(Core::Command::CA_UpdateText); + command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+I,Meta+D") : tr("ALT+I,Alt+D"))); + connect(m_diffFile, &QAction::triggered, this, &FossilPlugin::diffCurrentFile); + m_fossilContainer->addAction(command); + m_commandLocator->appendCommand(command); + + m_logFile = new Utils::ParameterAction(tr("Timeline Current File"), tr("Timeline \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); + command = Core::ActionManager::registerAction(m_logFile, Constants::LOG, context); + command->setAttribute(Core::Command::CA_UpdateText); + command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+I,Meta+L") : tr("ALT+I,Alt+L"))); + connect(m_logFile, &QAction::triggered, this, &FossilPlugin::logCurrentFile); + m_fossilContainer->addAction(command); + m_commandLocator->appendCommand(command); + + m_statusFile = new Utils::ParameterAction(tr("Status Current File"), tr("Status \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); + command = Core::ActionManager::registerAction(m_statusFile, Constants::STATUS, context); + command->setAttribute(Core::Command::CA_UpdateText); + command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+I,Meta+S") : tr("ALT+I,Alt+S"))); + connect(m_statusFile, &QAction::triggered, this, &FossilPlugin::statusCurrentFile); + m_fossilContainer->addAction(command); + m_commandLocator->appendCommand(command); + + m_fossilContainer->addSeparator(context); + + m_addAction = new Utils::ParameterAction(tr("Add Current File"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); + command = Core::ActionManager::registerAction(m_addAction, Constants::ADD, context); + command->setAttribute(Core::Command::CA_UpdateText); + connect(m_addAction, &QAction::triggered, this, &FossilPlugin::addCurrentFile); + m_fossilContainer->addAction(command); + m_commandLocator->appendCommand(command); + + m_deleteAction = new Utils::ParameterAction(tr("Delete Current File..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this); + command = Core::ActionManager::registerAction(m_deleteAction, Constants::DELETE, context); + command->setAttribute(Core::Command::CA_UpdateText); + connect(m_deleteAction, &QAction::triggered, this, &FossilPlugin::deleteCurrentFile); + m_fossilContainer->addAction(command); + m_commandLocator->appendCommand(command); + + m_revertFile = new Utils::ParameterAction(tr("Revert Current File..."), tr("Revert \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this); + command = Core::ActionManager::registerAction(m_revertFile, Constants::REVERT, context); + command->setAttribute(Core::Command::CA_UpdateText); + connect(m_revertFile, &QAction::triggered, this, &FossilPlugin::revertCurrentFile); + m_fossilContainer->addAction(command); + m_commandLocator->appendCommand(command); +} + +void FossilPlugin::addCurrentFile() +{ + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasFile(), return); + m_client->synchronousAdd(state.currentFileTopLevel(), state.relativeCurrentFile()); +} + +void FossilPlugin::deleteCurrentFile() +{ + promptToDeleteCurrentFile(); +} + +void FossilPlugin::annotateCurrentFile() +{ + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasFile(), return); + m_client->annotate(state.currentFileTopLevel(), state.relativeCurrentFile()); +} + +void FossilPlugin::diffCurrentFile() +{ + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasFile(), return); + m_client->diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile())); +} + +void FossilPlugin::logCurrentFile() +{ + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasFile(), return); + FossilClient::SupportedFeatures features = m_client->supportedFeatures(); + QStringList extraOptions; + extraOptions << "-n" << QString::number(m_client->settings().intValue(FossilSettings::logCountKey)); + + if (features.testFlag(FossilClient::TimelineWidthFeature)) + extraOptions << "-W" << QString::number(m_client->settings().intValue(FossilSettings::timelineWidthKey)); + + // annotate only supported for current revision, so disable context menu + bool enableAnnotationContextMenu = false; + m_client->logCurrentFile(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()), + extraOptions, enableAnnotationContextMenu); +} + +void FossilPlugin::revertCurrentFile() +{ + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasFile(), return); + + QDialog dialog(Core::ICore::dialogParent()); + Ui::RevertDialog revertUi; + revertUi.setupUi(&dialog); + if (dialog.exec() != QDialog::Accepted) + return; + m_client->revertFile(state.currentFileTopLevel(), + state.relativeCurrentFile(), + revertUi.revisionLineEdit->text()); +} + +void FossilPlugin::statusCurrentFile() +{ + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasFile(), return); + m_client->status(state.currentFileTopLevel(), state.relativeCurrentFile()); +} + +void FossilPlugin::createDirectoryActions(const Core::Context &context) +{ + QAction *action; + Core::Command *command; + + action = new QAction(tr("Diff"), this); + m_repositoryActionList.append(action); + command = Core::ActionManager::registerAction(action, Constants::DIFFMULTI, context); + connect(action, &QAction::triggered, this, &FossilPlugin::diffRepository); + m_fossilContainer->addAction(command); + m_commandLocator->appendCommand(command); + + action = new QAction(tr("Timeline"), this); + m_repositoryActionList.append(action); + command = Core::ActionManager::registerAction(action, Constants::LOGMULTI, context); + command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+I,Meta+T") : tr("ALT+I,Alt+T"))); + connect(action, &QAction::triggered, this, &FossilPlugin::logRepository); + m_fossilContainer->addAction(command); + m_commandLocator->appendCommand(command); + + action = new QAction(tr("Revert..."), this); + m_repositoryActionList.append(action); + command = Core::ActionManager::registerAction(action, Constants::REVERTMULTI, context); + connect(action, &QAction::triggered, this, &FossilPlugin::revertAll); + m_fossilContainer->addAction(command); + m_commandLocator->appendCommand(command); + + action = new QAction(tr("Status"), this); + m_repositoryActionList.append(action); + command = Core::ActionManager::registerAction(action, Constants::STATUSMULTI, context); + connect(action, &QAction::triggered, this, &FossilPlugin::statusMulti); + m_fossilContainer->addAction(command); + m_commandLocator->appendCommand(command); +} + + +void FossilPlugin::diffRepository() +{ + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasTopLevel(), return); + m_client->diff(state.topLevel()); +} + +void FossilPlugin::logRepository() +{ + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasTopLevel(), return); + FossilClient::SupportedFeatures features = m_client->supportedFeatures(); + QStringList extraOptions; + extraOptions << "-n" << QString::number(m_client->settings().intValue(FossilSettings::logCountKey)); + + if (features.testFlag(FossilClient::TimelineWidthFeature)) + extraOptions << "-W" << QString::number(m_client->settings().intValue(FossilSettings::timelineWidthKey)); + + m_client->log(state.topLevel(), QStringList(), extraOptions); +} + +void FossilPlugin::revertAll() +{ + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasTopLevel(), return); + + QDialog dialog(Core::ICore::dialogParent()); + Ui::RevertDialog revertUi; + revertUi.setupUi(&dialog); + if (dialog.exec() != QDialog::Accepted) + return; + m_client->revertAll(state.topLevel(), revertUi.revisionLineEdit->text()); +} + +void FossilPlugin::statusMulti() +{ + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasTopLevel(), return); + m_client->status(state.topLevel()); +} + +void FossilPlugin::createRepositoryActions(const Core::Context &context) +{ + QAction *action = 0; + Core::Command *command = 0; + + action = new QAction(tr("Pull..."), this); + m_repositoryActionList.append(action); + command = Core::ActionManager::registerAction(action, Constants::PULL, context); + connect(action, &QAction::triggered, this, &FossilPlugin::pull); + m_fossilContainer->addAction(command); + m_commandLocator->appendCommand(command); + + action = new QAction(tr("Push..."), this); + m_repositoryActionList.append(action); + command = Core::ActionManager::registerAction(action, Constants::PUSH, context); + connect(action, &QAction::triggered, this, &FossilPlugin::push); + m_fossilContainer->addAction(command); + m_commandLocator->appendCommand(command); + + action = new QAction(tr("Update..."), this); + m_repositoryActionList.append(action); + command = Core::ActionManager::registerAction(action, Constants::UPDATE, context); + command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+I,Meta+U") : tr("ALT+I,Alt+U"))); + connect(action, &QAction::triggered, this, &FossilPlugin::update); + m_fossilContainer->addAction(command); + m_commandLocator->appendCommand(command); + + action = new QAction(tr("Commit..."), this); + m_repositoryActionList.append(action); + command = Core::ActionManager::registerAction(action, Constants::COMMIT, context); + command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+I,Meta+C") : tr("ALT+I,Alt+C"))); + connect(action, &QAction::triggered, this, &FossilPlugin::commit); + m_fossilContainer->addAction(command); + m_commandLocator->appendCommand(command); + + action = new QAction(tr("Settings ..."), this); + m_repositoryActionList.append(action); + command = Core::ActionManager::registerAction(action, Constants::CONFIGURE_REPOSITORY, context); + connect(action, &QAction::triggered, this, &FossilPlugin::configureRepository); + m_fossilContainer->addAction(command); + m_commandLocator->appendCommand(command); + + // Register "Create Repository..." action in global context, so that it's visible + // without active repository to allow creating a new one. + m_createRepositoryAction = new QAction(tr("Create Repository..."), this); + command = Core::ActionManager::registerAction(m_createRepositoryAction, Constants::CREATE_REPOSITORY); + connect(m_createRepositoryAction, &QAction::triggered, this, &FossilPlugin::createRepository); + m_fossilContainer->addAction(command); +} + +void FossilPlugin::pull() +{ + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasTopLevel(), return); + + PullOrPushDialog dialog(PullOrPushDialog::PullMode, Core::ICore::dialogParent()); + dialog.setLocalBaseDirectory(m_client->settings().stringValue(FossilSettings::defaultRepoPathKey)); + dialog.setDefaultRemoteLocation(m_client->synchronousGetRepositoryURL(state.topLevel())); + if (dialog.exec() != QDialog::Accepted) + return; + + QString remoteLocation(dialog.remoteLocation()); + if (remoteLocation.isEmpty()) + remoteLocation = m_client->synchronousGetRepositoryURL(state.topLevel()); + + if (remoteLocation.isEmpty()) { + VcsBase::VcsOutputWindow::appendError(tr("Remote repository is not defined.")); + return; + } + + QStringList extraOptions; + if (!dialog.isRememberOptionEnabled()) + extraOptions << "--once"; + if (dialog.isPrivateOptionEnabled()) + extraOptions << "--private"; + m_client->synchronousPull(state.topLevel(), remoteLocation, extraOptions); +} + +void FossilPlugin::push() +{ + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasTopLevel(), return); + + PullOrPushDialog dialog(PullOrPushDialog::PushMode, Core::ICore::dialogParent()); + dialog.setLocalBaseDirectory(m_client->settings().stringValue(FossilSettings::defaultRepoPathKey)); + dialog.setDefaultRemoteLocation(m_client->synchronousGetRepositoryURL(state.topLevel())); + if (dialog.exec() != QDialog::Accepted) + return; + + QString remoteLocation(dialog.remoteLocation()); + if (remoteLocation.isEmpty()) + remoteLocation = m_client->synchronousGetRepositoryURL(state.topLevel()); + + if (remoteLocation.isEmpty()) { + VcsBase::VcsOutputWindow::appendError(tr("Remote repository is not defined.")); + return; + } + + QStringList extraOptions; + if (!dialog.isRememberOptionEnabled()) + extraOptions << "--once"; + if (dialog.isPrivateOptionEnabled()) + extraOptions << "--private"; + m_client->synchronousPush(state.topLevel(), remoteLocation, extraOptions); +} + +void FossilPlugin::update() +{ + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasTopLevel(), return); + + QDialog dialog(Core::ICore::dialogParent()); + Ui::RevertDialog revertUi; + revertUi.setupUi(&dialog); + dialog.setWindowTitle(tr("Update")); + if (dialog.exec() != QDialog::Accepted) + return; + m_client->update(state.topLevel(), revertUi.revisionLineEdit->text()); +} + +void FossilPlugin::configureRepository() +{ + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasTopLevel(), return); + + ConfigureDialog dialog; + + // retrieve current settings from the repository + RepositorySettings currentSettings = m_client->synchronousSettingsQuery(state.topLevel()); + + dialog.setSettings(currentSettings); + if (dialog.exec() != QDialog::Accepted) + return; + const RepositorySettings newSettings = dialog.settings(); + + m_client->synchronousConfigureRepository(state.topLevel(), newSettings, currentSettings); +} + +void FossilPlugin::createSubmitEditorActions() +{ + Core::Context context(Constants::COMMIT_ID); + Core::Command *command; + + m_editorCommit = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this); + command = Core::ActionManager::registerAction(m_editorCommit, Constants::COMMIT, context); + command->setAttribute(Core::Command::CA_UpdateText); + connect(m_editorCommit, &QAction::triggered, this, &FossilPlugin::commitFromEditor); + + m_editorDiff = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this); + command = Core::ActionManager::registerAction(m_editorDiff, Constants::DIFFEDITOR, context); + + m_editorUndo = new QAction(tr("&Undo"), this); + command = Core::ActionManager::registerAction(m_editorUndo, Core::Constants::UNDO, context); + + m_editorRedo = new QAction(tr("&Redo"), this); + command = Core::ActionManager::registerAction(m_editorRedo, Core::Constants::REDO, context); +} + +void FossilPlugin::commit() +{ + if (raiseSubmitEditor()) + return; + + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasTopLevel(), return); + + m_submitRepository = state.topLevel(); + + connect(m_client, &VcsBase::VcsBaseClient::parsedStatus, + this, &FossilPlugin::showCommitWidget); + + QStringList extraOptions; + m_client->emitParsedStatus(m_submitRepository, extraOptions); +} + +void FossilPlugin::showCommitWidget(const QList &status) +{ + //Once we receive our data release the connection so it can be reused elsewhere + disconnect(m_client, &VcsBase::VcsBaseClient::parsedStatus, + this, &FossilPlugin::showCommitWidget); + + if (status.isEmpty()) { + VcsBase::VcsOutputWindow::appendError(tr("There are no changes to commit.")); + return; + } + + // Start new temp file for commit message + Utils::TempFileSaver saver; + // Keep the file alive, else it removes self and forgets its name + saver.setAutoRemove(false); + if (!saver.finalize()) { + VcsBase::VcsOutputWindow::appendError(saver.errorString()); + return; + } + + Core::IEditor *editor = Core::EditorManager::openEditor(saver.fileName(), Constants::COMMIT_ID); + if (!editor) { + VcsBase::VcsOutputWindow::appendError(tr("Unable to create an editor for the commit.")); + return; + } + + CommitEditor *commitEditor = qobject_cast(editor); + + if (!commitEditor) { + VcsBase::VcsOutputWindow::appendError(tr("Unable to create a commit editor.")); + return; + } + setSubmitEditor(commitEditor); + + const QString msg = tr("Commit changes for \"%1\"."). + arg(QDir::toNativeSeparators(m_submitRepository)); + commitEditor->document()->setPreferredDisplayName(msg); + + const RevisionInfo currentRevision = m_client->synchronousRevisionQuery(m_submitRepository); + const BranchInfo currentBranch = m_client->synchronousCurrentBranch(m_submitRepository); + const QString currentUser = m_client->synchronousUserDefaultQuery(m_submitRepository); + QStringList tags = m_client->synchronousTagQuery(m_submitRepository, currentRevision.id); + // Fossil includes branch name in tag list -- remove. + tags.removeAll(currentBranch.name()); + commitEditor->setFields(m_submitRepository, currentBranch, tags, currentUser, status); + + commitEditor->registerActions(m_editorUndo, m_editorRedo, m_editorCommit, m_editorDiff); + connect(commitEditor, &VcsBase::VcsBaseSubmitEditor::diffSelectedFiles, + this, &FossilPlugin::diffFromEditorSelected); + commitEditor->setCheckScriptWorkingDirectory(m_submitRepository); +} + +void FossilPlugin::diffFromEditorSelected(const QStringList &files) +{ + m_client->diff(m_submitRepository, files); +} + +static inline bool ask(QWidget *parent, const QString &title, const QString &question, bool defaultValue = true) + +{ + const QMessageBox::StandardButton defaultButton = defaultValue ? QMessageBox::Yes : QMessageBox::No; + return QMessageBox::question(parent, title, question, QMessageBox::Yes|QMessageBox::No, defaultButton) == QMessageBox::Yes; +} + +void FossilPlugin::createRepository() +{ + // re-implemented from void VcsBasePlugin::createRepository() + + // Find current starting directory + QString directory; + if (const ProjectExplorer::Project *currentProject = ProjectExplorer::ProjectTree::currentProject()) + directory = currentProject->document()->filePath().toFileInfo().absolutePath(); + // Prompt for a directory that is not under version control yet + QWidget *mw = Core::ICore::mainWindow(); + do { + directory = QFileDialog::getExistingDirectory(mw, tr("Choose Checkout Directory"), directory); + if (directory.isEmpty()) + return; + const Core::IVersionControl *managingControl = Core::VcsManager::findVersionControlForDirectory(directory); + if (managingControl == 0) + break; + const QString question = tr("The directory \"%1\" is already managed by a version control system (%2)." + " Would you like to specify another directory?").arg(directory, managingControl->displayName()); + + if (!ask(mw, tr("Repository already under version control"), question)) + return; + } while (true); + // Create + const bool rc = static_cast(versionControl())->vcsCreateRepository(directory); + const QString nativeDir = QDir::toNativeSeparators(directory); + if (rc) { + QMessageBox::information(mw, tr("Repository Created"), + tr("A version control repository has been created in %1."). + arg(nativeDir)); + } else { + QMessageBox::warning(mw, tr("Repository Creation Failed"), + tr("A version control repository could not be created in %1."). + arg(nativeDir)); + } +} + +void FossilPlugin::commitFromEditor() +{ + // Close the submit editor + m_submitActionTriggered = true; + QTC_ASSERT(submitEditor(), return); + Core::EditorManager::closeDocument(submitEditor()->document()); +} + +bool FossilPlugin::submitEditorAboutToClose() +{ + CommitEditor *commitEditor = qobject_cast(submitEditor()); + QTC_ASSERT(commitEditor, return true); + Core::IDocument *editorDocument = commitEditor->document(); + QTC_ASSERT(editorDocument, return true); + + bool promptOnSubmit = false; + const VcsBase::VcsBaseSubmitEditor::PromptSubmitResult response = + commitEditor->promptSubmit(tr("Close Commit Editor"), tr("Do you want to commit the changes?"), + tr("Message check failed. Do you want to proceed?"), + &promptOnSubmit, !m_submitActionTriggered); + m_submitActionTriggered = false; + + switch (response) { + case VcsBase::VcsBaseSubmitEditor::SubmitCanceled: + return false; + case VcsBase::VcsBaseSubmitEditor::SubmitDiscarded: + return true; + default: + break; + } + + QStringList files = commitEditor->checkedFiles(); + if (!files.empty()) { + //save the commit message + if (!Core::DocumentManager::saveDocument(editorDocument)) + return false; + + //rewrite entries of the form 'file => newfile' to 'newfile' because + //this would mess the commit command + for (QStringList::iterator iFile = files.begin(); iFile != files.end(); ++iFile) { + const QStringList parts = iFile->split(" => ", QString::SkipEmptyParts); + if (!parts.isEmpty()) + *iFile = parts.last(); + } + + FossilCommitWidget *commitWidget = commitEditor->commitWidget(); + QStringList extraOptions; + // Author -- override the repository-default user + if (!commitWidget->committer().isEmpty()) + extraOptions << "--user" << commitWidget->committer(); + // Branch + QString branch = commitWidget->newBranch(); + if (!branch.isEmpty()) { + // @TODO: make enquote utility function + QString enquotedBranch = branch; + if (branch.contains(QRegularExpression("\\s"))) + enquotedBranch = QString("\"") + branch + "\""; + extraOptions << "--branch" << enquotedBranch; + } + // Tags + foreach (QString tag, commitWidget->tags()) { + extraOptions << "--tag" << tag; + } + + // Whether local commit or not + if (commitWidget->isPrivateOptionEnabled()) + extraOptions += "--private"; + m_client->commit(m_submitRepository, files, editorDocument->filePath().toString(), extraOptions); + } + return true; +} + + +void FossilPlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as) +{ + m_createRepositoryAction->setEnabled(true); + + if (!enableMenuAction(as, m_menuAction)) { + m_commandLocator->setEnabled(false); + return; + } + const QString filename = currentState().currentFileName(); + const bool repoEnabled = currentState().hasTopLevel(); + m_commandLocator->setEnabled(repoEnabled); + + m_annotateFile->setParameter(filename); + m_diffFile->setParameter(filename); + m_logFile->setParameter(filename); + m_addAction->setParameter(filename); + m_deleteAction->setParameter(filename); + m_revertFile->setParameter(filename); + m_statusFile->setParameter(filename); + + foreach (QAction *repoAction, m_repositoryActionList) + repoAction->setEnabled(repoEnabled); +} + +} // namespace Internal +} // namespace Fossil + +#ifdef WITH_TESTS +#include + +void Fossil::Internal::FossilPlugin::testDiffFileResolving_data() +{ + QTest::addColumn("header"); + QTest::addColumn("fileName"); + + QTest::newRow("New") << QByteArray( + "ADDED src/plugins/fossil/fossilclient.cpp\n" + "Index: src/plugins/fossil/fossilclient.cpp\n" + "==================================================================\n" + "--- src/plugins/fossil/fossilclient.cpp\n" + "+++ src/plugins/fossil/fossilclient.cpp\n" + "@@ -0,0 +1,295 @@\n" + ) + << QByteArray("src/plugins/fossil/fossilclient.cpp"); + QTest::newRow("Deleted") << QByteArray( + "DELETED src/plugins/fossil/fossilclient.cpp\n" + "Index: src/plugins/fossil/fossilclient.cpp\n" + "==================================================================\n" + "--- src/plugins/fossil/fossilclient.cpp\n" + "+++ src/plugins/fossil/fossilclient.cpp\n" + "@@ -1,266 +0,0 @@\n" + ) + << QByteArray("src/plugins/fossil/fossilclient.cpp"); + QTest::newRow("Modified") << QByteArray( + "Index: src/plugins/fossil/fossilclient.cpp\n" + "==================================================================\n" + "--- src/plugins/fossil/fossilclient.cpp\n" + "+++ src/plugins/fossil/fossilclient.cpp\n" + "@@ -112,22 +112,37 @@\n" + ) + << QByteArray("src/plugins/fossil/fossilclient.cpp"); +} + +void Fossil::Internal::FossilPlugin::testDiffFileResolving() +{ + VcsBase::VcsBaseEditorWidget::testDiffFileResolving(editorParameters[2].id); +} + +void Fossil::Internal::FossilPlugin::testLogResolving() +{ + QByteArray data( + "=== 2014-03-08 ===\n" + "22:14:02 [ac6d1129b8] Change scaling algorithm. (user: ninja tags: ninja-fixes-5.1)\n" + " EDITED src/core/scaler.cpp\n" + "20:23:51 [56d6917c3b] *BRANCH* Add width option (conditional). (user: ninja tags: ninja-fixes-5.1)\n" + " EDITED src/core/scaler.cpp\n" + " EDITED src/core/scaler.h\n" + ); + VcsBase::VcsBaseEditorWidget::testLogResolving(editorParameters[0].id, data, "ac6d1129b8", "56d6917c3b"); +} +#endif diff --git a/plugins/fossil/fossilplugin.h b/plugins/fossil/fossilplugin.h new file mode 100644 index 00000000000..da48d24e3e0 --- /dev/null +++ b/plugins/fossil/fossilplugin.h @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include "fossilsettings.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE +class QAction; +QT_END_NAMESPACE + +namespace Core { +class ActionContainer; +class CommandLocator; +class Id; +} // namespace Core + +namespace Utils { class ParameterAction; } + +namespace Fossil { +namespace Internal { + +class OptionsPage; +class FossilClient; +class FossilControl; +class FossilEditorWidget; + +class FossilPlugin : public VcsBase::VcsBasePlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Fossil.json") + +public: + FossilPlugin(); + ~FossilPlugin(); + bool initialize(const QStringList &arguments, QString *errorMessage); + + static FossilPlugin *instance(); + FossilClient *client() const; + +protected: + void updateActions(VcsBase::VcsBasePlugin::ActionState) override; + bool submitEditorAboutToClose() override; + +private: + // File menu action slots + void addCurrentFile(); + void deleteCurrentFile(); + void annotateCurrentFile(); + void diffCurrentFile(); + void logCurrentFile(); + void revertCurrentFile(); + void statusCurrentFile(); + + // Directory menu action slots + void diffRepository(); + void logRepository(); + void revertAll(); + void statusMulti(); + + // Repository menu action slots + void pull(); + void push(); + void update(); + void configureRepository(); + void commit(); + void showCommitWidget(const QList &status); + void commitFromEditor(); + void diffFromEditorSelected(const QStringList &files); + void createRepository(); + + // Methods + void createMenu(const Core::Context &context); + void createSubmitEditorActions(); + void createFileActions(const Core::Context &context); + void createDirectoryActions(const Core::Context &context); + void createRepositoryActions(const Core::Context &context); + + // Variables + static FossilPlugin *m_instance; + FossilClient *m_client = nullptr; + + Core::CommandLocator *m_commandLocator = nullptr; + Core::ActionContainer *m_fossilContainer = nullptr; + + QList m_repositoryActionList; + + // Menu Items (file actions) + Utils::ParameterAction *m_addAction = nullptr; + Utils::ParameterAction *m_deleteAction = nullptr; + Utils::ParameterAction *m_annotateFile = nullptr; + Utils::ParameterAction *m_diffFile = nullptr; + Utils::ParameterAction *m_logFile = nullptr; + Utils::ParameterAction *m_renameFile = nullptr; + Utils::ParameterAction *m_revertFile = nullptr; + Utils::ParameterAction *m_statusFile = nullptr; + + QAction *m_createRepositoryAction = nullptr; + + // Submit editor actions + QAction *m_editorCommit = nullptr; + QAction *m_editorDiff = nullptr; + QAction *m_editorUndo = nullptr; + QAction *m_editorRedo = nullptr; + QAction *m_menuAction = nullptr; + + QString m_submitRepository; + bool m_submitActionTriggered = false; + + +#ifdef WITH_TESTS +private slots: + void testDiffFileResolving_data(); + void testDiffFileResolving(); + void testLogResolving(); +#endif +}; + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/fossilsettings.cpp b/plugins/fossil/fossilsettings.cpp new file mode 100644 index 00000000000..e6f47696731 --- /dev/null +++ b/plugins/fossil/fossilsettings.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "fossilsettings.h" +#include "constants.h" + +#include + +namespace Fossil { +namespace Internal { + +const QString FossilSettings::defaultRepoPathKey("defaultRepoPath"); +const QString FossilSettings::sslIdentityFileKey("sslIdentityFile"); +const QString FossilSettings::diffIgnoreAllWhiteSpaceKey("diffIgnoreAllWhiteSpace"); +const QString FossilSettings::diffStripTrailingCRKey("diffStripTrailingCR"); +const QString FossilSettings::annotateShowCommittersKey("annotateShowCommitters"); +const QString FossilSettings::timelineWidthKey("timelineWidth"); +const QString FossilSettings::timelineLineageFilterKey("timelineLineageFilter"); +const QString FossilSettings::timelineVerboseKey("timelineVerbose"); +const QString FossilSettings::timelineItemTypeKey("timelineItemType"); +const QString FossilSettings::disableAutosyncKey("disableAutosync"); + +FossilSettings::FossilSettings() +{ + setSettingsGroup(Constants::FOSSIL); + // Override default binary path + declareKey(binaryPathKey, Constants::FOSSILDEFAULT); + declareKey(defaultRepoPathKey, ""); + declareKey(sslIdentityFileKey, ""); + declareKey(diffIgnoreAllWhiteSpaceKey, false); + declareKey(diffStripTrailingCRKey, false); + declareKey(annotateShowCommittersKey, false); + declareKey(timelineWidthKey, 0); + declareKey(timelineLineageFilterKey, ""); + declareKey(timelineVerboseKey, false); + declareKey(timelineItemTypeKey, "all"); + declareKey(disableAutosyncKey, true); +} + +RepositorySettings::RepositorySettings() + : autosync(AutosyncOn) +{ +} + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/fossilsettings.h b/plugins/fossil/fossilsettings.h new file mode 100644 index 00000000000..5a82e8d2d0c --- /dev/null +++ b/plugins/fossil/fossilsettings.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include + +namespace Fossil { +namespace Internal { + +class FossilSettings : public VcsBase::VcsBaseClientSettings +{ +public: + static const QString defaultRepoPathKey; + static const QString sslIdentityFileKey; + static const QString diffIgnoreAllWhiteSpaceKey; + static const QString diffStripTrailingCRKey; + static const QString annotateShowCommittersKey; + static const QString timelineWidthKey; + static const QString timelineLineageFilterKey; + static const QString timelineVerboseKey; + static const QString timelineItemTypeKey; + static const QString disableAutosyncKey; + + FossilSettings(); +}; + +struct RepositorySettings +{ + enum AutosyncMode {AutosyncOff = 0, AutosyncOn = 1, AutosyncPullOnly}; + + QString user; + AutosyncMode autosync; + QString sslIdentityFile; + + RepositorySettings(); +}; + +inline bool operator== (const RepositorySettings &lh, const RepositorySettings &rh) +{ + return (lh.user == rh.user + && lh.autosync == rh.autosync + && lh.sslIdentityFile == rh.sslIdentityFile); +} + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/optionspage.cpp b/plugins/fossil/optionspage.cpp new file mode 100644 index 00000000000..bc6d16ab535 --- /dev/null +++ b/plugins/fossil/optionspage.cpp @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "optionspage.h" +#include "constants.h" +#include "fossilclient.h" +#include "fossilsettings.h" +#include "fossilplugin.h" + +#include +#include +#include + +#include + +using namespace Fossil::Internal; +using namespace Fossil; + +OptionsPageWidget::OptionsPageWidget(QWidget *parent) : + VcsClientOptionsPageWidget(parent) +{ + m_ui.setupUi(this); + m_ui.commandChooser->setExpectedKind(Utils::PathChooser::ExistingCommand); + m_ui.commandChooser->setPromptDialogTitle(tr("Fossil Command")); + m_ui.commandChooser->setHistoryCompleter("Fossil.Command.History"); + m_ui.defaultRepoPathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory); + m_ui.defaultRepoPathChooser->setPromptDialogTitle(tr("Fossil Repositories")); + m_ui.sslIdentityFilePathChooser->setExpectedKind(Utils::PathChooser::File); + m_ui.sslIdentityFilePathChooser->setPromptDialogTitle(tr("SSL/TLS Identity Key")); +} + +VcsBase::VcsBaseClientSettings OptionsPageWidget::settings() const +{ + VcsBase::VcsBaseClientSettings s = FossilPlugin::instance()->client()->settings(); + s.setValue(FossilSettings::binaryPathKey, m_ui.commandChooser->rawPath()); + s.setValue(FossilSettings::defaultRepoPathKey, m_ui.defaultRepoPathChooser->path()); + s.setValue(FossilSettings::userNameKey, m_ui.defaultUsernameLineEdit->text().trimmed()); + s.setValue(FossilSettings::sslIdentityFileKey, m_ui.sslIdentityFilePathChooser->path()); + s.setValue(FossilSettings::logCountKey, m_ui.logEntriesCount->value()); + s.setValue(FossilSettings::timelineWidthKey, m_ui.logEntriesWidth->value()); + s.setValue(FossilSettings::timeoutKey, m_ui.timeout->value()); + s.setValue(FossilSettings::disableAutosyncKey, m_ui.disableAutosyncCheckBox->isChecked()); + return s; +} + +void OptionsPageWidget::setSettings(const VcsBase::VcsBaseClientSettings &s) +{ + m_ui.commandChooser->setPath(s.stringValue(FossilSettings::binaryPathKey)); + m_ui.defaultRepoPathChooser->setPath(s.stringValue(FossilSettings::defaultRepoPathKey)); + m_ui.defaultUsernameLineEdit->setText(s.stringValue(FossilSettings::userNameKey)); + m_ui.sslIdentityFilePathChooser->setPath(s.stringValue(FossilSettings::sslIdentityFileKey)); + m_ui.logEntriesCount->setValue(s.intValue(FossilSettings::logCountKey)); + m_ui.logEntriesWidth->setValue(s.intValue(FossilSettings::timelineWidthKey)); + m_ui.timeout->setValue(s.intValue(FossilSettings::timeoutKey)); + m_ui.disableAutosyncCheckBox->setChecked(s.boolValue(FossilSettings::disableAutosyncKey)); +} + +OptionsPage::OptionsPage(Core::IVersionControl *control) : + VcsClientOptionsPage(control, FossilPlugin::instance()->client()) +{ + setId(Constants::VCS_ID_FOSSIL); + setDisplayName(tr("Fossil")); + setWidgetFactory([]() { return new OptionsPageWidget; }); +} diff --git a/plugins/fossil/optionspage.h b/plugins/fossil/optionspage.h new file mode 100644 index 00000000000..769841c3de2 --- /dev/null +++ b/plugins/fossil/optionspage.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include "ui_optionspage.h" + +#include + +namespace VcsBase { class VcsBaseClientSettings; } // namespace VcsBase + +namespace Fossil { +namespace Internal { + +class FossilSettings; + +class OptionsPageWidget : public VcsBase::VcsClientOptionsPageWidget +{ + Q_OBJECT + +public: + explicit OptionsPageWidget(QWidget *parent = 0); + + VcsBase::VcsBaseClientSettings settings() const; + void setSettings(const VcsBase::VcsBaseClientSettings &s); + +private: + Ui::OptionsPage m_ui; +}; + + +class OptionsPage : public VcsBase::VcsClientOptionsPage +{ + Q_OBJECT + +public: + OptionsPage(Core::IVersionControl *control); +}; + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/optionspage.ui b/plugins/fossil/optionspage.ui new file mode 100644 index 00000000000..d573fb85cc7 --- /dev/null +++ b/plugins/fossil/optionspage.ui @@ -0,0 +1,226 @@ + + + Fossil::Internal::OptionsPage + + + + 0 + 0 + 649 + 336 + + + + Form + + + + + + Configuration + + + + QFormLayout::ExpandingFieldsGrow + + + + + Command: + + + + + + + + + + + + + Local Repositories + + + + + + Directory to store local repositories by default. + + + Default path: + + + + + + + Directory to store local repositories by default. + + + + + + + + + + User + + + + QFormLayout::ExpandingFieldsGrow + + + + + Default user: + + + + + + + Existing user to become an author of changes made to the repository. + + + + + + + SSL/TLS identity: + + + + + + + SSL/TLS client identity key to use if requested by the server. + + + + + + + + + + Miscellaneous + + + + + + Log count: + + + + + + + The number of recent commit log entries to show. Choose 0 to see all entries. + + + 1000 + + + 1000 + + + + + + + Log width: + + + + + + + The width of log entry line (>20). Choose 0 to see a single line per entry. + + + 300 + + + 0 + + + + + + + Timeout: + + + + + + + s + + + 30 + + + + + + + Qt::Horizontal + + + + 213 + 20 + + + + + + + + Disable automatic pull prior to commit or update and automatic push after commit or tag or branch creation. + + + Disable auto-sync + + + false + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Utils::PathChooser + QWidget +
utils/pathchooser.h
+ 1 + + editingFinished() + browsingFinished() + +
+
+ + +
diff --git a/plugins/fossil/pullorpushdialog.cpp b/plugins/fossil/pullorpushdialog.cpp new file mode 100644 index 00000000000..7129f51e171 --- /dev/null +++ b/plugins/fossil/pullorpushdialog.cpp @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "pullorpushdialog.h" +#include "ui_pullorpushdialog.h" + +#include "constants.h" + +#include + +namespace Fossil { +namespace Internal { + +PullOrPushDialog::PullOrPushDialog(Mode mode, QWidget *parent) : QDialog(parent), + m_mode(mode), + m_ui(new Ui::PullOrPushDialog) +{ + m_ui->setupUi(this); + m_ui->localPathChooser->setExpectedKind(Utils::PathChooser::File); + m_ui->localPathChooser->setPromptDialogFilter(tr(Constants::FOSSIL_FILE_FILTER)); + + switch (m_mode) { + case PullMode: + this->setWindowTitle(tr("Pull Source")); + break; + case PushMode: + this->setWindowTitle(tr("Push Destination")); + break; + } + + // select URL text in line edit when clicking the radio button + m_ui->localButton->setFocusProxy(m_ui->localPathChooser); + m_ui->urlButton->setFocusProxy(m_ui->urlLineEdit); + connect(m_ui->urlButton, &QRadioButton::clicked, m_ui->urlLineEdit, &QLineEdit::selectAll); + + this->adjustSize(); +} + +PullOrPushDialog::~PullOrPushDialog() +{ + delete m_ui; +} + +QString PullOrPushDialog::remoteLocation() const +{ + if (m_ui->defaultButton->isChecked()) + return QString(); + if (m_ui->localButton->isChecked()) + return m_ui->localPathChooser->path(); + return m_ui->urlLineEdit->text(); +} + +bool PullOrPushDialog::isRememberOptionEnabled() const +{ + if (m_ui->defaultButton->isChecked()) + return false; + return m_ui->rememberCheckBox->isChecked(); +} + +bool PullOrPushDialog::isPrivateOptionEnabled() const +{ + return m_ui->privateCheckBox->isChecked(); +} + +void PullOrPushDialog::setDefaultRemoteLocation(const QString &url) +{ + m_ui->urlLineEdit->setText(url); +} + +void PullOrPushDialog::setLocalBaseDirectory(const QString &dir) +{ + m_ui->localPathChooser->setBaseDirectory(dir); +} + +void PullOrPushDialog::changeEvent(QEvent *e) +{ + QDialog::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + m_ui->retranslateUi(this); + break; + default: + break; + } +} + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/pullorpushdialog.h b/plugins/fossil/pullorpushdialog.h new file mode 100644 index 00000000000..cffb301424c --- /dev/null +++ b/plugins/fossil/pullorpushdialog.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include + +namespace Fossil { +namespace Internal { + +namespace Ui { class PullOrPushDialog; } + +class PullOrPushDialog : public QDialog +{ + Q_OBJECT + +public: + enum Mode { + PullMode, + PushMode + }; + + explicit PullOrPushDialog(Mode mode, QWidget *parent = nullptr); + ~PullOrPushDialog() final; + + // Common parameters and options + QString remoteLocation() const; + bool isRememberOptionEnabled() const; + bool isPrivateOptionEnabled() const; + void setDefaultRemoteLocation(const QString &url); + void setLocalBaseDirectory(const QString &dir); + // Pull-specific options + // Push-specific options + +protected: + void changeEvent(QEvent *e) final; + +private: + Mode m_mode; + Ui::PullOrPushDialog *m_ui; +}; + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/pullorpushdialog.ui b/plugins/fossil/pullorpushdialog.ui new file mode 100644 index 00000000000..eec47059a67 --- /dev/null +++ b/plugins/fossil/pullorpushdialog.ui @@ -0,0 +1,235 @@ + + + Fossil::Internal::PullOrPushDialog + + + + 0 + 0 + 477 + 268 + + + + Dialog + + + + + + Remote Location + + + + + + Default location + + + true + + + + + + + Local filesystem: + + + + + + + false + + + + + + + For example: https://[user[:pass]@]host[:port]/[path] + + + Specify URL: + + + + + + + false + + + For example: https://[user[:pass]@]host[:port]/[path] + + + + + + + + + + Options + + + + + + false + + + Remember specified location as default + + + + + + + Allow transfer of private branches. + + + Include private branches + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + Qt::Vertical + + + + 20 + 4 + + + + + + + + + Utils::PathChooser + QWidget +
utils/pathchooser.h
+ 1 + + editingFinished() + browsingFinished() + +
+
+ + + + buttonBox + accepted() + Fossil::Internal::PullOrPushDialog + accept() + + + 257 + 177 + + + 157 + 274 + + + + + buttonBox + rejected() + Fossil::Internal::PullOrPushDialog + reject() + + + 325 + 177 + + + 286 + 274 + + + + + urlButton + toggled(bool) + urlLineEdit + setEnabled(bool) + + + 80 + 121 + + + 332 + 123 + + + + + localButton + toggled(bool) + localPathChooser + setEnabled(bool) + + + 112 + 81 + + + 346 + 81 + + + + + urlButton + toggled(bool) + rememberCheckBox + setEnabled(bool) + + + 71 + 92 + + + 163 + 153 + + + + + localButton + toggled(bool) + rememberCheckBox + setEnabled(bool) + + + 71 + 67 + + + 163 + 153 + + + + +
diff --git a/plugins/fossil/revertdialog.ui b/plugins/fossil/revertdialog.ui new file mode 100644 index 00000000000..1d43276410d --- /dev/null +++ b/plugins/fossil/revertdialog.ui @@ -0,0 +1,106 @@ + + + Fossil::Internal::RevertDialog + + + + 0 + 0 + 400 + 120 + + + + Revert + + + + + + Specify a revision other than the default? + + + true + + + false + + + + + 10 + 30 + 361 + 31 + + + + + + + Checkout revision, can also be a branch or a tag name. + + + Revision: + + + + + + + Checkout revision, can also be a branch or a tag name. + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + Fossil::Internal::RevertDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Fossil::Internal::RevertDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/plugins/fossil/revisioninfo.cpp b/plugins/fossil/revisioninfo.cpp new file mode 100644 index 00000000000..3e639340ab2 --- /dev/null +++ b/plugins/fossil/revisioninfo.cpp @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "revisioninfo.h" + +namespace Fossil { +namespace Internal { + +RevisionInfo::RevisionInfo(const QString &revisionId, const QString &parent) : + id(revisionId), + parentId(parent) +{ } + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/revisioninfo.h b/plugins/fossil/revisioninfo.h new file mode 100644 index 00000000000..294bfa23f72 --- /dev/null +++ b/plugins/fossil/revisioninfo.h @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include "branchinfo.h" + +#include +#include + +namespace Fossil { +namespace Internal { + +class RevisionInfo +{ +public: + explicit RevisionInfo(const QString &revisionId = QString(), const QString &parent = QString()); + + const QString id; + const QString parentId; + +}; + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/wizard/fossiljsextension.cpp b/plugins/fossil/wizard/fossiljsextension.cpp new file mode 100644 index 00000000000..664e1c249ef --- /dev/null +++ b/plugins/fossil/wizard/fossiljsextension.cpp @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "fossiljsextension.h" +#include "../constants.h" +#include "../fossilclient.h" +#include "../fossilplugin.h" + +#include +#include + +#include +#include + +using namespace Core; + +namespace Fossil { +namespace Internal { + + +class FossilJsExtensionPrivate { + +public: + FossilJsExtensionPrivate() : + m_vscId(Constants::VCS_ID_FOSSIL) { } + + FossilClient *client() const { + return FossilPlugin::instance()->client(); + } + + Core::Id m_vscId; +}; + + +void FossilJsExtension::parseArgOptions(const QStringList &args, QMap &options) +{ + options.clear(); + + foreach (const QString &arg, args) { + if (arg.isEmpty()) continue; + + QStringList opt = arg.split('|', QString::KeepEmptyParts); + options.insert(opt[0], opt.size() > 1 ? opt[1] : QString()); + } +} + +FossilJsExtension::FossilJsExtension() : + d(new FossilJsExtensionPrivate) +{ } + +FossilJsExtension::~FossilJsExtension() +{ + delete d; +} + +bool FossilJsExtension::isConfigured() const +{ + IVersionControl *vc = VcsManager::versionControl(d->m_vscId); + return vc && vc->isConfigured(); +} + +QString FossilJsExtension::displayName() const +{ + IVersionControl *vc = VcsManager::versionControl(d->m_vscId); + return vc ? vc->displayName() : QString(); +} + +QString FossilJsExtension::defaultAdminUser() const +{ + if (!isConfigured()) + return QString(); + + VcsBase::VcsBaseClientSettings &settings = d->client()->settings(); + return settings.stringValue(FossilSettings::userNameKey); +} + +QString FossilJsExtension::defaultSslIdentityFile() const +{ + if (!isConfigured()) + return QString(); + + VcsBase::VcsBaseClientSettings &settings = d->client()->settings(); + return settings.stringValue(FossilSettings::sslIdentityFileKey); +} + +QString FossilJsExtension::defaultLocalRepoPath() const +{ + if (!isConfigured()) + return QString(); + + VcsBase::VcsBaseClientSettings &settings = d->client()->settings(); + return settings.stringValue(FossilSettings::defaultRepoPathKey); +} + +bool FossilJsExtension::defaultDisableAutosync() const +{ + if (!isConfigured()) + return false; + + VcsBase::VcsBaseClientSettings &settings = d->client()->settings(); + return settings.boolValue(FossilSettings::disableAutosyncKey); +} + +} // namespace Internal +} // namespace Fossil + diff --git a/plugins/fossil/wizard/fossiljsextension.h b/plugins/fossil/wizard/fossiljsextension.h new file mode 100644 index 00000000000..d1f90d290a0 --- /dev/null +++ b/plugins/fossil/wizard/fossiljsextension.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (c) 2016 Artur Shepilko +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include + +#include +#include +#include + +namespace Fossil { +namespace Internal { + +class FossilJsExtensionPrivate; + +class FossilJsExtension : public QObject +{ + Q_OBJECT + +public: + static void parseArgOptions(const QStringList &args, QMap &options); + + FossilJsExtension(); + ~FossilJsExtension(); + + Q_INVOKABLE bool isConfigured() const; + Q_INVOKABLE QString displayName() const; + Q_INVOKABLE QString defaultAdminUser() const; + Q_INVOKABLE QString defaultSslIdentityFile() const; + Q_INVOKABLE QString defaultLocalRepoPath() const; + Q_INVOKABLE bool defaultDisableAutosync() const; + +private: + FossilJsExtensionPrivate *d = nullptr; +}; + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/wizard/projects/vcs/icon.png b/plugins/fossil/wizard/projects/vcs/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..496f8818a58a58c2979ac8b908848fd7e8193cbd GIT binary patch literal 14500 zcmeAS@N?(olHy`uVBq!ia0y~yU?^u`V5sC^VqjqC3DjK6z`($k|H*Y zfq{Xuz$3Dlfq`2Hgc&d0t^32kU_R5+#WAGf*4w@1TjpLZ)wenwb$|PJJJ-GCoSqz| zT@Ji0EJ6wwa}Vs8enj=7w_Dz)Nrsd5l)v9`erNuZWAB&!IJPlgCi(G=FG?*LiUqSv`NV^||@}`@haw))&{M$glri zFIcnZ-v6%~r`m7(bUf@|MQzU0{yF=f|L^(l?SAeL1Ot3rSp^zS1~7^oJjK*7YX=8I(3@pX zBt!!2lfwQ@&|zRuQ9P^rL@dkjymOyI-$F4FgJ(+iQJ?GFi7xKW^J2_wM+tx2LMj&2w+FV~)b6Y>4joNhP&*`~h(vY)^B+&1&t4`;UW3n;~aZg+0zo*7#KJYy=Y_>KR1JM#+|J-_rJ@<+HDFyJbm5F(vLqjK8=}o zbI04A*SD{!Nq#;%n*ZJX>P?$^}v zcW3_mq~AL6aw7M&`>$fnY^z18uIqPkFq)W&wDHOQsWw0R@6Dg?bYGc!m5&6fx4)UX z)jsmiAAb4Df9(GI|7`D`|F2$L|L^Lh{{OB%I{yFNLv^{j#H+J>tNX88DLO8W`CQc4 zlH`8kc1)11NZq4!iN_o0XnkyikS5wfp4B$y;-G_wCzJ_`7!fx}Wci&)5E*=U)Hm%_sA3 zbKi7iwurXsD`ETG}(7$*Y8#xGSFp z&fa@wrqQ?Wc9mz-#bXLj-f(PP6tZ&lo8)5+Z@M#A8fsoyRat#vyNunJ%S*lM{#SCElCAJ#DJaq_%E<;NMe%K};JD3O0%g$%l%Z3E5?C z7Hgb)N?a`V|5^V#Wv}08tMka*c@m*}UNKB7c3sE{ODoQTOFyUPzuoo!rug-DHWll> zy_EPoK{-jxm1m+&k<^uY@$q)iBL7ssw=~REI_;9CrnE>XSvSqpD1=oxti&U3QE5b6 zmd~;tsgmDcGV6;T^VV1XUc0~g>Ks<_o;fx5Ce-m}`j?%3;x$9$vfIKZ0nyJbfA48< zNoaUtu}U^OlhNVP7oD|#Ry!QDWXV3BqBb){sj1-ADa)jimHyIBBFs(>?JE?$XUsYo zboPRg-{)iRta36w&v}__UwnFM{il_$|G)X>T3`3ux4!D~q5sJboAU1zyj@$I7H5=p z!*cg?r)M`;GBV2MXVzB!JoT+8^i9swX{pl&@rKtiHY??=VHgZ+{$ewukY=D=&-c-=d-)t zZT5eP{%*ge^!>&Ty%|DGD;8cA{I=zZvepbqWkIPK0#Yj!m3FjE-rb*bbDuU7OTlZt zExGqgH+3{#P&AU7z}UP{>c!4$$$w%DKFLjgF77;IbM^5f>WXX(roD>iWettf70Vq` zHEe$VdiMU_{~OKzI zVmUW?hLpkYL;DuLwXgftI^XvHtz&nOpEP%v)Zwo!Y2lPsaw4s)>rBTV>m|J&2YEDB zbt*3C&g!u$J+#Bo_pW?R)=TdEJ(fHEudsEuvRd$fV}{_&sTL7?PbEM9@#VKEZ@HM9 ztctP+U7BbG0EnVs5<>Hc3AM*cS-QoH>K>#F;C8 z{Srbmcksohy_jp>;OyS__D=np=vg&&2b%<&+4g^W^~>qf^1W*xeYz9kyLH}XRt9F9 z?=p{{ulXYv_WS7T!m?cPQ) zhi<*qTh7Xvr~P}fu_r;uX5-9O1%?AhN`vR|eP>iSCXv)(nEuGlw))&W%i3dSID>TW z?=E@y>Fes{v1W$-Z>{-d?p=^%t}5Xa@;u?Fv})!f%gvisUCTVYoArd#N)4lHI5-KX_5VgPX@+;o_fQ5$6;hVKoSGrtZyz%-5xx0BY zjk7cU$B90_D8e9e<&4bkUGt6RnkjqDne$08SjlUzGxPb3M^fIt&Q<0$Nyk#deP-Ob zk)QCW=GLuG2QI0b=iQz-Q)u(&9+xDy_kO(prT;rE=UO)LAcw#~L5q$fFV6HZI9{1z zZ4|dJ^?&T?xZnRCYybP%87?2QFZ1m@VO>)mw-py18B`okxG>5t-mKA+AQ0-MP>}av!<7J@ zh6`urJU#S4qWCOB?zatfkv}V{ljq-6to$)G^!2@4!e6m-$b=kY$*N=L?ul=(!J+AWY(W}|v>#9F@ipT%_=l}lq!{+`yyE1=w z&bqoHWs>#fNyS_nms$SU62#5N?eg^#qg5Hl9M=xFW34CRWVwSCPAfhWQ+nbgsIbb- z*paQwrRPWok7aC=CihX{Fj~C`BIm6>uZa2@uqH# ziZcuQB6FcApqTTAiMp6q%iNtVCz&^_YI585LvDHAl@ljAKdV_K-I(yOnZ1DLZm?a! zhabWE>u%L9G3}W2^vrU19`~t#&5XFF?IpY-9%nOR#^G;?p1KIwd#ZT)G*imXPz@*qKH4#!3nDJB&LAtRQR1WPj()g#q;WNdBFU-QV8Y-@AA;(U>{qg-qkK;N$&rmli9oP+i)# zWZ}!+x7BeKwaL7~hb~`lP<2ZYGCe;>XdwqzrOq46z@HbHz3<(qW0-s_%U9sy!oU@i zG@F<9b$5P$HNmr%oc2wN_xUOM>%9MyR0!>A73|WfDBxDO;*)n^aVNep_ zijZ4t+|7PlOZvN9W$NK*|Ftpy&HHV?{g#{Z z{Qr8MYJJuB#s7caQ{VUX!6x?Uy7Akd^=`e*|Hks#wWza=HWt$+D0}dPo;)pgmAS)9 zWVL+lejBNvh1*YCF&tw#{OijM)6}M2E~e^TYp1Szem&<-@gAvz^Y^_wo^m4TRfjG= z!xRy(*=4dn|LyIUd3mZeIO%<7(%M-Q6gg%uIufup|GWfMWqnn!cRrwT0I$r8JgZO`(>*=Ohd?O#*#wz}W$+xPEx{`d3S{5gDl z{=V-!r(a)tcUSuJiQ6VehAoZ~JsrDov+k7W&B|L-{JmrLzC18le{I#HrJ}dLy^Y`a zuD5h{dCuM4?_XTJwnmwM?ZPsn)g>*?>btJx-`@OV>(&3i&T!wa{ju@A-IgE6{dKC7 z-nQi)kG8(-l=q~@(3fkOP;y&GpRi-y`xUF|EZjrgpD^gnt2nrU@o&;K){SW#$E~u@ zuc_I)R;$D+$n`|pu`>)>YJ!EoKb|{!I$VBT$(H9cwRhNPd#@1V?wrw7toQNB4b>P8 z70*c>kph7YlYTlSUtVopR#X4+(OuoQT=OojPW*eT!z&;tJm+lY&ug~!Rd0UQ|G4h{ z|LMf#)AwvjJNvD6w|~i;Gb+yFbIa#!@a9<=wYIFRENpcs!`FGMpL#XMNEsSlpBbLT zS>_S&e6rFKRwkaVot7upNF{}@Y-o(--Qb;2AD#Mh_U-p|Z)U!~_xlFFT-~dyy6oS! zrkWNs@G(d*G9*p;zF||N;v_}R8I7IK{#KVo8{~TRn{J%drE)&&=0(J zjdOAr0|RqPi0@yG##@la$l63ctPFliUx?inKianlaDdgi6;+MG2?L zNgRqIlX-uC)2)2@blW+H8A?`HIMh0BTnnvzc(wHZ=XKTZsvdNP-@8${LpA$ti&sIG zX5y=hmaNMeR;&^X*|WT@%_%tf;^Ne;McI=S{O(lpX+^KtGwp!)QgvhLOE=5Kz*f7jhx{_?Z*y<4-jtDdVK6EJ@N zufW-|(&%E0x6L4onZn+ptAI0SfQ7PuERyp3_Y5Oj8<>HbY` z5A?^?EEPU@Tw>>}r@OKqAAE1~=g?jKwfBmC%wPy{?i1*odhra4gQ$Z5iz2(Bdz%Pz zmWoLGD_OB9#-R7ldu0Fiz7{{T`@^56t9iS#ZcSf5)2`%%LY9va`>KGR01@F!MV!S9 z$xdNMWDJXESPLzgqqApM@$>R&HpTai*I!-L({WDH;n=FS5XUu)jYjS%OJuH24DM~4 z*b$)F8gi6jOT>c8&CB}a?-?Idc(mK8@PDU~V36&qmFfQXI;U=JV0m@0`(n4W*}fgm zN~f!Bjf(TCS#fQ~T*(H(iJ#w?%rmR&4xC%uuu3ao+tamk&+pk_beLtqapTw9|0cY= zJiGkOHLnbvX^T>L=Ov$UY&{^;s9dn(-jUe?D$9BfyfAQxJ7--S?z#JL>14fsr?!6H zU-kLW#>4Dx4N{`3EaR+FKh3Wz`#0BEE$+(xbpH2Dj;$+%rcBXj3ii6F{vuMc^}r0p z-hD@Al$EBPUl;%TLRWZ8kdeIcSrv8e-UQwiX^tMe2bx@XJsMiLR;4`fkX$vZGpy~) zn{64tmNEyw-*W9rh)vB00Y(RohjV?(V)r+7Sh7saxR`5Q^Je2zZL1^^*6Aus9?j`a z3Y>5vQbc&+<>xD9m-Ef-oaL5gckkA}KdZLBE|a$_T(axc*|X}Z**UMm3R?TtttyzM zy+FUwyH}Vsh_!Q7(gFbvCYOtAI;^%-A3pO@+1|STocz7I)9LHxS!UnqaFe&WJ-eE} z?)SR+weR=2%T+#`8s&cb&uP7%e{bji`+Hj~);9Og0z2Nn)n-N0W?sItsc1!*$&-|W zyL&dAUc$@MBziKmInTBv<^Rcbht*e25>eFbOj;A-aKut1h(Y7$BJpHawnGWCxH*h= zOyT0Jo*ufKSAJi{u`TnKE}1kvHrb0|!t+Ym>92!+1a}D=gj^T>vT=HtT<&@`J=2S4 zTvRrES6ua3&NqZf>DJ4|(n{(|46h^^6*Ns{wU4XE$3Bld&iBT8&B_H^CvRPISzyAX zsI*Ak^PeS}IwV%8&Y9A6^x3gxj=e8c7q{KDN`Dq^UwBx)_Sd)kJ0*X&iu*}jU+!)w zdSFk?+f$5_k6mh~p!O?>|Dm)hOW?rnVV zDO0>>mO;&f2lIIE3TY?!7>eBRlCy1{)U7;A>iqkQ)fw{{zw6aLlYdwLt%25mc4oMQD?qE z=A|>X8cq79X#!al0oN_5NM& z-reRxj_a1&cB`&f#kBCdjFUrx2UqmBH}MsLUiWiXww-1Dx2MKxF_j;G7}|PY zcH`gq<&Wa@KG~|9I}|so_w4$0$@l-R>{@_PFxPUsj6u%G}uR zeoTiBmJyzv2F*+t>(?SJmp^6%S~Ded}}vFziCgV)c@ z_;q&ny1)M0?|xZ6f7jc7yUNe+V~VdX*PmZ^{7m=z8HR7Y!_WV_^YwGy{%@c5|M)eR z^>FF#?>U*dv71xRFZSR6t^d2u&etoSUwdyosnfrw3Ic(8fr2wE zPj9Mvv;E1}-gf`8UU|zOt6qxVEqp5)zpL(^xqao=_q9pyp0Atz^QrXnnzz?j@9!x6 z_k8`#%D-PYr}w_JPYg(2d2tT^x#KE^YP?cPQbm&(x|p<7+3qerGvDatAwlI`#>;O> z>fXK^_ILU5dA}b%KHXoc#9%3KZZ+?{wlBH!EV52K6^}D0|8?c3vED5E;#XfMtDT)& z^zX$(TZx=AHy*y|jCFFmX#Or=cmIyW*RlO}Uk?cD%UR8QYkTqM<94~qA19wrUw?PY z=MyI%$1YS3m>v+$r*7SR?b13wi+h6R?{9wp^y+%~J9`C90R|B+R+k$0E5ZM(_AENT zF6wqvr^cJT>m579VndU!1O+XUX#f7&GWpWa%j)y*FW+fsS^I1Pr@&c;PYQiE7$4eloDa*41I-)Polol^KbudUV47drp$DO_SP#h*G;aeoYqxv zE%AzLzJGx?a}mn&|4CtffwJ zC#9D;@Ot>3%U*iPSW{%GjrxQgQf(@#Mh0t)8K#zV8KiCd)61K`XRC34kk=)zu$3Ew zUU?swC)|Ey(PgzB`73)1zckoAcI!P<@oQJ)H22F(CUmXrFlbZ`IeB@-?DE{Z#cu>8 z5`1rnu6nR)f?H~!ykVf$3T-#NClMUe#FB$HZPAcxnl$mVTy0RWYPgB+Y)TbUM;fbE=d1NQQ)RXIa(sl?@!T zcrvtf_Ee<3H{sP=5jvN3^)-Q=&nEF!f8V#UHb3e`-N7p#_p*I!6;bZm#B!qetWwJw z&(l$CJaTKx*UN3z-}A#bJkD8?#bkklhu!5ff(kpf^KG}=oW-rydv0gc3e`7UP7AKR zD=rOK7uwDzWAd}fP&4G_u5=x`ice>{Tvh`nI@#X8;M$Tk$hiR@wa}1VRhII$pE)|qv z+;sB7LEmznS>|_yGd#~QDq5#@rG>3Kc~5z*$f0ntGe7s|?|sHEcJ9}mJukP%ndRQQ z(m6fe>R<8nxIe8sjrSFv{$szd_~QJ#+ddQ*FON0JW2h_;Qm!-+FuM?A+$j3`dU@EX ztv10|gE{{N>qMPaG^w0noB5?-*|VZ~Hv5uJC+n|Y<#4un=}P_Qq6*%VTs}RJ+`Pxh zrPS!3-@*fDLPT$BK6uB>-nXSpQ=##&)uuU%O)C@DpTAe|)>T-og=2<^L(r=;n~UOV z-y9X?xBtAUh*@%}oR%WT!sTvB4hGBt41r&Hp7%;@da!T2SK1P`Lv9Wyr`fWH=hkU+SB99nDAc%npK6dxJTu|nbYIK=1*bdze?773cif$V z9k%Tf9-+EUk5&l@?07M0O_*QzpSV_yN44$!Z!HTrGz}dLel1O1v-$E7i%o%lt820@ zhH~r8j%rDmG*O#HFQjpL{=J`fUeC5ZJ<-8%<199jbfK#u6F=k@2AKO_R-5<#=FZK( z%v2>Kzw{YqK5_XhwWQ&J**p6`f7!*~TbE2)WcE8DvN~&FkFedU?X6h{RkvD#H+Wfx7 zns9R^UFW62#?H%AKQL)dFMDfQc>hwWyOmYbGrdG-(UYOfGp?8(?33N7ED#XD=xXd- zSA6^)@9u95;(nsL&)gH-a&`av+nb+1oBLaA|A$}igkzJU5;QGNeX@}!_{G{)JM&f;0so!Ou|Nn%az%`?ti>$b$Xxt z#m#)8A|YBnFQ@v!&FQ;}jC7t&nb+i=z`W}8#3l_!$15`ysef4;TATOw)+|PjJ-grh z=i8=r<6_qBRcE84cO{)PEoVMh|TD&^kSPjir_@6(2*Wi75{;pq>I>mcl+}?fi^1kNX z*1N2N!(9wg0s@Uwk{C=U2g}dAc}A}G)yd^?wUr+l{%w!3N?xMx6=uyhbLt$2bMsEK zWp8^I`Sn+{hK?iS%?6P*an@`_C+0C6^pOxalY3)Z^67(zLo_y=u;zLcZ02O*b@0xq5Do4)$=_O}&po{I9_S-yVnw^!W9`E%N$!p~Z&g!SB-`g+#e>RZJg_tpu| zlALwr{l8!HS=&XDI|A?D_!Q>4MeL}ufzm-uc9DryB76)YOOEtRbL28@n{#7f`9&%3 zR@d;@%GXz?->6=X==|m>n+! zTe~ek65vx^`u?`@+gQGm@80M0GObH)Zw>!*@{aa%znxnSR&&e@PxZTRRaWvfI{(_H zbL9*Sf|9)#Ii@gmFu&iqBkO!4?{B`TTV5ESytI9?d)X`JqS(ePfg7F0j%QhdiuC$> z6Q1+G`F{NRnW&13KUfx2Kg!#g^lR$mV=59>o;QR-(vKwx@J?~?Y3`V5@o7SK)4myM zZCZjCCdFU5y?1-Ldk;ebqoj;7Cx_zE6^z-IS1w)IzU|oWX}N!XACIrDy1dR$F#S$( z!23B(tx;T_EMg}7febE8%ncI)m0tKbGbS-Un&4O~bG>WA@;g6n6zALg{`Ks$I?vBb zhdk>GkC$#gyR+m_CG#@g_tRVcxcjgB@!I{`TdOeVpkq-i!U=3m0jf+aTeCLk-Y$39 znl(?*_(Z0CD2L)ROTo(b&KwRE_hwwYuD8dp`rECNCr2i)Ut9mB_38P&yWU;+SoVdL zsZU}mYamCDPh^X)u#@*Co3>}q+_qd;?QX8-U}RO?Da)w1$UDM!^B%7RhF2Wk2Q)>t zz03Z4@A7$@EsreMmVEQ#ntQb--^{JMWw!CKD95w(@=Tmv>h$-TU?-+56w` zSo@#y_B)@e``hmSF?Fl|x|rRW*Z=8=yYS7>bW{1h5*CQeK1f_{H8UM89ve$k4a(eal_s30o7e>8(_2S~%-=gBaG8fld zE3R53AuzGgqKu;}WfhlOhuZ><6$$55@5=biFJctr44Crg!NzIoVR;sJ;u8Js%1oQ* z*%bacaq)4-jH;-enWw+)br%$JV(w;C+N5j{bZl+)_pK!*uEFshye*M;d!vvE4V>``j4 zdL!#rj)W8G_ckx}II#1Hn;S#ginc{ts*X3x+kE}9>~OpA$9--`_T6}q<|}8Nd}#*@ z!`mwp_}r!lFid$>RG4C@YBH69!J+Tu@vP%#G=AQ+(v>5B3@_GZVFVX6m5!yi?%7 zjL1c^Bo&-(t<%$#*wQ?*W?8(t8nLJ3)ep7)C9||yyuxyC?M=MSSg>-1T<&X*QVSNA z=lAbyEdM@Hj3J4ICB%X02=no%Z}PTkf*c$8w!Z(nvg>HlB$cgEYh(1-MH#rV1XL7r zzU+H&VezbI%O1@+?2&Qg&BQq~j!kG?lXLadg1n=vm-+6^xpadqyx#iQ_S>cBX82_& zB(a1TveqwH`g!5=IJ-MxZ9Wmsz1a~>l8=wwwJJ`#&(V2$N!hB6U&sBjYW{Z1)b#-TVZJXulQS3ZjtuJDNVjIJ|v$4OG z6q*euTyws~+|Iwf{HnwZUY}QQkA9J>m8qN;p1pO~PFeM&Wo;9dU7ayKd+wxkHA`iK zof=*&E-Wd5&Bwe1OACq*|2X*9erv%y^>s7v?%z3O!qdoU&ksGh8>vw%xOipb!pK+L z>bJDduZ!56_TC$MPG*4nGP zdS^;7DH$(dQW9igWq5Uc!kL{Jeg-TPf;)r-5)?0kE-Wk!du3uH}l(~9Kj?A&;} z>_b8Iw8es&^Cq3xwq@(8rspjzGb0av`EoCZL+|6g-@87AyPUaTDK49qF~cI>=IF%E zIb1V4n^w3vy}TB%C*ewm^z+!CTdm*iD7aI(()IM}gb7Pri{kuETjzdUb^4YIPs6sH zyB{B&x<2XM-X(VwJK6Q_R6cE5A7i>b+SBBspFy(tl~?=TbnJaTZL)5p9z(^C6P-`B z;F4SG)E!x}M}XsBF-+ z=$AmSbC^@XldeF^^U8})vvRpCt~S%3WAp6$`u(3~o1dR;T^X_eSXAs5FFQd7Lst`q z+Wr^Kp`5%EKXdF{v`{{yzS>#r;n-f zE?6eDgp;dHKvRJ0h?E3df&c!UpY!KOlr34hc;}TGi`RGR-*C8`zQO3o#Fdre@S<5o z^T=v_yZl2p6lG_qOj-Hi+~cX{WpA}7x-ao_VR>Pa;lrhS-2YwH%Z?dLo>R0qop#2w zY4q+>xY{84@*M9C)f7wTgdUfRi#M47wFs20|^%f|?fa z7%q)ySi#VK>uH4~_q2GE6&0uNc)yD<$^Z3aqpSPYHC<=!iEonN=wSY_K#oh`pmdM4 z(TdXZ=l=hE@i_Kk`D?p^*9Vnne&)1Lk1+?>(hxZ;P zyR#l};p~t|IQFDd*o~)X&dTYVLZUWpTc@%}TTy)Kr4Bs}_tenk&vvZ{d%DJL>w?q^ zS<1%`+DfVMy{v!xggbA(@#ELq^?v!!-}(6U_B#cSdoqLBzP#>^YIM>od*` z6=E0LnKn2ZpWSpupypNpbNQ0J-#&Q1-v4#)Z@JpC)YqM2eNPLSclk;iS9r|7H}A~C z85w(n6=y8$RKI-WiV3sTg_|EQcQ=`A{`F8CeuQh+(t)2V7H`IN87ISlby!~`F!8b0^)

I z#SX0u6F(xH`*y2FR{{fzlsb=m&GSX8^Y`bydvdY4{d<p19q+HPlNlx|x*Dulv_J>$d-N zn}6s1bv9nR_ImxUPuH^7%bM5yIsMw~Z^g$=`}h5Bd~dVkNjtyp@8k1rzcshd|M{-g z`~SOp$Nzu4xO{){|Hb!reqZQ&d)u<5Q#ia>uU`o7_x+e&e(&SepT+yjPG61R{q)uPyH@|D=SO^~-md>=?``qF z2bYWeeK_}e{p;@ezwPZSKZ`$$-S}aVrtx`s)5M7VihI3mgNyXs*DyXiaPfo@hbiyW z8J&p+L7$%3>~86Bapt%=Giv99IgxwK9a%eWet&bb_|z25`jX>wvi0|;+ oJ3eA- zUjFIL>-Ra6 z_Z$><U`6%2b3MpJudS<*_pjO^F7=%&Kai`huT#XFTGN zX`0z8@kwIBiQiw&IP-TepJIHk(bQswS>l%_Z*~4xm$ww1-DNtvjK?m2O_S(cvx*lS zNeZmzmtIkJnJjabA+kYg!Np=Jh4Yrq`n&?_d~bdpbuAW;vt6Hmei>7=TByPnjWaxv z0#{W^S5zLFP?a9&p{w}ZVr5y$S3MPRo;UW19~v0%O4%-CTGZId=h<7U7IoVAeeL;qwxOS@KK)v}m*>LnD>qg$ zx(EgqcQ)83tE9A5Ij?=GS<51%ICG(-l92-QCaEr`0Bwu!e*N}LY8;QWj+kgv+Rzsb6mT+hs{mUfZbQ<`3w<(^LI}1eEYWHQk77=6OSUB0{fF! z%89RBTpM}(uS)lv=-_2h>5;jReQn7{F{d?G=d?U@Zd=mQ!m*##|FxEioWs#89SkBW z9WL99_r20eTGVmkh|ilFme2Qmc5z`yOIoDHwVZAi*)fz(AAf%nX}+<)v^||JVF<2gQ7npwE+2xn?-8M-EmeubMUQ)5F*!1_K=xe@`k}}uO zjTsBrg5*E{4`h6L|BP_sIh7C>W}Bn7Ng+$F-@CCX?|7ZJ^ra;?HoNx+Kb8_XX&2=G z+A3W6#W_)bcLV>9j-3at?PU+kzav)TcqQn`Jzn3hd#e^0pG&TpQ2wI*&76ReWlV;~ z4|*<#-@jA1V(Hz=`9}ON?k-Mu)`|)?aB*AQZxH`4!B9nErdv7_!*2fVd3S1eXf2C6 zn-zPQ{hRMx!Db<*B%X&oGw-nTN&SEK*sdM_;-?u&V>h7%KUk~0LRXW1Kv2o$v*lX|Z`MDM-No9C! zKQ>XBy8l-i=A<8)=*%`% z$lawOVZ{-L{pVOt#anUyky-Srokh}bcRdr!3yz;{vevt;vePo=2{)Wv>^_Y{;Gn~j zdxutd?e8nJcUo8e?z8$E$AteIg{z~Zni)2`Z>h80)h~Ca|GwHOuAuk7Y?HP3U;g)9 z``rHjqUSgEKN32iyZif=t47bebG#<`?tQQ)&ewHA1_xVd?z#h(mEX?gHw4y7aP~W0 zP56HB@Ya|M*4&l%or)grnAo#QN|1v=at5QnE!W#KO5VSIE}Z)OgQsfx7lm#7WgCAg z%g#OSzpZ)anJo`8Zr%9I_AM{OKsl@+qlb;-RLwTioSN|1hi?jg9zI-i-b|hScc0A4 zw8}$zD@@F%=*>1+`69qUaOJ%F48{SQH$RhD{wj8VoA`evWxKoa*4sJimid23C}h!V z%G|rxTjavi6U#QP-ugF1PD|si@46Wlc}Fhn(`f8D*`uH|OHfN_&eos@+uK6^?3Q10 zsM6)*3j=nMw6v)X0-394KU*H$C{VNK-fZ#oOH<5PHgKgp;AIGz zTlg|VwN0Q()!_f6laJkb*)N-Tiaa_VW~Z&!s2bQKz@g;DaNzLN48Kpk=-*f%<$F25aodZ(cUM(8B#CJ_JX-PNSzoPv)SfTzmd{sjxhd{H zuj-z`DXZk3V}2jsioN@O_>{b*P??+by2J@HL|5DhYg1jnZg2I?&(hoWny%RS{OjiB zU-NX7G8RT8q*um$p0n!H@s2{X)6UP%Zdzr#GwJR5ur;>|zC^r#w|D=Zgo{f8ooyUU zGkmWoPZ45j$awd6($zBV-cHa$F=y2N@|9DV#RV85leXxXEL-__iPA#1cb!w$>sRMGr>pwRHh3r; zes)L38HJwE<}ZsApB9&<&3k#@(o~ASQGnxWbJYbF2Zc_qbCIVkBi1oAdY@lknfLsyW|z zP5Jog+h%X2Op9JT&yOqk+{1Zzcj3uoUX5_wISX&v8EF4!Q}|(WaE`Hy;KdazC!UNHGAI+pU@ZbdfNZl4n!%c2dBA}ynVVM^Y^}^=hyzYXUlK9tM2$Q<+rDf zdL|#M`}b`2y7}d(@ zt$lv1`F~D7R?ndEeB(A5yDyKI_W!@^+`snDp6?k)zZMnUe4!Y>xA5Ne{5j^eA^X!# zcowlT`1AE=($_TY2gdWKeL5}3+{iJbLGrHk{Xb&+8!p@N z^49;nYQ6vOS^xUvgIl80d}MA+Q9Hva?6pp)^W@yDTaNEv%-N&4*I%-e|LrNk7(>Pr z9H-BPGB!_Kt-)OJfT>`X^pRbf436i{E_w97z~`J~L(>fYNo^554_FmGE@5CwXy}=D zfKgz*GCXHFwG8{3MnH~$}CP!d|asy658=BR^)j6i@5IMkT@w}Ts&VaF`fv@A?m6Ci13wIvo z2mjfV1CH!m9h@e?z`&qd;u=wsl30>zm0XmXSdz+MWMF8fYha>lWDsI#YGrI>Wn`*r zU}|MxaI?_;7>b76{FKbJO57S&==`r@U|bP0l+XkKD3HUV literal 0 HcmV?d00001 diff --git a/plugins/fossil/wizard/projects/vcs/wizard.json b/plugins/fossil/wizard/projects/vcs/wizard.json new file mode 100644 index 00000000000..30423ede177 --- /dev/null +++ b/plugins/fossil/wizard/projects/vcs/wizard.json @@ -0,0 +1,255 @@ +{ + "version": 1, + "kind": "project", + "id": "I.Fossil", + "category": "T.Import", + "trDescription": "Clones a Fossil repository and tries to load the contained project.", + "trDisplayName": "Fossil Clone", + "trDisplayCategory": "Import Project", + "icon": "icon.png", + "enabled": "%{JS: [ %{Plugins} ].indexOf('Fossil') >= 0}", + + "options": + [ + { "key": "vcsId", "value": "I.Fossil" }, + { "key": "vcsName", "value": "%{JS: Vcs.displayName('%{vcsId}')}" }, + { "key": "isCloneRepo", "value": "%{JS: '%{RepoType}' === 'cloneRepo' }" }, + { "key": "isLocalRepo", "value": "%{JS: '%{RepoType}' === 'localRepo' }" }, + { "key": "SR", "value": "%{JS: '%{Repo}'.replace(/\\.(fossil|fsl)$/, '') }"}, + { "key": "defaultDir", "value": "%{JS: %{isCloneRepo} ? '%{SR}'.substr('%{SR}'.lastIndexOf('/') + 1).replace(/\\./, '-') : %{isLocalRepo} ? Util.baseName('%{LocalRepo}') : '' }"}, + { "key": "defaultFossilName", "value": "%{JS: %{isCloneRepo} ? '%{defaultDir}' : %{isLocalRepo} ? Util.completeBaseName('%{LocalRepo}') : '' }" }, + { "key": "defaultLocalRepoPath", "value": "%{JS: Fossil.defaultLocalRepoPath() }" }, + { "key": "defaultSslIdentityFile", "value": "%{JS: Fossil.defaultSslIdentityFile() }" }, + { "key": "defaultDisableAutosync", "value": "%{JS: Fossil.defaultDisableAutosync() }" }, + { "key": "SourceRepo", "value": "%{JS: %{isCloneRepo} ? '%{Repo}' : %{isLocalRepo} ? '%{LocalRepo}' : '' }" }, + { "key": "TargetPath", "value": "%{Path}/%{Dir}" }, + { "key": "FossilFile", "value": "%{defaultLocalRepoPath}/%{FossilName}.fossil" }, + { "key": "argRepoType", "value": "repository-type|%{RepoType}" }, + { "key": "argBranchTag", "value": "%{JS: '%{Branch}' ? 'branch-tag|%{Branch}' : '' }" }, + { "key": "argAdminUser", "value": "%{JS: '%{AdminUser}' ? 'admin-user|%{AdminUser}' : '' }" }, + { "key": "argSslIdentity", "value": "%{JS: '%{SslIdentity}' ? 'ssl-identity|%{SslIdentity}' : '' }" }, + { "key": "argIncludePrivate", "value": "%{JS: '%{IncludePrivate}' ? 'include-private|%{IncludePrivate}' : '' }" }, + { "key": "argDisableAutosync", "value": "%{JS: '%{DisableAutosync}' ? 'settings-autosync|%{DisableAutosync}' : '' }" }, + { "key": "argFossilFile", "value": "fossil-file|%{FossilFile}" } + ], + + "pages": + [ + { + "trDisplayName": "Configuration", + "trShortTitle": "Configuration", + "trSubTitle": "Please configure %{vcsName} now.", + "typeId": "VcsConfiguration", + "enabled": "%{JS: !Vcs.isConfigured('%{vcsId}')}", + "data": { "vcsId": "%{vcsId}" } + }, + { + "trDisplayName": "Select repository location type", + "trShortTitle": "Repository", + "typeId": "Fields", + "data": + [ + { + "name": "RepoType", + "type": "ComboBox", + "data": + { + "index": 0, + "items": + [ + { "trKey": "Remote repository clone", "value": "cloneRepo" }, + { "trKey": "Local repository checkout", "value": "localRepo" } + ] + } + } + ] + }, + { + "trDisplayName": "Location", + "trShortTitle": "Location", + "trSubTitle": "Specify repository location, branch, checkout destination, and options.", + "typeId": "Fields", + "data" : + [ + { + "name": "GotSource", + "type": "LineEdit", + "visible": false, + "mandatory": true, + "isComplete": "%{JS: '%{FossilName}' === '' || (%{isCloneRepo} && !Util.exists('%{FossilFile}')) }", + "trIncompleteMessage": "The clone fossil already exists in local repositories path.", + "data": + { + "trText": "%{JS: (%{isCloneRepo} && '%{Repo}' !== '' && '%{FossilName}' !== '') || (%{isLocalRepo} && '%{LocalRepo}' !== '') ? 'true' : '' }" + } + }, + { + "name": "Repo", + "trDisplayName": "Remote repository:", + "trToolTip": "For example: https://[user[:pass]@]host[:port]/[path]", + "type": "LineEdit", + "enabled": "%{isCloneRepo}", + "mandatory": false + }, + { + "name": "FossilName", + "trDisplayName": "Local clone:", + "trToolTip": "Base name of a new local fossil file to clone into.", + "type": "LineEdit", + "enabled": "%{isCloneRepo}", + "mandatory": false, + "data": + { + "trText": "%{defaultFossilName}" + } + }, + { + "name": "LocalRepo", + "trDisplayName": "Local repository:", + "trToolTip": "Path of an existing local fossil file to check out from.", + "type": "PathChooser", + "enabled": "%{isLocalRepo}", + "mandatory": false, + "data": + { + "kind": "file", + "basePath": "%{defaultLocalRepoPath}" + } + }, + { + "name": "Branch", + "trDisplayName": "Branch:", + "type": "LineEdit", + "mandatory": false, + "data": + { + "trPlaceholder": "" + } + }, + { + "name": "Sp1", + "type": "Spacer", + "data": { "factor": 2 } + }, + { + "name": "Dir", + "trDisplayName": "Checkout directory:", + "type": "LineEdit", + "isComplete": "%{JS: '%{Dir}' === '' || !Util.exists('%{TargetPath}')}", + "trIncompleteMessage": "The checkout directory already exists in the filesystem.", + "data": + { + "trText": "%{defaultDir}" + } + }, + { + "name": "Path", + "trDisplayName": "Create in:", + "type": "PathChooser", + "data": + { + "kind": "existingDirectory", + "basePath": "%{InitialPath}", + "path": "%{InitialPath}" + } + }, + { + "name": "Sp2", + "type": "Spacer", + "data": { "factor": 2 } + }, + { + "name": "AdminUser", + "trDisplayName": "Admin user:", + "trToolTip": "Privileged user added automatically to the created local repository.", + "type": "LineEdit", + "mandatory": false, + "enabled": "%{isCloneRepo}", + "data": + { + "trText": "%{JS: Fossil.defaultAdminUser()}" + } + }, + { + "name": "SslIdentity", + "trDisplayName": "SSL/TLS identity:", + "trToolTip": "SSL/TLS client identity key to use if requested by the server.", + "type": "PathChooser", + "mandatory": false, + "enabled": "%{isCloneRepo}", + "data": + { + "kind": "file", + "path": "%{defaultSslIdentityFile}" + } + }, + { + "name": "IncludePrivate", + "trDisplayName": "Include private branches", + "trToolTip": "Allow transfer of private branches.", + "type": "CheckBox", + "enabled": "%{isCloneRepo}", + "data": + { + "checkedValue": "true", + "uncheckedValue": "" + } + }, + { + "name": "DisableAutosync", + "trDisplayName": "Disable auto-sync", + "trToolTip": "Disable automatic pull prior to commit or update and automatic push after commit or tag or branch creation.", + "type": "CheckBox", + "enabled": "%{isCloneRepo}", + "data": + { + "checkedValue": "off", + "uncheckedValue": "", + "checked": "%{defaultDisableAutosync}" + } + } + + ] + }, + { + "trDisplayName": "Checkout", + "trShortTitle": "Checkout", + "typeId": "VcsCommand", + "data" : + { + "vcsId": "%{vcsId}", + "trRunMessage": "Running Fossil clone...", + "repository": "%{SourceRepo}", + "baseDirectory": "%{Path}", + "checkoutName": "%{Dir}", + "extraArguments": + [ + "%{argRepoType}", + "%{argBranchTag}", + "%{argAdminUser}", + "%{argSslIdentity}", + "%{argIncludePrivate}", + "%{argDisableAutosync}", + "%{argFossilFile}" + ], + "extraJobs" : + [ + { + "command": "fossil", + "arguments": [ "version" ] + } + ] + } + } + ], + + "generators": + [ + { + "typeId": "Scanner", + "data": { + "subdirectoryPatterns": [ "^src$" ] + } + } + ] +} From 0d957a88f9fb68a63b9e4ac26857aca82006371b Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 9 Feb 2017 11:51:58 +0100 Subject: [PATCH 003/133] Add Qbs file Change-Id: Ia3eb819c51eec501fac0feae7c515fb39e3d1a19 Reviewed-by: Christian Kandeler --- plugins/fossil/fossil.qbs | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 plugins/fossil/fossil.qbs diff --git a/plugins/fossil/fossil.qbs b/plugins/fossil/fossil.qbs new file mode 100644 index 00000000000..b725cd8dfb9 --- /dev/null +++ b/plugins/fossil/fossil.qbs @@ -0,0 +1,41 @@ +import qbs 1.0 + +QtcPlugin { + name: "Fossil" + + Depends { name: "Qt.widgets" } + Depends { name: "Utils" } + + Depends { name: "Core" } + Depends { name: "TextEditor" } + Depends { name: "ProjectExplorer" } + Depends { name: "VcsBase" } + + files: [ + "constants.h", + "fossilclient.cpp", "fossilclient.h", + "fossilcontrol.cpp", "fossilcontrol.h", + "fossilplugin.cpp", "fossilplugin.h", + "optionspage.cpp", "optionspage.h", "optionspage.ui", + "fossilsettings.cpp", "fossilsettings.h", + "commiteditor.cpp", "commiteditor.h", + "fossilcommitwidget.cpp", "fossilcommitwidget.h", + "fossileditor.cpp", "fossileditor.h", + "annotationhighlighter.cpp", "annotationhighlighter.h", + "pullorpushdialog.cpp", "pullorpushdialog.h", "pullorpushdialog.ui", + "branchinfo.cpp", "branchinfo.h", + "configuredialog.cpp", "configuredialog.h", "configuredialog.ui", + "revisioninfo.cpp", "revisioninfo.h", + "fossil.qrc", + "revertdialog.ui", + "fossilcommitpanel.ui", + ] + + Group { + name: "Wizards" + prefix: "wizard/" + files: [ + "fossiljsextension.h", "fossiljsextension.cpp", + ] + } +} From ecf70972e87599b8a18347cc75746da6868a0a64 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 8 Mar 2017 17:17:56 +0100 Subject: [PATCH 004/133] Doc: Add a doc project for the Fossil plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic465b8838f090688fab2fc966fa3fbf7409c13a2 Reviewed-by: Topi Reiniö --- doc/config/fossil.qdocconf | 35 +++++++++++++++++++++++ doc/doc.pri | 6 ++++ doc/fossil-online.qdocconf | 16 +++++++++++ doc/fossil.qdocconf | 2 ++ doc/src/{vcs => }/creator-vcs-fossil.qdoc | 24 +++++++++------- fossil.pro | 3 ++ plugins/fossil/fossilplugin.cpp | 4 +++ 7 files changed, 79 insertions(+), 11 deletions(-) create mode 100644 doc/config/fossil.qdocconf create mode 100644 doc/doc.pri create mode 100644 doc/fossil-online.qdocconf create mode 100644 doc/fossil.qdocconf rename doc/src/{vcs => }/creator-vcs-fossil.qdoc (86%) diff --git a/doc/config/fossil.qdocconf b/doc/config/fossil.qdocconf new file mode 100644 index 00000000000..98433df81dd --- /dev/null +++ b/doc/config/fossil.qdocconf @@ -0,0 +1,35 @@ +project = "fossil" +description = "Qt Creator Fossil Plugin Manual" + +sourcedirs += ../src +#imagedirs += ../images + +include($$QTC_DOCS_DIR/config/macros.qdocconf) +include($$QTC_DOCS_DIR/config/qt-cpp-ignore.qdocconf) +include($$QTC_DOCS_DIR/config/qt-defines.qdocconf) + +sources.fileextensions = "*.qdoc" + +depends += qtcreator + +qhp.projects = fossil +qhp.fossil.file = fossil.qhp +qhp.fossil.namespace = org.qt-project.qtcreatorfossil.$$QTC_VERSION_TAG +qhp.fossil.virtualFolder = qtcreatorfossil +qhp.fossil.indexTitle = Qt Creator Fossil Plugin Manual +qhp.fossil.filterAttributes = qtcreatorfossil $QTC_VERSION +qhp.fossil.customFilters.QtCreatorFossil.name = Qt Creator Fossil Plugin $QTC_VERSION +qhp.fossil.customFilters.QtCreatorFossil.filterAttributes = qtcreatorfossil $QTC_VERSION +qhp.fossil.indexRoot = + +qhp.fossil.subprojects = manual +qhp.fossil.subprojects.manual.indexTitle = Qt Creator Fossil Plugin Manual +qhp.fossil.subprojects.manual.title = Qt Creator Fossil Plugin Manual +qhp.fossil.subprojects.manual.type = manual + +# Doxygen compatibility commands +macro.see = "\\sa" +macro.function = "\\fn" + +navigation.homepage = "Qt Creator Fossil Plugin Manual" +buildversion = "Qt Creator Fossil Plugin Manual $QTC_VERSION" diff --git a/doc/doc.pri b/doc/doc.pri new file mode 100644 index 00000000000..84edad84eab --- /dev/null +++ b/doc/doc.pri @@ -0,0 +1,6 @@ +build_online_docs: \ + QTC_DOCS = $$PWD/fossil-online.qdocconf +else: \ + QTC_DOCS = $$PWD/fossil.qdocconf + +include($$IDE_SOURCE_TREE/docs.pri) diff --git a/doc/fossil-online.qdocconf b/doc/fossil-online.qdocconf new file mode 100644 index 00000000000..f191672a7e0 --- /dev/null +++ b/doc/fossil-online.qdocconf @@ -0,0 +1,16 @@ +include(config/fossil.qdocconf) + +HTML.footer = \ + " \n" \ + "

\n" \ + " © 2017 The Qt Company Ltd.\n" \ + " Documentation contributions included herein are the copyrights of\n" \ + " their respective owners. " \ + " The documentation provided herein is licensed under the terms of the" \ + " GNU Free Documentation" \ + " License version 1.3 as published by the Free Software Foundation. " \ + " Qt and respective logos are trademarks of The Qt Company Ltd " \ + " in Finland and/or other countries worldwide. All other trademarks are property\n" \ + " of their respective owners.

\n" + +include($QT_INSTALL_DOCS/global/qt-html-templates-online.qdocconf) diff --git a/doc/fossil.qdocconf b/doc/fossil.qdocconf new file mode 100644 index 00000000000..dcb0a5dc29e --- /dev/null +++ b/doc/fossil.qdocconf @@ -0,0 +1,2 @@ +include(config/fossil.qdocconf) +include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf) diff --git a/doc/src/vcs/creator-vcs-fossil.qdoc b/doc/src/creator-vcs-fossil.qdoc similarity index 86% rename from doc/src/vcs/creator-vcs-fossil.qdoc rename to doc/src/creator-vcs-fossil.qdoc index a5281803b40..ef1cfe5d570 100644 --- a/doc/src/vcs/creator-vcs-fossil.qdoc +++ b/doc/src/creator-vcs-fossil.qdoc @@ -30,12 +30,9 @@ // ********************************************************************** /*! - \contentspage {Qt Creator Manual} - \previouspage creator-vcs-cvs.html \page creator-vcs-fossil.html - \nextpage creator-vcs-git.html - \title Using Fossil + \title Qt Creator Fossil Plugin Manual Fossil is an open source distributed version control system, designed and developed by the creator of SQLite. A stand-alone Fossil executable @@ -43,17 +40,21 @@ wiki, and built-in web server. Fossil is available for Linux, Windows, and \macos. + To use Fossil from \QC, you must install and configure it, as described in + the following sections. + \section1 Configuring Fossil \list 1 - \li Download the \l{http://fossil-scm.org}{Fossil SCM client} and install - the \c fossil executable file in your \c PATH. + \li Download the \l{http://fossil-scm.org}{Fossil SCM client} and + install the \c fossil executable file in your \c PATH. - \li Create or designate a directory to store local Fossil repositories and - remote clones. For example: \c ~/fossils/qt. + \li Create or designate a directory to store local Fossil repositories + and remote clones. For example: \c ~/fossils/qt. - \li Configure \uicontrol {Version Control Options} for the Fossil plugin to use - the designated directory as \uicontrol {Local Repositories Default path}. + \li Configure \uicontrol {Version Control Options} for the Fossil plugin + to use the designated directory as + \uicontrol {Local Repositories Default path}. \endlist Now Fossil should become available as a VCS choice to create new local @@ -63,8 +64,9 @@ \section1 Additional Fossil Functions In addition to the standard version control system functions described in - \l{Using Common Functions}, the \uicontrol Fossil submenu contains + \l {Using Version Control Systems}, the \uicontrol Fossil submenu contains the following items: + \table \header \li Menu Item diff --git a/fossil.pro b/fossil.pro index bf71d0294c5..1a32b3373bd 100644 --- a/fossil.pro +++ b/fossil.pro @@ -1,2 +1,5 @@ TEMPLATE = subdirs SUBDIRS += plugins/fossil + +include($$IDE_SOURCE_TREE/qtcreator.pri) +include(doc/doc.pri) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 2fab29b722f..f8da7a89555 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -152,6 +153,9 @@ bool FossilPlugin::initialize(const QStringList &arguments, QString *errorMessag createSubmitEditorActions(); + Core::HelpManager::registerDocumentation({Core::ICore::documentationPath() + + "/fossil.qch"}); + return true; } From 9086d2d11de6b0543bcae41af1be6e06a5a5f65e Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 23 Mar 2017 11:55:51 +0100 Subject: [PATCH 005/133] Adapt to changes in docs.pri Change-Id: Icf270208081b65efc058252663438078f0d2b62d Reviewed-by: Leena Miettinen --- doc/doc.pri | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/doc.pri b/doc/doc.pri index 84edad84eab..155d6af9a81 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -1,6 +1,6 @@ build_online_docs: \ - QTC_DOCS = $$PWD/fossil-online.qdocconf + DOC_FILES = $$PWD/fossil-online.qdocconf else: \ - QTC_DOCS = $$PWD/fossil.qdocconf + DOC_FILES = $$PWD/fossil.qdocconf include($$IDE_SOURCE_TREE/docs.pri) From ac8005190d5fa26d3488392aa560a3afd196e99c Mon Sep 17 00:00:00 2001 From: Artur Shepilko Date: Thu, 20 Apr 2017 00:59:51 -0500 Subject: [PATCH 006/133] Vcs: Re-implement Fossil's topic indicator using a TopicCache sub-class The functionality for tracking project's current topic/branch has long been folded into a base class Core::IVersionControl::TopicCache. Fossil plugin should just sub-class it and pass the instance to the base. Change-Id: I1b6c1631f5fc10987d8a608d573defeecbc31b37 Reviewed-by: Tobias Hunger --- plugins/fossil/fossilclient.cpp | 21 +------------------- plugins/fossil/fossilcontrol.cpp | 34 ++++++++++++++++++++++++++------ plugins/fossil/fossilcontrol.h | 1 - 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 6e881660545..bb8bceece9f 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -568,36 +568,17 @@ QString FossilClient::synchronousGetRepositoryURL(const QString &workingDirector return output; } -struct TopicData -{ - QDateTime timeStamp; - QString topic; -}; - QString FossilClient::synchronousTopic(const QString &workingDirectory) { - static QMap topicCache; - if (workingDirectory.isEmpty()) return QString(); // return current branch name - - const QString topLevel = findTopLevelForFile(workingDirectory); - const QFileInfo currentStateFile(topLevel + "/" + Constants::FOSSILREPO); - - TopicData &data = topicCache[workingDirectory]; - const QDateTime lastModified = currentStateFile.lastModified(); - if (lastModified == data.timeStamp) - return data.topic; - const BranchInfo branchInfo = synchronousCurrentBranch(workingDirectory); if (branchInfo.name().isEmpty()) return QString(); - data.timeStamp = lastModified; - data.topic = branchInfo.name(); - return data.topic; + return branchInfo.name(); } bool FossilClient::synchronousCreateRepository(const QString &workingDirectory, const QStringList &extraOptions) diff --git a/plugins/fossil/fossilcontrol.cpp b/plugins/fossil/fossilcontrol.cpp index 45ef0c2fb6b..dc515c94e84 100644 --- a/plugins/fossil/fossilcontrol.cpp +++ b/plugins/fossil/fossilcontrol.cpp @@ -41,9 +41,33 @@ #include #include -using namespace Fossil::Internal; +namespace Fossil { +namespace Internal { + +class FossilTopicCache : public Core::IVersionControl::TopicCache +{ +public: + FossilTopicCache(FossilClient *client) : + m_client(client) + { } + +protected: + QString trackFile(const QString &repository) final + { + return repository + "/" + Constants::FOSSILREPO; + } + + QString refreshTopic(const QString &repository) final + { + return m_client->synchronousTopic(repository); + } + +private: + FossilClient *m_client; +}; FossilControl::FossilControl(FossilClient *client) : + Core::IVersionControl(new FossilTopicCache(client)), m_client(client) { } @@ -156,11 +180,6 @@ bool FossilControl::vcsAnnotate(const QString &file, int line) return true; } -QString FossilControl::vcsTopic(const QString &directory) -{ - return m_client->synchronousTopic(directory); -} - Core::ShellCommand *FossilControl::createInitialCheckoutCommand(const QString &sourceUrl, const Utils::FileName &baseDirectory, const QString &localName, @@ -287,3 +306,6 @@ void FossilControl::changed(const QVariant &v) break; } } + +} // namespace Internal +} // namespace Fossil diff --git a/plugins/fossil/fossilcontrol.h b/plugins/fossil/fossilcontrol.h index 8a3e53f9088..59a3bf4af1d 100644 --- a/plugins/fossil/fossilcontrol.h +++ b/plugins/fossil/fossilcontrol.h @@ -59,7 +59,6 @@ public: bool vcsMove(const QString &from, const QString &to) final; bool vcsCreateRepository(const QString &directory) final; bool vcsAnnotate(const QString &file, int line) final; - QString vcsTopic(const QString &directory) final; Core::ShellCommand *createInitialCheckoutCommand(const QString &sourceUrl, const Utils::FileName &baseDirectory, const QString &localName, From 8cc9b5c57d453ea0de7fe9838b22824c7f9eec21 Mon Sep 17 00:00:00 2001 From: Artur Shepilko Date: Thu, 20 Apr 2017 02:21:51 -0500 Subject: [PATCH 007/133] Vcs: Jump to the current source line in Fossil Annotate editor * Keep track of the current source line number and pass it to Annotate action. * Add a 'List Versions' toggle in Annotate editor to prepend a list of commits that make up the annotated source. * By default do not show the version list so that annotated line number could be matched to the source line. NOTE: VcsBaseEditorWidget::configurationWidget() query is no longer available, yet Fossil client needs it in order to process the effective arguments. So we re-implement it in FossilEditorWidget sub-class. Change-Id: Idc4c21d074ccf4e1c6d041cce2abceb78665c8f2 Reviewed-by: Tobias Hunger --- plugins/fossil/fossilclient.cpp | 96 ++++++++++++++++++++++--------- plugins/fossil/fossileditor.cpp | 57 ++++++++++++++---- plugins/fossil/fossileditor.h | 12 ++-- plugins/fossil/fossilplugin.cpp | 3 +- plugins/fossil/fossilsettings.cpp | 2 + plugins/fossil/fossilsettings.h | 1 + 6 files changed, 127 insertions(+), 44 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index bb8bceece9f..584fc81fe15 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -24,6 +24,7 @@ ****************************************************************************/ #include "fossilclient.h" +#include "fossileditor.h" #include "constants.h" #include @@ -93,6 +94,13 @@ public: mapSetting(addToggleButton("|BLAME|", tr("Show Committers")), settings.boolPointer(FossilSettings::annotateShowCommittersKey)); } + + // Force listVersions setting to false by default. + // This way the annotated line number would not get offset by the version list. + settings.setValue(FossilSettings::annotateListVersionsKey, false); + + mapSetting(addToggleButton(QLatin1String("--log"), tr("List Versions")), + settings.boolPointer(FossilSettings::annotateListVersionsKey)); } }; @@ -725,19 +733,34 @@ VcsBase::VcsBaseEditorWidget *FossilClient::annotate( VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, VcsBase::VcsBaseEditor::getCodec(source), vcsCmdString.toLatin1().constData(), id); - QStringList effectiveArgs = extraOptions; - if (!editor->configurationAdded()) { - if (VcsBase::VcsBaseEditorConfig *editorConfig = createAnnotateEditor(editor)) { + + // We need to be able to re-query the configuration widget for the arguments + // each time the Annotate is requested from the main menu. This allows processing of + // the effective args controlled via configuration widget. + // However VcsBaseEditorWidget no longer stores the configuration widget and thus + // does not support configurationWidget() query. + // So we re-implement the configurationWidget() in FossilEditorWidget sub-class. + + auto *fossilEditor = qobject_cast(editor); + QTC_ASSERT(fossilEditor, return editor); + + if (!fossilEditor->configurationAdded()) { + if (VcsBase::VcsBaseEditorConfig *editorConfig = createAnnotateEditor(fossilEditor)) { + editorConfig->setBaseArguments(extraOptions); // editor has been just created, createVcsEditor() didn't set a configuration widget yet connect(editorConfig, &VcsBase::VcsBaseEditorConfig::commandExecutionRequested, - [=] { return this->annotate(workingDir, file, revision, lineNumber, extraOptions + editorConfig->arguments()); } ); - effectiveArgs += editorConfig->arguments(); - editor->setConfigurationAdded(); + [=]() { + const int line = VcsBase::VcsBaseEditor::lineNumberOfCurrentEditor(); + return this->annotate(workingDir, file, revision, line, editorConfig->arguments()); + } ); + fossilEditor->setConfigurationWidget(editorConfig); } } + QStringList effectiveArgs = extraOptions; + if (VcsBase::VcsBaseEditorConfig *editorConfig = fossilEditor->configurationWidget()) + effectiveArgs = editorConfig->arguments(); - VcsBase::VcsCommand *cmd = createCommand(workingDir, editor); - cmd->setCookie(lineNumber); + VcsBase::VcsCommand *cmd = createCommand(workingDir, fossilEditor); // here we introduce a "|BLAME|" meta-option to allow both annotate and blame modes int pos = effectiveArgs.indexOf("|BLAME|"); @@ -746,10 +769,15 @@ VcsBase::VcsBaseEditorWidget *FossilClient::annotate( effectiveArgs.removeAt(pos); } QStringList args(vcsCmdString); - args << revisionSpec(revision) << effectiveArgs << "--log" << file; + args << revisionSpec(revision) << effectiveArgs << file; + + // When version list requested, ignore the source line. + if (args.contains("--log")) + lineNumber = -1; + cmd->setCookie(lineNumber); enqueueJob(cmd, args); - return editor; + return fossilEditor; } bool FossilClient::isVcsFileOrDirectory(const Utils::FileName &fileName) const @@ -926,28 +954,34 @@ void FossilClient::log(const QString &workingDir, const QStringList &files, VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, VcsBase::VcsBaseEditor::getCodec(source), vcsCmdString.toLatin1().constData(), id); - editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu); - QStringList effectiveArgs = extraOptions; - if (!editor->configurationAdded()) { - if (VcsBase::VcsBaseEditorConfig *editorConfig = createLogEditor(editor)) { + auto *fossilEditor = qobject_cast(editor); + QTC_ASSERT(fossilEditor, return); + + fossilEditor->setFileLogAnnotateEnabled(enableAnnotationContextMenu); + + if (!fossilEditor->configurationAdded()) { + if (VcsBase::VcsBaseEditorConfig *editorConfig = createLogEditor(fossilEditor)) { + editorConfig->setBaseArguments(extraOptions); // editor has been just created, createVcsEditor() didn't set a configuration widget yet connect(editorConfig, &VcsBase::VcsBaseEditorConfig::commandExecutionRequested, - [=]() { this->log(workingDir, files, extraOptions + editorConfig->arguments(), enableAnnotationContextMenu); } ); - effectiveArgs += editorConfig->arguments(); - editor->setConfigurationAdded(); + [=]() { this->log(workingDir, files, editorConfig->arguments(), enableAnnotationContextMenu); } ); + fossilEditor->setConfigurationWidget(editorConfig); } } + QStringList effectiveArgs = extraOptions; + if (VcsBase::VcsBaseEditorConfig *editorConfig = fossilEditor->configurationWidget()) + effectiveArgs = editorConfig->arguments(); //@TODO: move highlighter and widgets to fossil editor sources. - new FossilLogHighlighter(editor->document()); + new FossilLogHighlighter(fossilEditor->document()); QStringList args(vcsCmdString); args << effectiveArgs; if (!files.isEmpty()) args << "--path" << files; - enqueueJob(createCommand(workingDir, editor), args); + enqueueJob(createCommand(workingDir, fossilEditor), args); } void FossilClient::logCurrentFile(const QString &workingDir, const QStringList &files, @@ -972,26 +1006,32 @@ void FossilClient::logCurrentFile(const QString &workingDir, const QStringList & VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, VcsBase::VcsBaseEditor::getCodec(source), vcsCmdString.toLatin1().constData(), id); - editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu); - QStringList effectiveArgs = extraOptions; - if (!editor->configurationAdded()) { - if (VcsBase::VcsBaseEditorConfig *editorConfig = createLogEditor(editor)) { + auto *fossilEditor = qobject_cast(editor); + QTC_ASSERT(fossilEditor, return); + + fossilEditor->setFileLogAnnotateEnabled(enableAnnotationContextMenu); + + if (!fossilEditor->configurationAdded()) { + if (VcsBase::VcsBaseEditorConfig *editorConfig = createLogEditor(fossilEditor)) { + editorConfig->setBaseArguments(extraOptions); // editor has been just created, createVcsEditor() didn't set a configuration widget yet connect(editorConfig, &VcsBase::VcsBaseEditorConfig::commandExecutionRequested, - [=]() { this->logCurrentFile(workingDir, files, extraOptions + editorConfig->arguments(), enableAnnotationContextMenu); } ); - effectiveArgs += editorConfig->arguments(); - editor->setConfigurationAdded(); + [=]() { this->logCurrentFile(workingDir, files, editorConfig->arguments(), enableAnnotationContextMenu); } ); + fossilEditor->setConfigurationWidget(editorConfig); } } + QStringList effectiveArgs = extraOptions; + if (VcsBase::VcsBaseEditorConfig *editorConfig = fossilEditor->configurationWidget()) + effectiveArgs = editorConfig->arguments(); //@TODO: move highlighter and widgets to fossil editor sources. - new FossilLogHighlighter(editor->document()); + new FossilLogHighlighter(fossilEditor->document()); QStringList args(vcsCmdString); args << effectiveArgs << files; - enqueueJob(createCommand(workingDir, editor), args); + enqueueJob(createCommand(workingDir, fossilEditor), args); } void FossilClient::revertFile(const QString &workingDir, diff --git a/plugins/fossil/fossileditor.cpp b/plugins/fossil/fossileditor.cpp index c379fd95879..2c36f3bc483 100644 --- a/plugins/fossil/fossileditor.cpp +++ b/plugins/fossil/fossileditor.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -44,15 +45,31 @@ namespace Fossil { namespace Internal { -FossilEditorWidget::FossilEditorWidget() : - m_exactChangesetId(Constants::CHANGESET_ID_EXACT), - m_firstChangesetId(QString("\n") + Constants::CHANGESET_ID + " "), - m_nextChangesetId(m_firstChangesetId) +class FossilEditorWidgetPrivate { - QTC_ASSERT(m_exactChangesetId.isValid(), return); - QTC_ASSERT(m_firstChangesetId.isValid(), return); - QTC_ASSERT(m_nextChangesetId.isValid(), return); +public: + FossilEditorWidgetPrivate() : + m_exactChangesetId(Constants::CHANGESET_ID_EXACT), + m_firstChangesetId(QString("\n") + Constants::CHANGESET_ID + " "), + m_nextChangesetId(m_firstChangesetId), + m_configurationWidget(nullptr) + { + QTC_ASSERT(m_exactChangesetId.isValid(), return); + QTC_ASSERT(m_firstChangesetId.isValid(), return); + QTC_ASSERT(m_nextChangesetId.isValid(), return); + } + + const QRegularExpression m_exactChangesetId; + const QRegularExpression m_firstChangesetId; + const QRegularExpression m_nextChangesetId; + + VcsBase::VcsBaseEditorConfig *m_configurationWidget; +}; + +FossilEditorWidget::FossilEditorWidget() : + d(new FossilEditorWidgetPrivate) +{ setAnnotateRevisionTextFormat(tr("&Annotate %1")); setAnnotatePreviousRevisionTextFormat(tr("Annotate &Parent Revision %1")); @@ -65,6 +82,26 @@ FossilEditorWidget::FossilEditorWidget() : setLogEntryPattern(logChangePattern); } +FossilEditorWidget::~FossilEditorWidget() +{ + delete d; +} + +bool FossilEditorWidget::setConfigurationWidget(VcsBase::VcsBaseEditorConfig *w) +{ + if (configurationAdded()) + return false; + + d->m_configurationWidget = w; + setConfigurationAdded(); + return true; +} + +VcsBase::VcsBaseEditorConfig *FossilEditorWidget::configurationWidget() const +{ + return d->m_configurationWidget; +} + QSet FossilEditorWidget::annotationChanges() const { @@ -77,12 +114,12 @@ QSet FossilEditorWidget::annotationChanges() const QSet changes; - QRegularExpressionMatch firstChangesetIdMatch = m_firstChangesetId.match(txt); + QRegularExpressionMatch firstChangesetIdMatch = d->m_firstChangesetId.match(txt); if (firstChangesetIdMatch.hasMatch()) { QString changeId = firstChangesetIdMatch.captured(1); changes.insert(changeId); - QRegularExpressionMatchIterator i = m_nextChangesetId.globalMatch(txt); + QRegularExpressionMatchIterator i = d->m_nextChangesetId.globalMatch(txt); while (i.hasNext()) { const QRegularExpressionMatch nextChangesetIdMatch = i.next(); changeId = nextChangesetIdMatch.captured(1); @@ -98,7 +135,7 @@ QString FossilEditorWidget::changeUnderCursor(const QTextCursor &cursorIn) const cursor.select(QTextCursor::WordUnderCursor); if (cursor.hasSelection()) { const QString change = cursor.selectedText(); - QRegularExpressionMatch exactChangesetIdMatch = m_exactChangesetId.match(change); + QRegularExpressionMatch exactChangesetIdMatch = d->m_exactChangesetId.match(change); if (exactChangesetIdMatch.hasMatch()) return change; } diff --git a/plugins/fossil/fossileditor.h b/plugins/fossil/fossileditor.h index e052b93a9d2..e9adc3515ea 100644 --- a/plugins/fossil/fossileditor.h +++ b/plugins/fossil/fossileditor.h @@ -27,26 +27,28 @@ #include -#include - namespace Fossil { namespace Internal { +class FossilEditorWidgetPrivate; + class FossilEditorWidget : public VcsBase::VcsBaseEditorWidget { Q_OBJECT public: FossilEditorWidget(); + ~FossilEditorWidget() final; + + bool setConfigurationWidget(VcsBase::VcsBaseEditorConfig *w); + VcsBase::VcsBaseEditorConfig *configurationWidget() const; private: QSet annotationChanges() const final; QString changeUnderCursor(const QTextCursor &cursor) const final; VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet &changes) const final; - const QRegularExpression m_exactChangesetId; - const QRegularExpression m_firstChangesetId; - const QRegularExpression m_nextChangesetId; + FossilEditorWidgetPrivate *d; }; } // namespace Internal diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index f8da7a89555..55034fad18a 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -265,7 +265,8 @@ void FossilPlugin::annotateCurrentFile() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasFile(), return); - m_client->annotate(state.currentFileTopLevel(), state.relativeCurrentFile()); + const int lineNumber = VcsBase::VcsBaseEditor::lineNumberOfCurrentEditor(state.currentFile()); + m_client->annotate(state.currentFileTopLevel(), state.relativeCurrentFile(), QString(), lineNumber); } void FossilPlugin::diffCurrentFile() diff --git a/plugins/fossil/fossilsettings.cpp b/plugins/fossil/fossilsettings.cpp index e6f47696731..f946d7f803f 100644 --- a/plugins/fossil/fossilsettings.cpp +++ b/plugins/fossil/fossilsettings.cpp @@ -36,6 +36,7 @@ const QString FossilSettings::sslIdentityFileKey("sslIdentityFile"); const QString FossilSettings::diffIgnoreAllWhiteSpaceKey("diffIgnoreAllWhiteSpace"); const QString FossilSettings::diffStripTrailingCRKey("diffStripTrailingCR"); const QString FossilSettings::annotateShowCommittersKey("annotateShowCommitters"); +const QString FossilSettings::annotateListVersionsKey("annotateListVersions"); const QString FossilSettings::timelineWidthKey("timelineWidth"); const QString FossilSettings::timelineLineageFilterKey("timelineLineageFilter"); const QString FossilSettings::timelineVerboseKey("timelineVerbose"); @@ -52,6 +53,7 @@ FossilSettings::FossilSettings() declareKey(diffIgnoreAllWhiteSpaceKey, false); declareKey(diffStripTrailingCRKey, false); declareKey(annotateShowCommittersKey, false); + declareKey(annotateListVersionsKey, false); declareKey(timelineWidthKey, 0); declareKey(timelineLineageFilterKey, ""); declareKey(timelineVerboseKey, false); diff --git a/plugins/fossil/fossilsettings.h b/plugins/fossil/fossilsettings.h index 5a82e8d2d0c..3e58e77b11a 100644 --- a/plugins/fossil/fossilsettings.h +++ b/plugins/fossil/fossilsettings.h @@ -38,6 +38,7 @@ public: static const QString diffIgnoreAllWhiteSpaceKey; static const QString diffStripTrailingCRKey; static const QString annotateShowCommittersKey; + static const QString annotateListVersionsKey; static const QString timelineWidthKey; static const QString timelineLineageFilterKey; static const QString timelineVerboseKey; From cb9135ade9c2c3c095213e261dca2566c2a80beb Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 5 Oct 2017 15:47:03 +0200 Subject: [PATCH 008/133] Add missing override Change-Id: I0202df0c8823203c8f1571b1866b911e784b9305 Reviewed-by: Tobias Hunger --- plugins/fossil/fossilplugin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/fossil/fossilplugin.h b/plugins/fossil/fossilplugin.h index da48d24e3e0..e3bd1e06313 100644 --- a/plugins/fossil/fossilplugin.h +++ b/plugins/fossil/fossilplugin.h @@ -59,7 +59,7 @@ class FossilPlugin : public VcsBase::VcsBasePlugin public: FossilPlugin(); ~FossilPlugin(); - bool initialize(const QStringList &arguments, QString *errorMessage); + bool initialize(const QStringList &arguments, QString *errorMessage) override; static FossilPlugin *instance(); FossilClient *client() const; From bf3f576c4a3c75a60cb2c6b575b41d58374db260 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 6 Oct 2017 11:07:53 +0200 Subject: [PATCH 009/133] Adapt to changes in VcsBase The VCS editors now directly keep a pointer to their editor config. Changed in qt-creator/a36536813f9aa00944fd8fcab2e2689a385d5387 Change-Id: Icd1c8b0628677b3b6da305ca294b2d67810c7992 Reviewed-by: Tobias Hunger Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 18 +++++++++--------- plugins/fossil/fossileditor.cpp | 20 +------------------- plugins/fossil/fossileditor.h | 3 --- 3 files changed, 10 insertions(+), 31 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 584fc81fe15..8d2c5d89a67 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -744,7 +744,7 @@ VcsBase::VcsBaseEditorWidget *FossilClient::annotate( auto *fossilEditor = qobject_cast(editor); QTC_ASSERT(fossilEditor, return editor); - if (!fossilEditor->configurationAdded()) { + if (!fossilEditor->editorConfig()) { if (VcsBase::VcsBaseEditorConfig *editorConfig = createAnnotateEditor(fossilEditor)) { editorConfig->setBaseArguments(extraOptions); // editor has been just created, createVcsEditor() didn't set a configuration widget yet @@ -753,11 +753,11 @@ VcsBase::VcsBaseEditorWidget *FossilClient::annotate( const int line = VcsBase::VcsBaseEditor::lineNumberOfCurrentEditor(); return this->annotate(workingDir, file, revision, line, editorConfig->arguments()); } ); - fossilEditor->setConfigurationWidget(editorConfig); + fossilEditor->setEditorConfig(editorConfig); } } QStringList effectiveArgs = extraOptions; - if (VcsBase::VcsBaseEditorConfig *editorConfig = fossilEditor->configurationWidget()) + if (VcsBase::VcsBaseEditorConfig *editorConfig = fossilEditor->editorConfig()) effectiveArgs = editorConfig->arguments(); VcsBase::VcsCommand *cmd = createCommand(workingDir, fossilEditor); @@ -960,17 +960,17 @@ void FossilClient::log(const QString &workingDir, const QStringList &files, fossilEditor->setFileLogAnnotateEnabled(enableAnnotationContextMenu); - if (!fossilEditor->configurationAdded()) { + if (!fossilEditor->editorConfig()) { if (VcsBase::VcsBaseEditorConfig *editorConfig = createLogEditor(fossilEditor)) { editorConfig->setBaseArguments(extraOptions); // editor has been just created, createVcsEditor() didn't set a configuration widget yet connect(editorConfig, &VcsBase::VcsBaseEditorConfig::commandExecutionRequested, [=]() { this->log(workingDir, files, editorConfig->arguments(), enableAnnotationContextMenu); } ); - fossilEditor->setConfigurationWidget(editorConfig); + fossilEditor->setEditorConfig(editorConfig); } } QStringList effectiveArgs = extraOptions; - if (VcsBase::VcsBaseEditorConfig *editorConfig = fossilEditor->configurationWidget()) + if (VcsBase::VcsBaseEditorConfig *editorConfig = fossilEditor->editorConfig()) effectiveArgs = editorConfig->arguments(); //@TODO: move highlighter and widgets to fossil editor sources. @@ -1012,17 +1012,17 @@ void FossilClient::logCurrentFile(const QString &workingDir, const QStringList & fossilEditor->setFileLogAnnotateEnabled(enableAnnotationContextMenu); - if (!fossilEditor->configurationAdded()) { + if (!fossilEditor->editorConfig()) { if (VcsBase::VcsBaseEditorConfig *editorConfig = createLogEditor(fossilEditor)) { editorConfig->setBaseArguments(extraOptions); // editor has been just created, createVcsEditor() didn't set a configuration widget yet connect(editorConfig, &VcsBase::VcsBaseEditorConfig::commandExecutionRequested, [=]() { this->logCurrentFile(workingDir, files, editorConfig->arguments(), enableAnnotationContextMenu); } ); - fossilEditor->setConfigurationWidget(editorConfig); + fossilEditor->setEditorConfig(editorConfig); } } QStringList effectiveArgs = extraOptions; - if (VcsBase::VcsBaseEditorConfig *editorConfig = fossilEditor->configurationWidget()) + if (VcsBase::VcsBaseEditorConfig *editorConfig = fossilEditor->editorConfig()) effectiveArgs = editorConfig->arguments(); //@TODO: move highlighter and widgets to fossil editor sources. diff --git a/plugins/fossil/fossileditor.cpp b/plugins/fossil/fossileditor.cpp index 2c36f3bc483..e24912b40ea 100644 --- a/plugins/fossil/fossileditor.cpp +++ b/plugins/fossil/fossileditor.cpp @@ -51,8 +51,7 @@ public: FossilEditorWidgetPrivate() : m_exactChangesetId(Constants::CHANGESET_ID_EXACT), m_firstChangesetId(QString("\n") + Constants::CHANGESET_ID + " "), - m_nextChangesetId(m_firstChangesetId), - m_configurationWidget(nullptr) + m_nextChangesetId(m_firstChangesetId) { QTC_ASSERT(m_exactChangesetId.isValid(), return); QTC_ASSERT(m_firstChangesetId.isValid(), return); @@ -63,8 +62,6 @@ public: const QRegularExpression m_exactChangesetId; const QRegularExpression m_firstChangesetId; const QRegularExpression m_nextChangesetId; - - VcsBase::VcsBaseEditorConfig *m_configurationWidget; }; FossilEditorWidget::FossilEditorWidget() : @@ -87,21 +84,6 @@ FossilEditorWidget::~FossilEditorWidget() delete d; } -bool FossilEditorWidget::setConfigurationWidget(VcsBase::VcsBaseEditorConfig *w) -{ - if (configurationAdded()) - return false; - - d->m_configurationWidget = w; - setConfigurationAdded(); - return true; -} - -VcsBase::VcsBaseEditorConfig *FossilEditorWidget::configurationWidget() const -{ - return d->m_configurationWidget; -} - QSet FossilEditorWidget::annotationChanges() const { diff --git a/plugins/fossil/fossileditor.h b/plugins/fossil/fossileditor.h index e9adc3515ea..067b103a2d1 100644 --- a/plugins/fossil/fossileditor.h +++ b/plugins/fossil/fossileditor.h @@ -40,9 +40,6 @@ public: FossilEditorWidget(); ~FossilEditorWidget() final; - bool setConfigurationWidget(VcsBase::VcsBaseEditorConfig *w); - VcsBase::VcsBaseEditorConfig *configurationWidget() const; - private: QSet annotationChanges() const final; QString changeUnderCursor(const QTextCursor &cursor) const final; From f6cea871f1e6edeb3cb005adb82db19b3f25095e Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 5 Oct 2017 15:52:58 +0200 Subject: [PATCH 010/133] Adapt to change in VCS registration Was changed in qt-creator/19c9194b117bf4d5a4d5ef19e6f9d84d92c67620 Change-Id: I1b6449d3435a418f7fdd1cc3b94c2e752c062672 Reviewed-by: Tobias Hunger --- plugins/fossil/fossilplugin.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 55034fad18a..e79526786cb 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -125,8 +125,7 @@ bool FossilPlugin::initialize(const QStringList &arguments, QString *errorMessag Core::Context context(Constants::FOSSIL_CONTEXT); m_client = new FossilClient; - auto vcsCtrl = new FossilControl(m_client); - initializeVcs(vcsCtrl, context); + auto vcsCtrl = initializeVcs(context, m_client); connect(m_client, &VcsBase::VcsBaseClient::changed, vcsCtrl, &FossilControl::changed); addAutoReleasedObject(new OptionsPage(vcsCtrl)); From ee7505444c0b63e560ca6d076599442a4825f3af Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 16 Oct 2017 12:56:35 +0200 Subject: [PATCH 011/133] Fix isVcsFileOrDirectory The method should return if the given path is a file or directory that contains the version control system specific data (like .git, .svn), so it only should return true for the fossil db file. Change-Id: I0211b117f43fbeda2c44e782927dbed6b5a19a21 Reviewed-by: Orgad Shaneh Reviewed-by: Tobias Hunger --- plugins/fossil/fossilclient.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 8d2c5d89a67..f15759cba86 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -782,9 +782,10 @@ VcsBase::VcsBaseEditorWidget *FossilClient::annotate( bool FossilClient::isVcsFileOrDirectory(const Utils::FileName &fileName) const { - // true for any dir or file other than fossil checkout db-file - return !(fileName.toFileInfo().isFile() - && fileName.fileName().compare(Constants::FOSSILREPO, Utils::HostOsInfo::fileNameCaseSensitivity())); + // false for any dir or file other than fossil checkout db-file + return fileName.toFileInfo().isFile() + && !fileName.fileName().compare(Constants::FOSSILREPO, + Utils::HostOsInfo::fileNameCaseSensitivity()); } QString FossilClient::findTopLevelForFile(const QFileInfo &file) const From e32b8e4ca28801a77eedb843ec6d64fff4d6a31c Mon Sep 17 00:00:00 2001 From: Artur Shepilko Date: Thu, 12 Jul 2018 15:26:02 -0500 Subject: [PATCH 012/133] Adapt to QtCreator 4.7 Change-Id: I9eb8d740e1ef33622a8ba15e4e832755f0141a94 Reviewed-by: Eike Ziller Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilplugin.cpp | 26 ++++++++++++++------------ plugins/fossil/optionspage.cpp | 4 ++-- plugins/fossil/optionspage.h | 2 +- plugins/fossil/optionspage.ui | 7 +++++-- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index e79526786cb..bf2e7fc68f4 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -128,7 +128,7 @@ bool FossilPlugin::initialize(const QStringList &arguments, QString *errorMessag auto vcsCtrl = initializeVcs(context, m_client); connect(m_client, &VcsBase::VcsBaseClient::changed, vcsCtrl, &FossilControl::changed); - addAutoReleasedObject(new OptionsPage(vcsCtrl)); + new OptionsPage(vcsCtrl, this); const auto describeFunc = [this](const QString &source, const QString &id) { m_client->view(source, id); @@ -137,13 +137,12 @@ bool FossilPlugin::initialize(const QStringList &arguments, QString *errorMessag const int editorCount = sizeof(editorParameters) / sizeof(VcsBase::VcsBaseEditorParameters); const auto widgetCreator = []() { return new FossilEditorWidget; }; for (int i = 0; i < editorCount; i++) - addAutoReleasedObject(new VcsBase::VcsEditorFactory(editorParameters + i, widgetCreator, describeFunc)); + new VcsBase::VcsEditorFactory(editorParameters + i, widgetCreator, describeFunc, this); - addAutoReleasedObject(new VcsBase::VcsSubmitEditorFactory(&submitEditorParameters, - []() { return new CommitEditor(&submitEditorParameters); })); + new VcsBase::VcsSubmitEditorFactory(&submitEditorParameters, + []() { return new CommitEditor(&submitEditorParameters); }, this); - m_commandLocator = new Core::CommandLocator("Fossil", "fossil", "fossil"); - addAutoReleasedObject(m_commandLocator); + m_commandLocator = new Core::CommandLocator("Fossil", "fossil", "fossil", this); ProjectExplorer::JsonWizardFactory::addWizardPath(Utils::FileName::fromString(Constants::WIZARD_PATH)); Core::JsExpander::registerQObjectForJs("Fossil", new FossilJsExtension); @@ -203,7 +202,7 @@ void FossilPlugin::createFileActions(const Core::Context &context) m_diffFile = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = Core::ActionManager::registerAction(m_diffFile, Constants::DIFF, context); command->setAttribute(Core::Command::CA_UpdateText); - command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+I,Meta+D") : tr("ALT+I,Alt+D"))); + command->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+I,Meta+D") : tr("ALT+I,Alt+D"))); connect(m_diffFile, &QAction::triggered, this, &FossilPlugin::diffCurrentFile); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); @@ -211,7 +210,7 @@ void FossilPlugin::createFileActions(const Core::Context &context) m_logFile = new Utils::ParameterAction(tr("Timeline Current File"), tr("Timeline \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = Core::ActionManager::registerAction(m_logFile, Constants::LOG, context); command->setAttribute(Core::Command::CA_UpdateText); - command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+I,Meta+L") : tr("ALT+I,Alt+L"))); + command->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+I,Meta+L") : tr("ALT+I,Alt+L"))); connect(m_logFile, &QAction::triggered, this, &FossilPlugin::logCurrentFile); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); @@ -219,7 +218,7 @@ void FossilPlugin::createFileActions(const Core::Context &context) m_statusFile = new Utils::ParameterAction(tr("Status Current File"), tr("Status \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = Core::ActionManager::registerAction(m_statusFile, Constants::STATUS, context); command->setAttribute(Core::Command::CA_UpdateText); - command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+I,Meta+S") : tr("ALT+I,Alt+S"))); + command->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+I,Meta+S") : tr("ALT+I,Alt+S"))); connect(m_statusFile, &QAction::triggered, this, &FossilPlugin::statusCurrentFile); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); @@ -329,7 +328,7 @@ void FossilPlugin::createDirectoryActions(const Core::Context &context) action = new QAction(tr("Timeline"), this); m_repositoryActionList.append(action); command = Core::ActionManager::registerAction(action, Constants::LOGMULTI, context); - command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+I,Meta+T") : tr("ALT+I,Alt+T"))); + command->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+I,Meta+T") : tr("ALT+I,Alt+T"))); connect(action, &QAction::triggered, this, &FossilPlugin::logRepository); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); @@ -413,7 +412,7 @@ void FossilPlugin::createRepositoryActions(const Core::Context &context) action = new QAction(tr("Update..."), this); m_repositoryActionList.append(action); command = Core::ActionManager::registerAction(action, Constants::UPDATE, context); - command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+I,Meta+U") : tr("ALT+I,Alt+U"))); + command->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+I,Meta+U") : tr("ALT+I,Alt+U"))); connect(action, &QAction::triggered, this, &FossilPlugin::update); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); @@ -421,7 +420,7 @@ void FossilPlugin::createRepositoryActions(const Core::Context &context) action = new QAction(tr("Commit..."), this); m_repositoryActionList.append(action); command = Core::ActionManager::registerAction(action, Constants::COMMIT, context); - command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+I,Meta+C") : tr("ALT+I,Alt+C"))); + command->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+I,Meta+C") : tr("ALT+I,Alt+C"))); connect(action, &QAction::triggered, this, &FossilPlugin::commit); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); @@ -551,6 +550,9 @@ void FossilPlugin::createSubmitEditorActions() void FossilPlugin::commit() { + if (!promptBeforeCommit()) + return; + if (raiseSubmitEditor()) return; diff --git a/plugins/fossil/optionspage.cpp b/plugins/fossil/optionspage.cpp index bc6d16ab535..294a36fc1dd 100644 --- a/plugins/fossil/optionspage.cpp +++ b/plugins/fossil/optionspage.cpp @@ -77,8 +77,8 @@ void OptionsPageWidget::setSettings(const VcsBase::VcsBaseClientSettings &s) m_ui.disableAutosyncCheckBox->setChecked(s.boolValue(FossilSettings::disableAutosyncKey)); } -OptionsPage::OptionsPage(Core::IVersionControl *control) : - VcsClientOptionsPage(control, FossilPlugin::instance()->client()) +OptionsPage::OptionsPage(Core::IVersionControl *control, QObject *parent) : + VcsClientOptionsPage(control, FossilPlugin::instance()->client(), parent) { setId(Constants::VCS_ID_FOSSIL); setDisplayName(tr("Fossil")); diff --git a/plugins/fossil/optionspage.h b/plugins/fossil/optionspage.h index 769841c3de2..cc6e224bdc9 100644 --- a/plugins/fossil/optionspage.h +++ b/plugins/fossil/optionspage.h @@ -56,7 +56,7 @@ class OptionsPage : public VcsBase::VcsClientOptionsPage Q_OBJECT public: - OptionsPage(Core::IVersionControl *control); + OptionsPage(Core::IVersionControl *control, QObject *parent); }; } // namespace Internal diff --git a/plugins/fossil/optionspage.ui b/plugins/fossil/optionspage.ui index d573fb85cc7..e14e845cb51 100644 --- a/plugins/fossil/optionspage.ui +++ b/plugins/fossil/optionspage.ui @@ -11,7 +11,7 @@
- Form + @@ -124,7 +124,7 @@ 1000 - 1000 + 300 @@ -160,6 +160,9 @@ s + + 360 + 30 From 06d73b2e24249290e68a095e7a69a1cab172b4f8 Mon Sep 17 00:00:00 2001 From: Artur Shepilko Date: Mon, 16 Jul 2018 14:02:29 -0500 Subject: [PATCH 013/133] Update copyright year Change-Id: I2b1db2013cad9d25d2a54439866aae63a62623f0 Reviewed-by: Orgad Shaneh --- doc/src/creator-vcs-fossil.qdoc | 2 +- plugins/fossil/Fossil.json.in | 2 +- plugins/fossil/annotationhighlighter.cpp | 2 +- plugins/fossil/annotationhighlighter.h | 2 +- plugins/fossil/branchinfo.cpp | 2 +- plugins/fossil/branchinfo.h | 2 +- plugins/fossil/commiteditor.cpp | 2 +- plugins/fossil/commiteditor.h | 2 +- plugins/fossil/configuredialog.cpp | 2 +- plugins/fossil/configuredialog.h | 2 +- plugins/fossil/constants.h | 2 +- plugins/fossil/fossilclient.cpp | 2 +- plugins/fossil/fossilclient.h | 2 +- plugins/fossil/fossilcommitwidget.cpp | 2 +- plugins/fossil/fossilcommitwidget.h | 2 +- plugins/fossil/fossilcontrol.cpp | 2 +- plugins/fossil/fossilcontrol.h | 2 +- plugins/fossil/fossileditor.cpp | 2 +- plugins/fossil/fossileditor.h | 2 +- plugins/fossil/fossilplugin.cpp | 2 +- plugins/fossil/fossilplugin.h | 2 +- plugins/fossil/fossilsettings.cpp | 2 +- plugins/fossil/fossilsettings.h | 2 +- plugins/fossil/optionspage.cpp | 2 +- plugins/fossil/optionspage.h | 2 +- plugins/fossil/pullorpushdialog.cpp | 2 +- plugins/fossil/pullorpushdialog.h | 2 +- plugins/fossil/revisioninfo.cpp | 2 +- plugins/fossil/revisioninfo.h | 2 +- plugins/fossil/wizard/fossiljsextension.cpp | 2 +- plugins/fossil/wizard/fossiljsextension.h | 2 +- 31 files changed, 31 insertions(+), 31 deletions(-) diff --git a/doc/src/creator-vcs-fossil.qdoc b/doc/src/creator-vcs-fossil.qdoc index ef1cfe5d570..87dddffc514 100644 --- a/doc/src/creator-vcs-fossil.qdoc +++ b/doc/src/creator-vcs-fossil.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/Fossil.json.in b/plugins/fossil/Fossil.json.in index 166fd522a8e..9b6fab8fff8 100644 --- a/plugins/fossil/Fossil.json.in +++ b/plugins/fossil/Fossil.json.in @@ -3,7 +3,7 @@ \"Version\" : \"$$QTCREATOR_VERSION\", \"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\", \"Vendor\" : \"Artur Shepilko\", - \"Copyright\" : \"(C) 2016 Artur Shepilko\", + \"Copyright\" : \"(C) 2018 Artur Shepilko\", \"License\" : [ \"Commercial Usage\", \"\", \"Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and The Qt Company.\", diff --git a/plugins/fossil/annotationhighlighter.cpp b/plugins/fossil/annotationhighlighter.cpp index 31f3f54ecab..a910bb7dd68 100644 --- a/plugins/fossil/annotationhighlighter.cpp +++ b/plugins/fossil/annotationhighlighter.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/annotationhighlighter.h b/plugins/fossil/annotationhighlighter.h index 474f3e11c63..bd7160a3542 100644 --- a/plugins/fossil/annotationhighlighter.h +++ b/plugins/fossil/annotationhighlighter.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/branchinfo.cpp b/plugins/fossil/branchinfo.cpp index 39a25c2591b..08cdd26e85f 100644 --- a/plugins/fossil/branchinfo.cpp +++ b/plugins/fossil/branchinfo.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/branchinfo.h b/plugins/fossil/branchinfo.h index 535c81b712d..ff1a1e590f4 100644 --- a/plugins/fossil/branchinfo.h +++ b/plugins/fossil/branchinfo.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/commiteditor.cpp b/plugins/fossil/commiteditor.cpp index 0e9a4594198..756fe13938e 100644 --- a/plugins/fossil/commiteditor.cpp +++ b/plugins/fossil/commiteditor.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/commiteditor.h b/plugins/fossil/commiteditor.h index 2fa6a55f057..5cc4b3ae382 100644 --- a/plugins/fossil/commiteditor.h +++ b/plugins/fossil/commiteditor.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/configuredialog.cpp b/plugins/fossil/configuredialog.cpp index 49ab100e82c..d072d2df2cd 100644 --- a/plugins/fossil/configuredialog.cpp +++ b/plugins/fossil/configuredialog.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/configuredialog.h b/plugins/fossil/configuredialog.h index fe725701a7b..702624983a7 100644 --- a/plugins/fossil/configuredialog.h +++ b/plugins/fossil/configuredialog.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/constants.h b/plugins/fossil/constants.h index b18a85ed571..e15a8e76db3 100644 --- a/plugins/fossil/constants.h +++ b/plugins/fossil/constants.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index f15759cba86..6d688a75a54 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/fossilclient.h b/plugins/fossil/fossilclient.h index 73420196cd4..e75931420e2 100644 --- a/plugins/fossil/fossilclient.h +++ b/plugins/fossil/fossilclient.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/fossilcommitwidget.cpp b/plugins/fossil/fossilcommitwidget.cpp index 8e831274dd5..b6fa9bd9de6 100644 --- a/plugins/fossil/fossilcommitwidget.cpp +++ b/plugins/fossil/fossilcommitwidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/fossilcommitwidget.h b/plugins/fossil/fossilcommitwidget.h index 55ef70f6308..19d4220dad6 100644 --- a/plugins/fossil/fossilcommitwidget.h +++ b/plugins/fossil/fossilcommitwidget.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/fossilcontrol.cpp b/plugins/fossil/fossilcontrol.cpp index dc515c94e84..98b2ea8a532 100644 --- a/plugins/fossil/fossilcontrol.cpp +++ b/plugins/fossil/fossilcontrol.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/fossilcontrol.h b/plugins/fossil/fossilcontrol.h index 59a3bf4af1d..1fb1f58fca1 100644 --- a/plugins/fossil/fossilcontrol.h +++ b/plugins/fossil/fossilcontrol.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/fossileditor.cpp b/plugins/fossil/fossileditor.cpp index e24912b40ea..6297f7dff1c 100644 --- a/plugins/fossil/fossileditor.cpp +++ b/plugins/fossil/fossileditor.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/fossileditor.h b/plugins/fossil/fossileditor.h index 067b103a2d1..ee9b6b4ded9 100644 --- a/plugins/fossil/fossileditor.h +++ b/plugins/fossil/fossileditor.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index bf2e7fc68f4..2d48bcca5f1 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/fossilplugin.h b/plugins/fossil/fossilplugin.h index e3bd1e06313..60e6c33845b 100644 --- a/plugins/fossil/fossilplugin.h +++ b/plugins/fossil/fossilplugin.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/fossilsettings.cpp b/plugins/fossil/fossilsettings.cpp index f946d7f803f..8866d065afe 100644 --- a/plugins/fossil/fossilsettings.cpp +++ b/plugins/fossil/fossilsettings.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/fossilsettings.h b/plugins/fossil/fossilsettings.h index 3e58e77b11a..8314eb3cf58 100644 --- a/plugins/fossil/fossilsettings.h +++ b/plugins/fossil/fossilsettings.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/optionspage.cpp b/plugins/fossil/optionspage.cpp index 294a36fc1dd..361c7d1a6f6 100644 --- a/plugins/fossil/optionspage.cpp +++ b/plugins/fossil/optionspage.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/optionspage.h b/plugins/fossil/optionspage.h index cc6e224bdc9..6babddbd8a0 100644 --- a/plugins/fossil/optionspage.h +++ b/plugins/fossil/optionspage.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/pullorpushdialog.cpp b/plugins/fossil/pullorpushdialog.cpp index 7129f51e171..4977c9013ba 100644 --- a/plugins/fossil/pullorpushdialog.cpp +++ b/plugins/fossil/pullorpushdialog.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/pullorpushdialog.h b/plugins/fossil/pullorpushdialog.h index cffb301424c..f992212c491 100644 --- a/plugins/fossil/pullorpushdialog.h +++ b/plugins/fossil/pullorpushdialog.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/revisioninfo.cpp b/plugins/fossil/revisioninfo.cpp index 3e639340ab2..a2392264a98 100644 --- a/plugins/fossil/revisioninfo.cpp +++ b/plugins/fossil/revisioninfo.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/revisioninfo.h b/plugins/fossil/revisioninfo.h index 294bfa23f72..247b4504ef1 100644 --- a/plugins/fossil/revisioninfo.h +++ b/plugins/fossil/revisioninfo.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/wizard/fossiljsextension.cpp b/plugins/fossil/wizard/fossiljsextension.cpp index 664e1c249ef..17c8dfa5ad8 100644 --- a/plugins/fossil/wizard/fossiljsextension.cpp +++ b/plugins/fossil/wizard/fossiljsextension.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. diff --git a/plugins/fossil/wizard/fossiljsextension.h b/plugins/fossil/wizard/fossiljsextension.h index d1f90d290a0..0f123c9529c 100644 --- a/plugins/fossil/wizard/fossiljsextension.h +++ b/plugins/fossil/wizard/fossiljsextension.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (c) 2016 Artur Shepilko +** Copyright (c) 2018 Artur Shepilko ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. From 15007920a39a3e8adf74711268e1f7811e57b8ab Mon Sep 17 00:00:00 2001 From: Artur Shepilko Date: Thu, 26 Jul 2018 20:35:17 -0500 Subject: [PATCH 014/133] Update to use supportedProjectType - Same change as in qt-creator aa37df645d97698afe Change-Id: I1dfda4b8e7a9ce40954f5029efc2e51a5366b974 Reviewed-by: Orgad Shaneh --- plugins/fossil/wizard/projects/vcs/wizard.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/fossil/wizard/projects/vcs/wizard.json b/plugins/fossil/wizard/projects/vcs/wizard.json index 30423ede177..fba22bb2e7e 100644 --- a/plugins/fossil/wizard/projects/vcs/wizard.json +++ b/plugins/fossil/wizard/projects/vcs/wizard.json @@ -1,6 +1,6 @@ { "version": 1, - "kind": "project", + "supportedProjectTypes": [ "UNKNOWN_PROJECT" ], "id": "I.Fossil", "category": "T.Import", "trDescription": "Clones a Fossil repository and tries to load the contained project.", From e74016a32f95521e59e8b0f178d495edddb4eddf Mon Sep 17 00:00:00 2001 From: Artur Shepilko Date: Mon, 16 Jul 2018 10:56:12 -0500 Subject: [PATCH 015/133] Update clone wizard icons Change-Id: I45d1595094c132e28d714df00c3b480a9e7e33bc Reviewed-by: Alessandro Portale Reviewed-by: Orgad Shaneh --- plugins/fossil/fossil.qrc | 1 + plugins/fossil/wizard/projects/vcs/icon.png | Bin 14500 -> 1663 bytes .../fossil/wizard/projects/vcs/icon@2x.png | Bin 0 -> 3441 bytes 3 files changed, 1 insertion(+) create mode 100644 plugins/fossil/wizard/projects/vcs/icon@2x.png diff --git a/plugins/fossil/fossil.qrc b/plugins/fossil/fossil.qrc index 4e195731423..f301bd15e19 100644 --- a/plugins/fossil/fossil.qrc +++ b/plugins/fossil/fossil.qrc @@ -1,6 +1,7 @@ wizard/projects/vcs/icon.png + wizard/projects/vcs/icon@2x.png wizard/projects/vcs/wizard.json diff --git a/plugins/fossil/wizard/projects/vcs/icon.png b/plugins/fossil/wizard/projects/vcs/icon.png index 496f8818a58a58c2979ac8b908848fd7e8193cbd..66cf5c5ca379b4bbb914f71709c423311e85c5de 100644 GIT binary patch literal 1663 zcmeAS@N?(olHy`uVBq!ia0y~yU@!n-4mJh`hH$2z?Fr&qQ&)nH@ zvu54aVG0d+QlX$?^RFcM_LKTHw`ZFhpK(o!THtzYN!+Qk>#NS4IkUzs#`n~jH8OHD zOZF`l7RoZ1Gcop8M|=Bq_V_K`-X5u^wKcA1WW4$&F*D*E>%~o*x}JKSdgZ&|lyCI$ z1SJo-ka&UFmX2vnZ_2;(-0+?9+mY*FU!MC{29D_=Ci~N$KiJTy`RviN!t2*e=ZMUn zP{|vs%kx@##u<)oADi~GI^5drPaTYHI8r-L%$U-xV9RnpPm94jERqn(B*)guZS#=_YdHg151O(d^Xh=ew>Q*MBo%>DI?wnUX(~ zl7&xK9y*lNxj={GkjgsT6T2>dc(bQ#xxv{|-&*_SzO#SI-Tb&# zHu!*qs_-=Pz3i`^DjyV%c{OX-T~pq@_KO~0THlbw7R$I|o7*=Qaq;caj=`#`sh=ju zK9d$G+p)7&$fkH3qixf>3JJEY`5tSsJlS*iWY&UyL&?hUJ#`Zk`7pPdaic&IGAel#N|%Tj*Hb$x|L9P6HOYHQCH)ZlD) zQ<=j$Q&&f67Dtirip2J-A@1qx&l|OfTD(08$}+S^YOEyZ|F9b z33qBcN8apd6uq6l|3HWG0WM$WtxZYh?5f%V!WU;Jhn;3sOAWZ}8tS`QHYMM&@NRa- zVIk3wYbAAxPhR|ZGH15cF1N{*l|TPX)Kyv*$+XJRv5#eIy2D!UFMQl97#K}IIlQ_s z*=&W`_O0d7?8WTj=G(2e-MTJyW!lE#g82O0*IT%5u+3k#WYIkyF42JHG8sE1ch)il z{M1!m9KfY@dgHY@clO*{>2C8cx=&dOG{*Bu*A^G_pDHZ zf*ZK6q)SZdW8bz_#&NG*z*-v>TZT2<*BqpK`JD3&ge+KsBQJkcwOsq*-2~~oZh4x_ zzi&KsHu~9cEB@xssplP-4?ACCUeIS-z@U?@)Z(T~KCVU|{fc^>bP0l+XkK5F+XL literal 14500 zcmeAS@N?(olHy`uVBq!ia0y~yU?^u`V5sC^VqjqC3DjK6z`($k|H*Y zfq{Xuz$3Dlfq`2Hgc&d0t^32kU_R5+#WAGf*4w@1TjpLZ)wenwb$|PJJJ-GCoSqz| zT@Ji0EJ6wwa}Vs8enj=7w_Dz)Nrsd5l)v9`erNuZWAB&!IJPlgCi(G=FG?*LiUqSv`NV^||@}`@haw))&{M$glri zFIcnZ-v6%~r`m7(bUf@|MQzU0{yF=f|L^(l?SAeL1Ot3rSp^zS1~7^oJjK*7YX=8I(3@pX zBt!!2lfwQ@&|zRuQ9P^rL@dkjymOyI-$F4FgJ(+iQJ?GFi7xKW^J2_wM+tx2LMj&2w+FV~)b6Y>4joNhP&*`~h(vY)^B+&1&t4`;UW3n;~aZg+0zo*7#KJYy=Y_>KR1JM#+|J-_rJ@<+HDFyJbm5F(vLqjK8=}o zbI04A*SD{!Nq#;%n*ZJX>P?$^}v zcW3_mq~AL6aw7M&`>$fnY^z18uIqPkFq)W&wDHOQsWw0R@6Dg?bYGc!m5&6fx4)UX z)jsmiAAb4Df9(GI|7`D`|F2$L|L^Lh{{OB%I{yFNLv^{j#H+J>tNX88DLO8W`CQc4 zlH`8kc1)11NZq4!iN_o0XnkyikS5wfp4B$y;-G_wCzJ_`7!fx}Wci&)5E*=U)Hm%_sA3 zbKi7iwurXsD`ETG}(7$*Y8#xGSFp z&fa@wrqQ?Wc9mz-#bXLj-f(PP6tZ&lo8)5+Z@M#A8fsoyRat#vyNunJ%S*lM{#SCElCAJ#DJaq_%E<;NMe%K};JD3O0%g$%l%Z3E5?C z7Hgb)N?a`V|5^V#Wv}08tMka*c@m*}UNKB7c3sE{ODoQTOFyUPzuoo!rug-DHWll> zy_EPoK{-jxm1m+&k<^uY@$q)iBL7ssw=~REI_;9CrnE>XSvSqpD1=oxti&U3QE5b6 zmd~;tsgmDcGV6;T^VV1XUc0~g>Ks<_o;fx5Ce-m}`j?%3;x$9$vfIKZ0nyJbfA48< zNoaUtu}U^OlhNVP7oD|#Ry!QDWXV3BqBb){sj1-ADa)jimHyIBBFs(>?JE?$XUsYo zboPRg-{)iRta36w&v}__UwnFM{il_$|G)X>T3`3ux4!D~q5sJboAU1zyj@$I7H5=p z!*cg?r)M`;GBV2MXVzB!JoT+8^i9swX{pl&@rKtiHY??=VHgZ+{$ewukY=D=&-c-=d-)t zZT5eP{%*ge^!>&Ty%|DGD;8cA{I=zZvepbqWkIPK0#Yj!m3FjE-rb*bbDuU7OTlZt zExGqgH+3{#P&AU7z}UP{>c!4$$$w%DKFLjgF77;IbM^5f>WXX(roD>iWettf70Vq` zHEe$VdiMU_{~OKzI zVmUW?hLpkYL;DuLwXgftI^XvHtz&nOpEP%v)Zwo!Y2lPsaw4s)>rBTV>m|J&2YEDB zbt*3C&g!u$J+#Bo_pW?R)=TdEJ(fHEudsEuvRd$fV}{_&sTL7?PbEM9@#VKEZ@HM9 ztctP+U7BbG0EnVs5<>Hc3AM*cS-QoH>K>#F;C8 z{Srbmcksohy_jp>;OyS__D=np=vg&&2b%<&+4g^W^~>qf^1W*xeYz9kyLH}XRt9F9 z?=p{{ulXYv_WS7T!m?cPQ) zhi<*qTh7Xvr~P}fu_r;uX5-9O1%?AhN`vR|eP>iSCXv)(nEuGlw))&W%i3dSID>TW z?=E@y>Fes{v1W$-Z>{-d?p=^%t}5Xa@;u?Fv})!f%gvisUCTVYoArd#N)4lHI5-KX_5VgPX@+;o_fQ5$6;hVKoSGrtZyz%-5xx0BY zjk7cU$B90_D8e9e<&4bkUGt6RnkjqDne$08SjlUzGxPb3M^fIt&Q<0$Nyk#deP-Ob zk)QCW=GLuG2QI0b=iQz-Q)u(&9+xDy_kO(prT;rE=UO)LAcw#~L5q$fFV6HZI9{1z zZ4|dJ^?&T?xZnRCYybP%87?2QFZ1m@VO>)mw-py18B`okxG>5t-mKA+AQ0-MP>}av!<7J@ zh6`urJU#S4qWCOB?zatfkv}V{ljq-6to$)G^!2@4!e6m-$b=kY$*N=L?ul=(!J+AWY(W}|v>#9F@ipT%_=l}lq!{+`yyE1=w z&bqoHWs>#fNyS_nms$SU62#5N?eg^#qg5Hl9M=xFW34CRWVwSCPAfhWQ+nbgsIbb- z*paQwrRPWok7aC=CihX{Fj~C`BIm6>uZa2@uqH# ziZcuQB6FcApqTTAiMp6q%iNtVCz&^_YI585LvDHAl@ljAKdV_K-I(yOnZ1DLZm?a! zhabWE>u%L9G3}W2^vrU19`~t#&5XFF?IpY-9%nOR#^G;?p1KIwd#ZT)G*imXPz@*qKH4#!3nDJB&LAtRQR1WPj()g#q;WNdBFU-QV8Y-@AA;(U>{qg-qkK;N$&rmli9oP+i)# zWZ}!+x7BeKwaL7~hb~`lP<2ZYGCe;>XdwqzrOq46z@HbHz3<(qW0-s_%U9sy!oU@i zG@F<9b$5P$HNmr%oc2wN_xUOM>%9MyR0!>A73|WfDBxDO;*)n^aVNep_ zijZ4t+|7PlOZvN9W$NK*|Ftpy&HHV?{g#{Z z{Qr8MYJJuB#s7caQ{VUX!6x?Uy7Akd^=`e*|Hks#wWza=HWt$+D0}dPo;)pgmAS)9 zWVL+lejBNvh1*YCF&tw#{OijM)6}M2E~e^TYp1Szem&<-@gAvz^Y^_wo^m4TRfjG= z!xRy(*=4dn|LyIUd3mZeIO%<7(%M-Q6gg%uIufup|GWfMWqnn!cRrwT0I$r8JgZO`(>*=Ohd?O#*#wz}W$+xPEx{`d3S{5gDl z{=V-!r(a)tcUSuJiQ6VehAoZ~JsrDov+k7W&B|L-{JmrLzC18le{I#HrJ}dLy^Y`a zuD5h{dCuM4?_XTJwnmwM?ZPsn)g>*?>btJx-`@OV>(&3i&T!wa{ju@A-IgE6{dKC7 z-nQi)kG8(-l=q~@(3fkOP;y&GpRi-y`xUF|EZjrgpD^gnt2nrU@o&;K){SW#$E~u@ zuc_I)R;$D+$n`|pu`>)>YJ!EoKb|{!I$VBT$(H9cwRhNPd#@1V?wrw7toQNB4b>P8 z70*c>kph7YlYTlSUtVopR#X4+(OuoQT=OojPW*eT!z&;tJm+lY&ug~!Rd0UQ|G4h{ z|LMf#)AwvjJNvD6w|~i;Gb+yFbIa#!@a9<=wYIFRENpcs!`FGMpL#XMNEsSlpBbLT zS>_S&e6rFKRwkaVot7upNF{}@Y-o(--Qb;2AD#Mh_U-p|Z)U!~_xlFFT-~dyy6oS! zrkWNs@G(d*G9*p;zF||N;v_}R8I7IK{#KVo8{~TRn{J%drE)&&=0(J zjdOAr0|RqPi0@yG##@la$l63ctPFliUx?inKianlaDdgi6;+MG2?L zNgRqIlX-uC)2)2@blW+H8A?`HIMh0BTnnvzc(wHZ=XKTZsvdNP-@8${LpA$ti&sIG zX5y=hmaNMeR;&^X*|WT@%_%tf;^Ne;McI=S{O(lpX+^KtGwp!)QgvhLOE=5Kz*f7jhx{_?Z*y<4-jtDdVK6EJ@N zufW-|(&%E0x6L4onZn+ptAI0SfQ7PuERyp3_Y5Oj8<>HbY` z5A?^?EEPU@Tw>>}r@OKqAAE1~=g?jKwfBmC%wPy{?i1*odhra4gQ$Z5iz2(Bdz%Pz zmWoLGD_OB9#-R7ldu0Fiz7{{T`@^56t9iS#ZcSf5)2`%%LY9va`>KGR01@F!MV!S9 z$xdNMWDJXESPLzgqqApM@$>R&HpTai*I!-L({WDH;n=FS5XUu)jYjS%OJuH24DM~4 z*b$)F8gi6jOT>c8&CB}a?-?Idc(mK8@PDU~V36&qmFfQXI;U=JV0m@0`(n4W*}fgm zN~f!Bjf(TCS#fQ~T*(H(iJ#w?%rmR&4xC%uuu3ao+tamk&+pk_beLtqapTw9|0cY= zJiGkOHLnbvX^T>L=Ov$UY&{^;s9dn(-jUe?D$9BfyfAQxJ7--S?z#JL>14fsr?!6H zU-kLW#>4Dx4N{`3EaR+FKh3Wz`#0BEE$+(xbpH2Dj;$+%rcBXj3ii6F{vuMc^}r0p z-hD@Al$EBPUl;%TLRWZ8kdeIcSrv8e-UQwiX^tMe2bx@XJsMiLR;4`fkX$vZGpy~) zn{64tmNEyw-*W9rh)vB00Y(RohjV?(V)r+7Sh7saxR`5Q^Je2zZL1^^*6Aus9?j`a z3Y>5vQbc&+<>xD9m-Ef-oaL5gckkA}KdZLBE|a$_T(axc*|X}Z**UMm3R?TtttyzM zy+FUwyH}Vsh_!Q7(gFbvCYOtAI;^%-A3pO@+1|STocz7I)9LHxS!UnqaFe&WJ-eE} z?)SR+weR=2%T+#`8s&cb&uP7%e{bji`+Hj~);9Og0z2Nn)n-N0W?sItsc1!*$&-|W zyL&dAUc$@MBziKmInTBv<^Rcbht*e25>eFbOj;A-aKut1h(Y7$BJpHawnGWCxH*h= zOyT0Jo*ufKSAJi{u`TnKE}1kvHrb0|!t+Ym>92!+1a}D=gj^T>vT=HtT<&@`J=2S4 zTvRrES6ua3&NqZf>DJ4|(n{(|46h^^6*Ns{wU4XE$3Bld&iBT8&B_H^CvRPISzyAX zsI*Ak^PeS}IwV%8&Y9A6^x3gxj=e8c7q{KDN`Dq^UwBx)_Sd)kJ0*X&iu*}jU+!)w zdSFk?+f$5_k6mh~p!O?>|Dm)hOW?rnVV zDO0>>mO;&f2lIIE3TY?!7>eBRlCy1{)U7;A>iqkQ)fw{{zw6aLlYdwLt%25mc4oMQD?qE z=A|>X8cq79X#!al0oN_5NM& z-reRxj_a1&cB`&f#kBCdjFUrx2UqmBH}MsLUiWiXww-1Dx2MKxF_j;G7}|PY zcH`gq<&Wa@KG~|9I}|so_w4$0$@l-R>{@_PFxPUsj6u%G}uR zeoTiBmJyzv2F*+t>(?SJmp^6%S~Ded}}vFziCgV)c@ z_;q&ny1)M0?|xZ6f7jc7yUNe+V~VdX*PmZ^{7m=z8HR7Y!_WV_^YwGy{%@c5|M)eR z^>FF#?>U*dv71xRFZSR6t^d2u&etoSUwdyosnfrw3Ic(8fr2wE zPj9Mvv;E1}-gf`8UU|zOt6qxVEqp5)zpL(^xqao=_q9pyp0Atz^QrXnnzz?j@9!x6 z_k8`#%D-PYr}w_JPYg(2d2tT^x#KE^YP?cPQbm&(x|p<7+3qerGvDatAwlI`#>;O> z>fXK^_ILU5dA}b%KHXoc#9%3KZZ+?{wlBH!EV52K6^}D0|8?c3vED5E;#XfMtDT)& z^zX$(TZx=AHy*y|jCFFmX#Or=cmIyW*RlO}Uk?cD%UR8QYkTqM<94~qA19wrUw?PY z=MyI%$1YS3m>v+$r*7SR?b13wi+h6R?{9wp^y+%~J9`C90R|B+R+k$0E5ZM(_AENT zF6wqvr^cJT>m579VndU!1O+XUX#f7&GWpWa%j)y*FW+fsS^I1Pr@&c;PYQiE7$4eloDa*41I-)Polol^KbudUV47drp$DO_SP#h*G;aeoYqxv zE%AzLzJGx?a}mn&|4CtffwJ zC#9D;@Ot>3%U*iPSW{%GjrxQgQf(@#Mh0t)8K#zV8KiCd)61K`XRC34kk=)zu$3Ew zUU?swC)|Ey(PgzB`73)1zckoAcI!P<@oQJ)H22F(CUmXrFlbZ`IeB@-?DE{Z#cu>8 z5`1rnu6nR)f?H~!ykVf$3T-#NClMUe#FB$HZPAcxnl$mVTy0RWYPgB+Y)TbUM;fbE=d1NQQ)RXIa(sl?@!T zcrvtf_Ee<3H{sP=5jvN3^)-Q=&nEF!f8V#UHb3e`-N7p#_p*I!6;bZm#B!qetWwJw z&(l$CJaTKx*UN3z-}A#bJkD8?#bkklhu!5ff(kpf^KG}=oW-rydv0gc3e`7UP7AKR zD=rOK7uwDzWAd}fP&4G_u5=x`ice>{Tvh`nI@#X8;M$Tk$hiR@wa}1VRhII$pE)|qv z+;sB7LEmznS>|_yGd#~QDq5#@rG>3Kc~5z*$f0ntGe7s|?|sHEcJ9}mJukP%ndRQQ z(m6fe>R<8nxIe8sjrSFv{$szd_~QJ#+ddQ*FON0JW2h_;Qm!-+FuM?A+$j3`dU@EX ztv10|gE{{N>qMPaG^w0noB5?-*|VZ~Hv5uJC+n|Y<#4un=}P_Qq6*%VTs}RJ+`Pxh zrPS!3-@*fDLPT$BK6uB>-nXSpQ=##&)uuU%O)C@DpTAe|)>T-og=2<^L(r=;n~UOV z-y9X?xBtAUh*@%}oR%WT!sTvB4hGBt41r&Hp7%;@da!T2SK1P`Lv9Wyr`fWH=hkU+SB99nDAc%npK6dxJTu|nbYIK=1*bdze?773cif$V z9k%Tf9-+EUk5&l@?07M0O_*QzpSV_yN44$!Z!HTrGz}dLel1O1v-$E7i%o%lt820@ zhH~r8j%rDmG*O#HFQjpL{=J`fUeC5ZJ<-8%<199jbfK#u6F=k@2AKO_R-5<#=FZK( z%v2>Kzw{YqK5_XhwWQ&J**p6`f7!*~TbE2)WcE8DvN~&FkFedU?X6h{RkvD#H+Wfx7 zns9R^UFW62#?H%AKQL)dFMDfQc>hwWyOmYbGrdG-(UYOfGp?8(?33N7ED#XD=xXd- zSA6^)@9u95;(nsL&)gH-a&`av+nb+1oBLaA|A$}igkzJU5;QGNeX@}!_{G{)JM&f;0so!Ou|Nn%az%`?ti>$b$Xxt z#m#)8A|YBnFQ@v!&FQ;}jC7t&nb+i=z`W}8#3l_!$15`ysef4;TATOw)+|PjJ-grh z=i8=r<6_qBRcE84cO{)PEoVMh|TD&^kSPjir_@6(2*Wi75{;pq>I>mcl+}?fi^1kNX z*1N2N!(9wg0s@Uwk{C=U2g}dAc}A}G)yd^?wUr+l{%w!3N?xMx6=uyhbLt$2bMsEK zWp8^I`Sn+{hK?iS%?6P*an@`_C+0C6^pOxalY3)Z^67(zLo_y=u;zLcZ02O*b@0xq5Do4)$=_O}&po{I9_S-yVnw^!W9`E%N$!p~Z&g!SB-`g+#e>RZJg_tpu| zlALwr{l8!HS=&XDI|A?D_!Q>4MeL}ufzm-uc9DryB76)YOOEtRbL28@n{#7f`9&%3 zR@d;@%GXz?->6=X==|m>n+! zTe~ek65vx^`u?`@+gQGm@80M0GObH)Zw>!*@{aa%znxnSR&&e@PxZTRRaWvfI{(_H zbL9*Sf|9)#Ii@gmFu&iqBkO!4?{B`TTV5ESytI9?d)X`JqS(ePfg7F0j%QhdiuC$> z6Q1+G`F{NRnW&13KUfx2Kg!#g^lR$mV=59>o;QR-(vKwx@J?~?Y3`V5@o7SK)4myM zZCZjCCdFU5y?1-Ldk;ebqoj;7Cx_zE6^z-IS1w)IzU|oWX}N!XACIrDy1dR$F#S$( z!23B(tx;T_EMg}7febE8%ncI)m0tKbGbS-Un&4O~bG>WA@;g6n6zALg{`Ks$I?vBb zhdk>GkC$#gyR+m_CG#@g_tRVcxcjgB@!I{`TdOeVpkq-i!U=3m0jf+aTeCLk-Y$39 znl(?*_(Z0CD2L)ROTo(b&KwRE_hwwYuD8dp`rECNCr2i)Ut9mB_38P&yWU;+SoVdL zsZU}mYamCDPh^X)u#@*Co3>}q+_qd;?QX8-U}RO?Da)w1$UDM!^B%7RhF2Wk2Q)>t zz03Z4@A7$@EsreMmVEQ#ntQb--^{JMWw!CKD95w(@=Tmv>h$-TU?-+56w` zSo@#y_B)@e``hmSF?Fl|x|rRW*Z=8=yYS7>bW{1h5*CQeK1f_{H8UM89ve$k4a(eal_s30o7e>8(_2S~%-=gBaG8fld zE3R53AuzGgqKu;}WfhlOhuZ><6$$55@5=biFJctr44Crg!NzIoVR;sJ;u8Js%1oQ* z*%bacaq)4-jH;-enWw+)br%$JV(w;C+N5j{bZl+)_pK!*uEFshye*M;d!vvE4V>``j4 zdL!#rj)W8G_ckx}II#1Hn;S#ginc{ts*X3x+kE}9>~OpA$9--`_T6}q<|}8Nd}#*@ z!`mwp_}r!lFid$>RG4C@YBH69!J+Tu@vP%#G=AQ+(v>5B3@_GZVFVX6m5!yi?%7 zjL1c^Bo&-(t<%$#*wQ?*W?8(t8nLJ3)ep7)C9||yyuxyC?M=MSSg>-1T<&X*QVSNA z=lAbyEdM@Hj3J4ICB%X02=no%Z}PTkf*c$8w!Z(nvg>HlB$cgEYh(1-MH#rV1XL7r zzU+H&VezbI%O1@+?2&Qg&BQq~j!kG?lXLadg1n=vm-+6^xpadqyx#iQ_S>cBX82_& zB(a1TveqwH`g!5=IJ-MxZ9Wmsz1a~>l8=wwwJJ`#&(V2$N!hB6U&sBjYW{Z1)b#-TVZJXulQS3ZjtuJDNVjIJ|v$4OG z6q*euTyws~+|Iwf{HnwZUY}QQkA9J>m8qN;p1pO~PFeM&Wo;9dU7ayKd+wxkHA`iK zof=*&E-Wd5&Bwe1OACq*|2X*9erv%y^>s7v?%z3O!qdoU&ksGh8>vw%xOipb!pK+L z>bJDduZ!56_TC$MPG*4nGP zdS^;7DH$(dQW9igWq5Uc!kL{Jeg-TPf;)r-5)?0kE-Wk!du3uH}l(~9Kj?A&;} z>_b8Iw8es&^Cq3xwq@(8rspjzGb0av`EoCZL+|6g-@87AyPUaTDK49qF~cI>=IF%E zIb1V4n^w3vy}TB%C*ewm^z+!CTdm*iD7aI(()IM}gb7Pri{kuETjzdUb^4YIPs6sH zyB{B&x<2XM-X(VwJK6Q_R6cE5A7i>b+SBBspFy(tl~?=TbnJaTZL)5p9z(^C6P-`B z;F4SG)E!x}M}XsBF-+ z=$AmSbC^@XldeF^^U8})vvRpCt~S%3WAp6$`u(3~o1dR;T^X_eSXAs5FFQd7Lst`q z+Wr^Kp`5%EKXdF{v`{{yzS>#r;n-f zE?6eDgp;dHKvRJ0h?E3df&c!UpY!KOlr34hc;}TGi`RGR-*C8`zQO3o#Fdre@S<5o z^T=v_yZl2p6lG_qOj-Hi+~cX{WpA}7x-ao_VR>Pa;lrhS-2YwH%Z?dLo>R0qop#2w zY4q+>xY{84@*M9C)f7wTgdUfRi#M47wFs20|^%f|?fa z7%q)ySi#VK>uH4~_q2GE6&0uNc)yD<$^Z3aqpSPYHC<=!iEonN=wSY_K#oh`pmdM4 z(TdXZ=l=hE@i_Kk`D?p^*9Vnne&)1Lk1+?>(hxZ;P zyR#l};p~t|IQFDd*o~)X&dTYVLZUWpTc@%}TTy)Kr4Bs}_tenk&vvZ{d%DJL>w?q^ zS<1%`+DfVMy{v!xggbA(@#ELq^?v!!-}(6U_B#cSdoqLBzP#>^YIM>od*` z6=E0LnKn2ZpWSpupypNpbNQ0J-#&Q1-v4#)Z@JpC)YqM2eNPLSclk;iS9r|7H}A~C z85w(n6=y8$RKI-WiV3sTg_|EQcQ=`A{`F8CeuQh+(t)2V7H`IN87ISlby!~`F!8b0^)

I z#SX0u6F(xH`*y2FR{{fzlsb=m&GSX8^Y`bydvdY4{d<p19q+HPlNlx|x*Dulv_J>$d-N zn}6s1bv9nR_ImxUPuH^7%bM5yIsMw~Z^g$=`}h5Bd~dVkNjtyp@8k1rzcshd|M{-g z`~SOp$Nzu4xO{){|Hb!reqZQ&d)u<5Q#ia>uU`o7_x+e&e(&SepT+yjPG61R{q)uPyH@|D=SO^~-md>=?``qF z2bYWeeK_}e{p;@ezwPZSKZ`$$-S}aVrtx`s)5M7VihI3mgNyXs*DyXiaPfo@hbiyW z8J&p+L7$%3>~86Bapt%=Giv99IgxwK9a%eWet&bb_|z25`jX>wvi0|;+ oJ3eA- zUjFIL>-Ra6 z_Z$><U`6%2b3MpJudS<*_pjO^F7=%&Kai`huT#XFTGN zX`0z8@kwIBiQiw&IP-TepJIHk(bQswS>l%_Z*~4xm$ww1-DNtvjK?m2O_S(cvx*lS zNeZmzmtIkJnJjabA+kYg!Np=Jh4Yrq`n&?_d~bdpbuAW;vt6Hmei>7=TByPnjWaxv z0#{W^S5zLFP?a9&p{w}ZVr5y$S3MPRo;UW19~v0%O4%-CTGZId=h<7U7IoVAeeL;qwxOS@KK)v}m*>LnD>qg$ zx(EgqcQ)83tE9A5Ij?=GS<51%ICG(-l92-QCaEr`0Bwu!e*N}LY8;QWj+kgv+Rzsb6mT+hs{mUfZbQ<`3w<(^LI}1eEYWHQk77=6OSUB0{fF! z%89RBTpM}(uS)lv=-_2h>5;jReQn7{F{d?G=d?U@Zd=mQ!m*##|FxEioWs#89SkBW z9WL99_r20eTGVmkh|ilFme2Qmc5z`yOIoDHwVZAi*)fz(AAf%nX}+<)v^||JVF<2gQ7npwE+2xn?-8M-EmeubMUQ)5F*!1_K=xe@`k}}uO zjTsBrg5*E{4`h6L|BP_sIh7C>W}Bn7Ng+$F-@CCX?|7ZJ^ra;?HoNx+Kb8_XX&2=G z+A3W6#W_)bcLV>9j-3at?PU+kzav)TcqQn`Jzn3hd#e^0pG&TpQ2wI*&76ReWlV;~ z4|*<#-@jA1V(Hz=`9}ON?k-Mu)`|)?aB*AQZxH`4!B9nErdv7_!*2fVd3S1eXf2C6 zn-zPQ{hRMx!Db<*B%X&oGw-nTN&SEK*sdM_;-?u&V>h7%KUk~0LRXW1Kv2o$v*lX|Z`MDM-No9C! zKQ>XBy8l-i=A<8)=*%`% z$lawOVZ{-L{pVOt#anUyky-Srokh}bcRdr!3yz;{vevt;vePo=2{)Wv>^_Y{;Gn~j zdxutd?e8nJcUo8e?z8$E$AteIg{z~Zni)2`Z>h80)h~Ca|GwHOuAuk7Y?HP3U;g)9 z``rHjqUSgEKN32iyZif=t47bebG#<`?tQQ)&ewHA1_xVd?z#h(mEX?gHw4y7aP~W0 zP56HB@Ya|M*4&l%or)grnAo#QN|1v=at5QnE!W#KO5VSIE}Z)OgQsfx7lm#7WgCAg z%g#OSzpZ)anJo`8Zr%9I_AM{OKsl@+qlb;-RLwTioSN|1hi?jg9zI-i-b|hScc0A4 zw8}$zD@@F%=*>1+`69qUaOJ%F48{SQH$RhD{wj8VoA`evWxKoa*4sJimid23C}h!V z%G|rxTjavi6U#QP-ugF1PD|si@46Wlc}Fhn(`f8D*`uH|OHfN_&eos@+uK6^?3Q10 zsM6)*3j=nMw6v)X0-394KU*H$C{VNK-fZ#oOH<5PHgKgp;AIGz zTlg|VwN0Q()!_f6laJkb*)N-Tiaa_VW~Z&!s2bQKz@g;DaNzLN48Kpk=-*f%<$F25aodZ(cUM(8B#CJ_JX-PNSzoPv)SfTzmd{sjxhd{H zuj-z`DXZk3V}2jsioN@O_>{b*P??+by2J@HL|5DhYg1jnZg2I?&(hoWny%RS{OjiB zU-NX7G8RT8q*um$p0n!H@s2{X)6UP%Zdzr#GwJR5ur;>|zC^r#w|D=Zgo{f8ooyUU zGkmWoPZ45j$awd6($zBV-cHa$F=y2N@|9DV#RV85leXxXEL-__iPA#1cb!w$>sRMGr>pwRHh3r; zes)L38HJwE<}ZsApB9&<&3k#@(o~ASQGnxWbJYbF2Zc_qbCIVkBi1oAdY@lknfLsyW|z zP5Jog+h%X2Op9JT&yOqk+{1Zzcj3uoUX5_wISX&v8EF4!Q}|(WaE`Hy;KdazC!UNHGAI+pU@ZbdfNZl4n!%c2dBA}ynVVM^Y^}^=hyzYXUlK9tM2$Q<+rDf zdL|#M`}b`2y7}d(@ zt$lv1`F~D7R?ndEeB(A5yDyKI_W!@^+`snDp6?k)zZMnUe4!Y>xA5Ne{5j^eA^X!# zcowlT`1AE=($_TY2gdWKeL5}3+{iJbLGrHk{Xb&+8!p@N z^49;nYQ6vOS^xUvgIl80d}MA+Q9Hva?6pp)^W@yDTaNEv%-N&4*I%-e|LrNk7(>Pr z9H-BPGB!_Kt-)OJfT>`X^pRbf436i{E_w97z~`J~L(>fYNo^554_FmGE@5CwXy}=D zfKgz*GCXHFwG8{3MnH~$}CP!d|asy658=BR^)j6i@5IMkT@w}Ts&VaF`fv@A?m6Ci13wIvo z2mjfV1CH!m9h@e?z`&qd;u=wsl30>zm0XmXSdz+MWMF8fYha>lWDsI#YGrI>Wn`*r zU}|MxaI?_;7>b76{FKbJO57S&==`r@U|bP0l+XkKD3HUV diff --git a/plugins/fossil/wizard/projects/vcs/icon@2x.png b/plugins/fossil/wizard/projects/vcs/icon@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..2b4cb285e09a9bbd6c50acfcd5b08f26a5d42ff1 GIT binary patch literal 3441 zcmeAS@N?(olHy`uVBq!ia0y~yU`POA4mJh`hDS5XEf^ShEj(QuLn>~)jpYmpxh~l@ zv#~Le;byArHAa@3;*qI=0^%V@Y7f`Cy10sP1PQRa^fGSoG`YHDV{Xxsj^r5r1NU;Y2@`}+U? zfB*koP?(qi2LjAfy{0~Txl%KI(gewmoF{*aaJeoybyjz6O48NIK1xQ)rn=b~M^_!Y zUtLi(ZENYf|K_z%&Mr~npR#QJz0I%0{w~^;cJ1b+O{*@iTemKGMn+1*{Q3ivR$hL- zXTsFj4-Y5O~PB)m$bLK=EZI)dE44M zJNo|G`TPHDZCdo{{gGqp-+ugN*9%^4%k@Htb@Hqhj{c5Y_x9$$sIUIrC!xD_DX;Xs z9&e9Z-2I)N-bxj}f1I0Vn*Q;$iQx6MzAowC_lB>|PMgomCAWLpTCUCq@7A4@o<6Ct zB02f>?rUmHYty3ce%?~pZq(_?{&j}oKknnpQ{~sLT31{4^wzTN8<~Dg7LXCz<#_1h zO)g{h%o+vPvs3Tg+qd~dag@*g{;64OHhegdrdG%;@%Z_E0Y;gy1MA8Ti?%vRzTQ%M z;&yqOi%SXjzq#=NRb4h4l++5($!UlP3UjH~ovxXDY~I5?hEq2Bo|T;*bS#~(&;PWP z--Ui-gOkEFwSS-G-PrSa{WIy0O-EPPJyp5frV(?tw{@zhr08aCP0Ozgw>xcZy2`hG ztxM7Sb62)@{)M`Lhf5M`E*TfSpTB#-!|90+18>`y#!W8Sb>mw@!voRspUYNr#P3Wy zef!y=c1bB|seLzZKF-{;CAeeh+ok)Y4He(cWuE_P(c@e1Z%tT`c5BZ3h%Uwh@}9O8 zF*QN_=5oGH?K1ppc>6EBT`|YzEqkcx=6T(nSIZNBIt#vU`LfvKvrcB6U))2_U$>lJ zeVnNB$m~zwy5|3lueEO`Oq_VpdiJdMJ5xMwhpoH!iT!`Wfu}|O2hQB&KL7E3^4D8y z>sewIpWBA`&HLw^_vhHMZQnb(y-L4H#93Cl^1pv8ZFY<6_eC`k9~;+uP8(wQ`(+r9 z<=!{`5a||nubJb}lQ5>sT02~Y&duHbr*!#KT>)3W^>e>po;_E7t2N^sv8u|>NQ(9T`9-VfW zKV{c_$-h-0zAI~|z236?f5!q&hwPhoe+&8^5>adpIHbyXNK<#U-QK-he{Z^AxI=7Z z_uaeqcK#1m{J(v1_5!=`Q#xGE-^xQRB>mALe>S+m(mBh|$(tThp{D?c=g_p`4wXwHFH9f1R2i z@JZwD?Ef0i9gc37n2`|FC-G77uf+bJ&!)V~h+>|Y^rgUYL15bX$fA1}>oy#D{YhN{sSBs-HnCK+@*o!2t?e9XS2%kT5P&$QIo)_h^B^tS&uFY$i6 zBzGZMqRgY>!Rv{Sa~JW3oGHB#u<@qSt0k|6b?zF^VVSY<*H7N{&8&O(ZrAu47`Sow zMoDhN;>epnk2~tKv$n2zxIXIQ#D!6|iSF6w+g}tvd~|icSgGNQ&}ehZf(sitU%avV z63>#8_wL=z4<2ga*X=g1Nj#kY`nhg(?x`y`?e+9l)-YB3ecG|b*>EH0+zUy;0gp4^ z&r?<^(fy;aW=YAXa>W|sT}nL?7dhji-e-C|a=!49({pd;OG|gbgIQbcj5QA2ITxRs z5IR*W^pi)sxsjA=1)`Sbe!C6BB`RPRQxaEcGRwao<6DCZ#F$h zXpc$%{G5Fzdt%c2L#G(tD~G%cTbo%Wt+zGd^5(kW)7IOpY-)e?e0+6vwcFtX3uazu zHUIH8=%}+n=(ER)W(9(QzU<*QF4dZwZQnnCa&!rkl+-{@Z?{T`N6eq$>V0jGqN<_0+Lyr3hKY|_sw@h`6f9QX3#xm$SVKxV zYMH63X|cdEVQuNgq`bP1%2l;q@>6_56b*kqY5jJ`X@=Yb^Zb38HYGQXosoW%&30^Z zfzXthkw1^0IlgA@-Uq4=cP56%tNd7dw?47(XL3x^v6m^6w)TGi^z`(xZg*ZZo)r-Ib>-|D>h8-Y)sAq}rwO1-@>z%kSN@GtTAY&U^my zy=|(=7yesfIr~3oL?#(OIn>Rslpyv)FC*+*%i|;owkh^e)qHD&Qck*+_7^|Xt-U&J z1D}k_|NZBuUE{ZWGR;cym5ATdtgXQh_3k}bQTF!l^b4=QbZY)R@x94B>KOOBAG&e# z_ndzy-5j0j?P1QE?|q>8*!1)B&Fw1Qv@i=V;Fzu+`%+3kL}pjtnR|9e6s3B%dA-{EqIdTvt`SVx9xqeI=STGp;l?>&tG3(?{z-R z-!Y3p>uty6n9nEIKQB6J;G7V9G-m#^iJwc~)%h+j&X9|7-l5RlZGKFUb9qo_&m3DD z8}GGjv23@$?fHLT!pBEPyN`KK*ONRyzy9ctE0^z^+x`F^OL)3$d!t;d#E&J`+ zd(X*%yLS^jJw=o&IEPp?8}e+dr9!n@!~$UcLl}8 z=UMtowU2L1KF@BkvADQ(#pg4h<(nQc-@1A|Qpl(L{fE+Yu3JG{oub_C{SDIGUm5km zZEBOS(3i@es`q71&bn8UdRCpmclFnKdG*DLY!mzqzjvJ}vAneG>b3nVE>`$XJN0GB z(sX&l&whIBEL^K2E`KQE7Tc_&wS9}MO?TrL^;$Ez)rbFBKHPOnR$$A^w<3=>q&T&o zWeMkhcf|G3F2xJio~>Cudvx$yel6(U;XI>xt7n&oMepDERQAWo6@Ct89>*rhtkE*>ogQvFNy|WV z5mR7Sfnnwf`L!a?mT5WUfA*HwJ*jM9P_guEoWX03ld`Lv7EDpv6cN#se7r4RE#C6F z>$6QR96V_v>r65?&A%bR*t&H=ucKsp5AW@kH!^++Me{^**ZsV)=cBA_^V?%wj`QXy zy%d^r;D})4iAQC7ubh~su|$odlc_{XaOLgJ>x@%EL*_e%adL7_$y#uT*EMiQ;GB(4 zA(>XGMebP+J8$=?`L;iJ8FPclzc($YF7f5c2@^K-Chhg+nD(gkvszkM>tBZDAK$8e z5)9Oj+Vrc}Gt{_FM0oNBcGrw&|JgG`r?0nKuy<{4oAy6O$I}Zt7kAEj7+9p*=OnGc z=cAH(($6a}_G4;0(;Ky^ZSP$JMNb&1PbfQRwW`(0lKYfb)a`Gv54lCRE?<4!Jl-XV zeW}`=#DW{upE(uyUcLygW1PT0uebhy$ifuYCc_Yg_XW2m#oY4Ao+la+%Tn`)v!SzO zXSBnTM=s)$=NLN@r)uu6JJjlE_h8DC6Py}WCzmKGKj`}Wy7k7xx7G|HRmBqxs-sWO zZB+9Tzn%7IuS80}KxZ`5X`QQ_GHlipP3KD3atn(H2wXXEMA7(%d+OPsX*@;}^6?uE z%82Ic^B;VW@}gw>*7$W@_H6UMt-rnFv3|KQ=l7?Z{yr)Dq?{ms->`T_NJ>b3ogTwe z{Vy}cg}Z$|e7G{@Xo^hVgv^xe74EFLdwyDpGeUvs`;_KSb zw~l%HBm=3&_eT;6gqWJ0!anjd7{4yMQ72*qKWE;x8qt%^nXDIQz67 z@*6++D|zJYbz}2jw(FDP`nMhb^6JcMjZLYcyq`GiGRW z6C~IDI&!5>=1s$c=-a&V;$q=8%feQ3&&Wvmm{W3l`uba6#P~`c`x-7QpJ`-(03L1s anYB*ebFJKw_?m%%fx*+&&t;ucLK6V^d! Date: Fri, 20 Jul 2018 08:57:25 -0500 Subject: [PATCH 016/133] Allow to specify the plugin source commit-id used in the build - The revision is appended to version string shown in details about plugin - Set FOSSIL_PLUGIN_REVISION qmake variable at the build time - Touch fossilplugin.h to make sure the plugin metadata is re-processed Change-Id: If3e788bc517c41e4439aa82958fd9bead86e8f63 Reviewed-by: Orgad Shaneh --- plugins/fossil/Fossil.json.in | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/fossil/Fossil.json.in b/plugins/fossil/Fossil.json.in index 9b6fab8fff8..c2976b56c1f 100644 --- a/plugins/fossil/Fossil.json.in +++ b/plugins/fossil/Fossil.json.in @@ -2,6 +2,7 @@ \"Name\" : \"Fossil\", \"Version\" : \"$$QTCREATOR_VERSION\", \"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\", + \"Revision\" : \"$$FOSSIL_PLUGIN_REVISION\", \"Vendor\" : \"Artur Shepilko\", \"Copyright\" : \"(C) 2018 Artur Shepilko\", \"License\" : [ \"Commercial Usage\", From 88e11284ea0db367ce763388efcc9b566684f65c Mon Sep 17 00:00:00 2001 From: Artur Shepilko Date: Mon, 16 Jul 2018 12:25:41 -0500 Subject: [PATCH 017/133] Add support for annotation of any given revision - Parent commits are also accessible from Annotate context menu - The client functionality was added in `fossil v2.4` Change-Id: Ia6096432cb1151388b5aebca30a6d25c1c6079f4 Reviewed-by: Eike Ziller Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 62 ++++++++++++++++++++++++--------- plugins/fossil/fossilclient.h | 6 +++- plugins/fossil/fossileditor.cpp | 42 +++++++++++++++++++++- plugins/fossil/fossileditor.h | 5 ++- plugins/fossil/fossilplugin.cpp | 5 +-- plugins/fossil/revisioninfo.cpp | 9 +++-- plugins/fossil/revisioninfo.h | 7 +++- 7 files changed, 111 insertions(+), 25 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 6d688a75a54..8dbc225b34e 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -99,7 +99,7 @@ public: // This way the annotated line number would not get offset by the version list. settings.setValue(FossilSettings::annotateListVersionsKey, false); - mapSetting(addToggleButton(QLatin1String("--log"), tr("List Versions")), + mapSetting(addToggleButton("--log", tr("List Versions")), settings.boolPointer(FossilSettings::annotateListVersionsKey)); } }; @@ -342,7 +342,23 @@ QList FossilClient::synchronousBranchQuery(const QString &workingDir return branches; } -RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirectory, const QString &id) +QStringList FossilClient::parseRevisionCommentLine(const QString &commentLine) +{ + // "comment: This is a (test) commit message (user: the.name)" + + const QRegularExpression commentRx("^comment:\\s+(.*)\\s\\(user:\\s(.*)\\)$", + QRegularExpression::CaseInsensitiveOption); + QTC_ASSERT(commentRx.isValid(), return QStringList()); + + const QRegularExpressionMatch match = commentRx.match(commentLine); + if (!match.hasMatch()) + return QStringList(); + + return QStringList({match.captured(1), match.captured(2)}); +} + +RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirectory, const QString &id, + bool getCommentMsg) const { // Query details of the given revision/check-out id, // if none specified, provide information about current revision @@ -361,6 +377,9 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect QString revisionId; QString parentId; + QStringList mergeParentIds; + QString commentMsg; + QString committer; const QRegularExpression idRx("([0-9a-f]{5,40})"); QTC_ASSERT(idRx.isValid(), return RevisionInfo()); @@ -376,6 +395,15 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect const QRegularExpressionMatch idMatch = idRx.match(l); if (idMatch.hasMatch()) parentId = idMatch.captured(1); + } else if (l.startsWith("merged-from: ", Qt::CaseInsensitive)) { + const QRegularExpressionMatch idMatch = idRx.match(l); + if (idMatch.hasMatch()) + mergeParentIds.append(idMatch.captured(1)); + } else if (getCommentMsg + && l.startsWith("comment: ", Qt::CaseInsensitive)) { + const QStringList commentLineParts = parseRevisionCommentLine(l); + commentMsg = commentLineParts.value(0); + committer = commentLineParts.value(1); } } @@ -385,7 +413,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect if (parentId.isEmpty()) parentId = revisionId; // root - return RevisionInfo(revisionId, parentId); + return RevisionInfo(revisionId, parentId, mergeParentIds, commentMsg, committer); } QStringList FossilClient::synchronousTagQuery(const QString &workingDirectory, const QString &id) @@ -452,8 +480,7 @@ RepositorySettings FossilClient::synchronousSettingsQuery(const QString &working || lcValue == "2") repoSettings.autosync = RepositorySettings::AutosyncPullOnly; } - - if (property == "ssl-identity") { + else if (property == "ssl-identity") { repoSettings.sslIdentityFile = value; } } @@ -582,6 +609,7 @@ QString FossilClient::synchronousTopic(const QString &workingDirectory) return QString(); // return current branch name + const BranchInfo branchInfo = synchronousCurrentBranch(workingDirectory); if (branchInfo.name().isEmpty()) return QString(); @@ -726,7 +754,7 @@ VcsBase::VcsBaseEditorWidget *FossilClient::annotate( QString vcsCmdString = vcsCommandString(AnnotateCommand); const Core::Id kind = vcsEditorKind(AnnotateCommand); - const QString id = VcsBase::VcsBaseEditor::getSource(workingDir, QStringList(file)); + const QString id = VcsBase::VcsBaseEditor::getTitleId(workingDir, QStringList(file), revision); const QString title = vcsEditorTitle(vcsCmdString, id); const QString source = VcsBase::VcsBaseEditor::getSource(workingDir, file); @@ -734,13 +762,6 @@ VcsBase::VcsBaseEditorWidget *FossilClient::annotate( VcsBase::VcsBaseEditor::getCodec(source), vcsCmdString.toLatin1().constData(), id); - // We need to be able to re-query the configuration widget for the arguments - // each time the Annotate is requested from the main menu. This allows processing of - // the effective args controlled via configuration widget. - // However VcsBaseEditorWidget no longer stores the configuration widget and thus - // does not support configurationWidget() query. - // So we re-implement the configurationWidget() in FossilEditorWidget sub-class. - auto *fossilEditor = qobject_cast(editor); QTC_ASSERT(fossilEditor, return editor); @@ -769,7 +790,11 @@ VcsBase::VcsBaseEditorWidget *FossilClient::annotate( effectiveArgs.removeAt(pos); } QStringList args(vcsCmdString); - args << revisionSpec(revision) << effectiveArgs << file; + if (!revision.isEmpty() + && supportedFeatures().testFlag(AnnotateRevisionFeature)) + args << "-r" << revision; + + args << effectiveArgs << file; // When version list requested, ignore the source line. if (args.contains("--log")) @@ -805,7 +830,7 @@ bool FossilClient::managesFile(const QString &workingDirectory, const QString &f if (response.result != Utils::SynchronousProcessResponse::Finished) return false; QString output = sanitizeFossilOutput(response.stdOut()); - return !output.startsWith("no history for file"); + return !output.startsWith("no history for file", Qt::CaseInsensitive); } unsigned int FossilClient::binaryVersion() const @@ -851,8 +876,10 @@ FossilClient::SupportedFeatures FossilClient::supportedFeatures() const const unsigned int version = binaryVersion(); - if (version < 0x13000) { - features &= ~TimelinePathFeature; + if (version < 0x20400) { + features &= ~AnnotateRevisionFeature; + if (version < 0x13000) + features &= ~TimelinePathFeature; if (version < 0x12900) features &= ~DiffIgnoreWhiteSpaceFeature; if (version < 0x12800) { @@ -860,6 +887,7 @@ FossilClient::SupportedFeatures FossilClient::supportedFeatures() const features &= ~TimelineWidthFeature; } } + return features; } diff --git a/plugins/fossil/fossilclient.h b/plugins/fossil/fossilclient.h index e75931420e2..3b0a414b583 100644 --- a/plugins/fossil/fossilclient.h +++ b/plugins/fossil/fossilclient.h @@ -48,11 +48,13 @@ public: TimelineWidthFeature = 0x4, DiffIgnoreWhiteSpaceFeature = 0x8, TimelinePathFeature = 0x10, + AnnotateRevisionFeature = 0x20, AllSupportedFeatures = // | all defined features AnnotateBlameFeature | TimelineWidthFeature | DiffIgnoreWhiteSpaceFeature | TimelinePathFeature + | AnnotateRevisionFeature }; Q_DECLARE_FLAGS(SupportedFeatures, SupportedFeature) @@ -64,7 +66,8 @@ public: unsigned int synchronousBinaryVersion() const; BranchInfo synchronousCurrentBranch(const QString &workingDirectory); QList synchronousBranchQuery(const QString &workingDirectory); - RevisionInfo synchronousRevisionQuery(const QString &workingDirectory, const QString &id = QString()); + RevisionInfo synchronousRevisionQuery(const QString &workingDirectory, const QString &id = QString(), + bool getCommentMsg = false) const; QStringList synchronousTagQuery(const QString &workingDirectory, const QString &id = QString()); RepositorySettings synchronousSettingsQuery(const QString &workingDirectory); bool synchronousSetSetting(const QString &workingDirectory, const QString &property, @@ -113,6 +116,7 @@ public: private: static QList branchListFromOutput(const QString &output, const BranchInfo::BranchFlags defaultFlags = 0); + static QStringList parseRevisionCommentLine(const QString &commentLine); QString sanitizeFossilOutput(const QString &output) const; QString vcsCommandString(VcsCommandTag cmd) const final; diff --git a/plugins/fossil/fossileditor.cpp b/plugins/fossil/fossileditor.cpp index 6297f7dff1c..74a7c8697a9 100644 --- a/plugins/fossil/fossileditor.cpp +++ b/plugins/fossil/fossileditor.cpp @@ -124,8 +124,48 @@ QString FossilEditorWidget::changeUnderCursor(const QTextCursor &cursorIn) const return QString(); } +QString FossilEditorWidget::decorateVersion(const QString &revision) const +{ + static const int shortChangesetIdSize(10); + static const int maxTextSize(120); -VcsBase::BaseAnnotationHighlighter *FossilEditorWidget::createAnnotationHighlighter(const QSet &changes) const + const QFileInfo fi(source()); + const QString workingDirectory = fi.absolutePath(); + FossilClient *client = FossilPlugin::instance()->client(); + RevisionInfo revisionInfo = + client->synchronousRevisionQuery(workingDirectory, revision, true); + + // format: 'revision (committer "comment...")' + QString output = revision.left(shortChangesetIdSize) + + " (" + revisionInfo.committer + + " \"" + revisionInfo.commentMsg.left(maxTextSize); + + if (output.size() > maxTextSize) { + output.truncate(maxTextSize - 3); + output.append("..."); + } + output.append("\")"); + return output; +} + +QStringList FossilEditorWidget::annotationPreviousVersions(const QString &revision) const +{ + QStringList revisions; + const QFileInfo fi(source()); + const QString workingDirectory = fi.absolutePath(); + FossilClient *client = FossilPlugin::instance()->client(); + RevisionInfo revisionInfo = + client->synchronousRevisionQuery(workingDirectory, revision); + if (revisionInfo.parentId.isEmpty()) + return QStringList(); + + revisions.append(revisionInfo.parentId); + revisions.append(revisionInfo.mergeParentIds); + return revisions; +} + +VcsBase::BaseAnnotationHighlighter *FossilEditorWidget::createAnnotationHighlighter( + const QSet &changes) const { return new FossilAnnotationHighlighter(changes); } diff --git a/plugins/fossil/fossileditor.h b/plugins/fossil/fossileditor.h index ee9b6b4ded9..db43d411da4 100644 --- a/plugins/fossil/fossileditor.h +++ b/plugins/fossil/fossileditor.h @@ -43,7 +43,10 @@ public: private: QSet annotationChanges() const final; QString changeUnderCursor(const QTextCursor &cursor) const final; - VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet &changes) const final; + QString decorateVersion(const QString &revision) const final; + QStringList annotationPreviousVersions(const QString &revision) const final; + VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter( + const QSet &changes) const final; FossilEditorWidgetPrivate *d; }; diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 2d48bcca5f1..206e5bc0244 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -285,8 +285,9 @@ void FossilPlugin::logCurrentFile() if (features.testFlag(FossilClient::TimelineWidthFeature)) extraOptions << "-W" << QString::number(m_client->settings().intValue(FossilSettings::timelineWidthKey)); - // annotate only supported for current revision, so disable context menu - bool enableAnnotationContextMenu = false; + // disable annotate context menu for older client versions, used to be supported for current revision only + bool enableAnnotationContextMenu = features.testFlag(FossilClient::AnnotateRevisionFeature); + m_client->logCurrentFile(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()), extraOptions, enableAnnotationContextMenu); } diff --git a/plugins/fossil/revisioninfo.cpp b/plugins/fossil/revisioninfo.cpp index a2392264a98..aeacfdc7c81 100644 --- a/plugins/fossil/revisioninfo.cpp +++ b/plugins/fossil/revisioninfo.cpp @@ -28,9 +28,14 @@ namespace Fossil { namespace Internal { -RevisionInfo::RevisionInfo(const QString &revisionId, const QString &parent) : +RevisionInfo::RevisionInfo(const QString &revisionId, const QString &parent, + const QStringList &mergeParents, const QString &comment, + const QString &user) : id(revisionId), - parentId(parent) + parentId(parent), + mergeParentIds(mergeParents), + commentMsg(comment), + committer(user) { } } // namespace Internal diff --git a/plugins/fossil/revisioninfo.h b/plugins/fossil/revisioninfo.h index 247b4504ef1..11cd4a74962 100644 --- a/plugins/fossil/revisioninfo.h +++ b/plugins/fossil/revisioninfo.h @@ -36,10 +36,15 @@ namespace Internal { class RevisionInfo { public: - explicit RevisionInfo(const QString &revisionId = QString(), const QString &parent = QString()); + explicit RevisionInfo(const QString &revisionId = QString(), const QString &parent = QString(), + const QStringList &mergeParents = QStringList(), + const QString &comment = QString(), const QString &user = QString()); const QString id; const QString parentId; + const QStringList mergeParentIds; + const QString commentMsg; + const QString committer; }; From d3998c6319e4f54a18d3627912dc97834f31ab9b Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 28 Aug 2018 00:05:48 +0300 Subject: [PATCH 018/133] Adapt to upstream VCS change Change-Id: I4097fb789a887e656d510a3fff67f5bf396a9a0a Reviewed-by: Tobias Hunger --- plugins/fossil/constants.h | 3 --- plugins/fossil/fossilplugin.cpp | 23 ----------------------- plugins/fossil/fossilplugin.h | 7 +------ 3 files changed, 1 insertion(+), 32 deletions(-) diff --git a/plugins/fossil/constants.h b/plugins/fossil/constants.h index e15a8e76db3..b1e6170b346 100644 --- a/plugins/fossil/constants.h +++ b/plugins/fossil/constants.h @@ -93,9 +93,6 @@ const char COMMIT[] = "Fossil.Action.Commit"; const char CONFIGURE_REPOSITORY[] = "Fossil.Action.Settings"; const char CREATE_REPOSITORY[] = "Fossil.Action.CreateRepository"; -//submit editor actions -const char DIFFEDITOR[] = "Fossil.Action.Editor.Diff"; - // File status hint const char FSTATUS_ADDED[] = "Added"; const char FSTATUS_ADDED_BY_MERGE[] = "Added by Merge"; diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 206e5bc0244..8ee4618073c 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -149,8 +149,6 @@ bool FossilPlugin::initialize(const QStringList &arguments, QString *errorMessag createMenu(context); - createSubmitEditorActions(); - Core::HelpManager::registerDocumentation({Core::ICore::documentationPath() + "/fossil.qch"}); @@ -529,26 +527,6 @@ void FossilPlugin::configureRepository() m_client->synchronousConfigureRepository(state.topLevel(), newSettings, currentSettings); } -void FossilPlugin::createSubmitEditorActions() -{ - Core::Context context(Constants::COMMIT_ID); - Core::Command *command; - - m_editorCommit = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this); - command = Core::ActionManager::registerAction(m_editorCommit, Constants::COMMIT, context); - command->setAttribute(Core::Command::CA_UpdateText); - connect(m_editorCommit, &QAction::triggered, this, &FossilPlugin::commitFromEditor); - - m_editorDiff = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this); - command = Core::ActionManager::registerAction(m_editorDiff, Constants::DIFFEDITOR, context); - - m_editorUndo = new QAction(tr("&Undo"), this); - command = Core::ActionManager::registerAction(m_editorUndo, Core::Constants::UNDO, context); - - m_editorRedo = new QAction(tr("&Redo"), this); - command = Core::ActionManager::registerAction(m_editorRedo, Core::Constants::REDO, context); -} - void FossilPlugin::commit() { if (!promptBeforeCommit()) @@ -615,7 +593,6 @@ void FossilPlugin::showCommitWidget(const QListsetFields(m_submitRepository, currentBranch, tags, currentUser, status); - commitEditor->registerActions(m_editorUndo, m_editorRedo, m_editorCommit, m_editorDiff); connect(commitEditor, &VcsBase::VcsBaseSubmitEditor::diffSelectedFiles, this, &FossilPlugin::diffFromEditorSelected); commitEditor->setCheckScriptWorkingDirectory(m_submitRepository); diff --git a/plugins/fossil/fossilplugin.h b/plugins/fossil/fossilplugin.h index 60e6c33845b..2a67cc628a3 100644 --- a/plugins/fossil/fossilplugin.h +++ b/plugins/fossil/fossilplugin.h @@ -91,13 +91,12 @@ private: void configureRepository(); void commit(); void showCommitWidget(const QList &status); - void commitFromEditor(); + void commitFromEditor() override; void diffFromEditorSelected(const QStringList &files); void createRepository(); // Methods void createMenu(const Core::Context &context); - void createSubmitEditorActions(); void createFileActions(const Core::Context &context); void createDirectoryActions(const Core::Context &context); void createRepositoryActions(const Core::Context &context); @@ -124,10 +123,6 @@ private: QAction *m_createRepositoryAction = nullptr; // Submit editor actions - QAction *m_editorCommit = nullptr; - QAction *m_editorDiff = nullptr; - QAction *m_editorUndo = nullptr; - QAction *m_editorRedo = nullptr; QAction *m_menuAction = nullptr; QString m_submitRepository; From bb6da94e5dc3d29b57690e9ead33e67ff56c513e Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 25 Jul 2018 23:48:26 +0300 Subject: [PATCH 019/133] Suppress command output on revision query This is an internal operation, no need to log it. Change-Id: Ic031454904437fd648579b1d0922d73ce2259f64 Reviewed-by: Artur Shepilko Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 8dbc225b34e..635f5a2a4b1 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -369,7 +369,8 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect if (!id.isEmpty()) args << id; - const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); + const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec( + workingDirectory, args, Utils::ShellCommand::SuppressCommandLogging); if (response.result != Utils::SynchronousProcessResponse::Finished) return RevisionInfo(); From 10cb61f3cff1f2300a4af2916eff8c27717fb347 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 25 Jul 2018 23:20:39 +0300 Subject: [PATCH 020/133] Fix build when using QTC_SOURCE environment variable It was supported in the subdir, but not in the root project Change-Id: I41e17881fde097d5d2f506efc0c7c9d3fd4817a8 Reviewed-by: Artur Shepilko Reviewed-by: Orgad Shaneh --- fossil.pro | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fossil.pro b/fossil.pro index 1a32b3373bd..629cd87c6fd 100644 --- a/fossil.pro +++ b/fossil.pro @@ -1,3 +1,9 @@ +isEmpty(IDE_SOURCE_TREE): IDE_SOURCE_TREE = $$(QTC_SOURCE) +isEmpty(IDE_SOURCE_TREE): error("You need to set the environment variable QTC_SOURCE to point to the directory where the Qt Creator sources are") + +isEmpty(IDE_BUILD_TREE): IDE_BUILD_TREE = $$(QTC_BUILD) +isEmpty(IDE_BUILD_TREE): error("You need to set the environment variable QTC_BUILD to point to the directory where Qt Creator was built") + TEMPLATE = subdirs SUBDIRS += plugins/fossil From 70e7cf36b46aea39ab6d548b2e627ea597a4c9a7 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 29 Aug 2018 22:58:07 +0300 Subject: [PATCH 021/133] Add .gitignore Change-Id: I9e9662e4b7995d75aad50c205545bc4ca95c9e20 Reviewed-by: Artur Shepilko Reviewed-by: Orgad Shaneh --- .gitignore | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000..85949dbd36e --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +/*.user* +.qmake.* +Makefile* +.moc/ +.obj/ +.rcc/ +.uic/ +/plugins/fossil/Fossil.json +/qdoc_wrapper.sh +/doc/fossil/ From c75bb148e8e0c77458914c543be1cbe00388d552 Mon Sep 17 00:00:00 2001 From: Artur Shepilko Date: Fri, 31 Aug 2018 14:14:27 -0500 Subject: [PATCH 022/133] Add Reload button to Log and Diff editors Change-Id: I524f114c2642a793a06c03e18c1eeab019209fd7 Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 635f5a2a4b1..343fe7fd47f 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include @@ -67,6 +68,7 @@ public: VcsBase::VcsBaseClientSettings &settings = client->settings(); FossilClient::SupportedFeatures features = client->supportedFeatures(); + addButton(tr("Reload"), Utils::Icons::RELOAD.icon()); if (features.testFlag(FossilClient::DiffIgnoreWhiteSpaceFeature)) { mapSetting(addToggleButton("-w", tr("Ignore All Whitespace")), settings.boolPointer(FossilSettings::diffIgnoreAllWhiteSpaceKey)); @@ -113,6 +115,8 @@ public: VcsBase::VcsBaseEditorConfig(toolBar) { QTC_ASSERT(client, return); + + addButton(tr("Reload"), Utils::Icons::RELOAD.icon()); } }; @@ -128,6 +132,7 @@ public: { QTC_ASSERT(client, return); + addButton(tr("Reload"), Utils::Icons::RELOAD.icon()); addLineageComboBox(); addVerboseToggleButton(); addItemTypeComboBox(); From 4d0a7377c0f749ba0a58bf4b996c8397fb2cb2c1 Mon Sep 17 00:00:00 2001 From: Artur Shepilko Date: Fri, 31 Aug 2018 15:49:18 -0500 Subject: [PATCH 023/133] Create a correct editor for 'Log Current File' - affects legacy versions of the fossil client Change-Id: I72a7eca4199fe3867fb82ff872d2bedecfd85ff3 Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 343fe7fd47f..4b0eb6ee4e2 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -1048,7 +1048,7 @@ void FossilClient::logCurrentFile(const QString &workingDir, const QStringList & fossilEditor->setFileLogAnnotateEnabled(enableAnnotationContextMenu); if (!fossilEditor->editorConfig()) { - if (VcsBase::VcsBaseEditorConfig *editorConfig = createLogEditor(fossilEditor)) { + if (VcsBase::VcsBaseEditorConfig *editorConfig = createLogCurrentFileEditor(fossilEditor)) { editorConfig->setBaseArguments(extraOptions); // editor has been just created, createVcsEditor() didn't set a configuration widget yet connect(editorConfig, &VcsBase::VcsBaseEditorConfig::commandExecutionRequested, From a155f69ca90657b6d8e042514b98a4c707ffe712 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Fri, 21 Sep 2018 11:39:50 +0300 Subject: [PATCH 024/133] Adapt to master Change-Id: Iee445c716469a4cc257c7eccc986a5e1d50411ff Reviewed-by: Eike Ziller --- plugins/fossil/fossilplugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 8ee4618073c..621e31a4d79 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -149,7 +149,7 @@ bool FossilPlugin::initialize(const QStringList &arguments, QString *errorMessag createMenu(context); - Core::HelpManager::registerDocumentation({Core::ICore::documentationPath() + Core::HelpManager::registerDocumentation({Core::HelpManager::documentationPath() + "/fossil.qch"}); return true; From a2a55674e353c81c7150eaadb57a4cd554ffe354 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 12 Feb 2019 23:23:21 +0100 Subject: [PATCH 025/133] Doc: Fix dependency to Qt Creator As Qt Creator now uses $IDE_DISPLAY_NAME as the doc project name, it expands to 'Qt Creator'. QDoc then constructs the index file name as 'qt-creator', hyphenating the space. Change-Id: Ib818fc1a94b1e65bc568f2552eb721a634e68d7e Reviewed-by: Leena Miettinen --- doc/config/fossil.qdocconf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/config/fossil.qdocconf b/doc/config/fossil.qdocconf index 98433df81dd..290023fba2d 100644 --- a/doc/config/fossil.qdocconf +++ b/doc/config/fossil.qdocconf @@ -10,7 +10,7 @@ include($$QTC_DOCS_DIR/config/qt-defines.qdocconf) sources.fileextensions = "*.qdoc" -depends += qtcreator +depends += qt-creator qhp.projects = fossil qhp.fossil.file = fossil.qhp From 5378134c2154dbd09140bf78c43a130f6fffe219 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 13 May 2019 16:05:28 +0200 Subject: [PATCH 026/133] Adapt to 4.9 Change-Id: I9c413eaf6d70eaf09640aed349c876c040ef55ba Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilcommitwidget.cpp | 7 +++++-- plugins/fossil/fossilcommitwidget.h | 2 +- plugins/fossil/fossilplugin.cpp | 6 ++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/plugins/fossil/fossilcommitwidget.cpp b/plugins/fossil/fossilcommitwidget.cpp index b6fa9bd9de6..73baf9e4c41 100644 --- a/plugins/fossil/fossilcommitwidget.cpp +++ b/plugins/fossil/fossilcommitwidget.cpp @@ -141,12 +141,15 @@ bool FossilCommitWidget::isPrivateOptionEnabled() const return m_commitPanelUi.isPrivateCheckBox->isChecked(); } -bool FossilCommitWidget::canSubmit() const +bool FossilCommitWidget::canSubmit(QString *whyNot) const { QString message = cleanupDescription(descriptionText()).trimmed(); - if (m_commitPanelUi.invalidBranchLabel->isVisible() || message.isEmpty()) + if (m_commitPanelUi.invalidBranchLabel->isVisible() || message.isEmpty()) { + if (whyNot) + *whyNot = tr("Message check failed."); return false; + } return VcsBase::SubmitEditorWidget::canSubmit(); } diff --git a/plugins/fossil/fossilcommitwidget.h b/plugins/fossil/fossilcommitwidget.h index 19d4220dad6..689eb4575a2 100644 --- a/plugins/fossil/fossilcommitwidget.h +++ b/plugins/fossil/fossilcommitwidget.h @@ -59,7 +59,7 @@ public: bool isPrivateOptionEnabled() const; protected: - bool canSubmit() const; + bool canSubmit(QString *whyNot = nullptr) const; private slots: void branchChanged(); diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 621e31a4d79..bdc16fbf5f9 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -663,10 +663,8 @@ bool FossilPlugin::submitEditorAboutToClose() QTC_ASSERT(editorDocument, return true); bool promptOnSubmit = false; - const VcsBase::VcsBaseSubmitEditor::PromptSubmitResult response = - commitEditor->promptSubmit(tr("Close Commit Editor"), tr("Do you want to commit the changes?"), - tr("Message check failed. Do you want to proceed?"), - &promptOnSubmit, !m_submitActionTriggered); + const VcsBase::VcsBaseSubmitEditor::PromptSubmitResult response + = commitEditor->promptSubmit(this, &promptOnSubmit, !m_submitActionTriggered); m_submitActionTriggered = false; switch (response) { From a1c0d912b273d6c5e902d97f9fbebee1fd8cae0b Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 13 May 2019 23:36:15 +0300 Subject: [PATCH 027/133] Adapt to master Change-Id: Ie1b9f937fe2daaaa2a181d28aec8ba065aff9e3f Reviewed-by: Eike Ziller --- plugins/fossil/fossilclient.cpp | 3 ++- plugins/fossil/fossilplugin.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 4b0eb6ee4e2..aea3fdd65f7 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -641,8 +641,9 @@ bool FossilClient::synchronousCreateRepository(const QString &workingDirectory, // @TODO: handle spaces in the path // @TODO: what about --template options? + const Utils::FileName fullRepoName = Utils::FileName::fromStringWithExtension(repoName, Constants::FOSSIL_FILE_SUFFIX); const Utils::FileName repoFilePath = Utils::FileName::fromString(repoPath) - .appendPath(Utils::FileName::fromString(repoName, Constants::FOSSIL_FILE_SUFFIX).toString()); + .appendPath(fullRepoName.toString()); QStringList args(vcsCommandString(CreateRepositoryCommand)); if (!adminUser.isEmpty()) args << "--admin-user" << adminUser; diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index bdc16fbf5f9..9d795b869ed 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -145,7 +145,7 @@ bool FossilPlugin::initialize(const QStringList &arguments, QString *errorMessag m_commandLocator = new Core::CommandLocator("Fossil", "fossil", "fossil", this); ProjectExplorer::JsonWizardFactory::addWizardPath(Utils::FileName::fromString(Constants::WIZARD_PATH)); - Core::JsExpander::registerQObjectForJs("Fossil", new FossilJsExtension); + Core::JsExpander::registerGlobalObject("Fossil"); createMenu(context); From adf0b8f87f9f36a93d5248465bb85d59883843b2 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 13 May 2019 23:40:00 +0300 Subject: [PATCH 028/133] FossilClient: De-noise Change-Id: I9129d1e542073c2454ed1758af1b8dfc06ba0e1a Reviewed-by: Eike Ziller --- plugins/fossil/fossilclient.cpp | 88 +++++++++++++++++---------------- 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index aea3fdd65f7..ec7bf98478b 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -51,6 +51,8 @@ #include #include +using namespace Utils; + namespace Fossil { namespace Internal { @@ -68,7 +70,7 @@ public: VcsBase::VcsBaseClientSettings &settings = client->settings(); FossilClient::SupportedFeatures features = client->supportedFeatures(); - addButton(tr("Reload"), Utils::Icons::RELOAD.icon()); + addButton(tr("Reload"), Icons::RELOAD.icon()); if (features.testFlag(FossilClient::DiffIgnoreWhiteSpaceFeature)) { mapSetting(addToggleButton("-w", tr("Ignore All Whitespace")), settings.boolPointer(FossilSettings::diffIgnoreAllWhiteSpaceKey)); @@ -116,7 +118,7 @@ public: { QTC_ASSERT(client, return); - addButton(tr("Reload"), Utils::Icons::RELOAD.icon()); + addButton(tr("Reload"), Icons::RELOAD.icon()); } }; @@ -132,7 +134,7 @@ public: { QTC_ASSERT(client, return); - addButton(tr("Reload"), Utils::Icons::RELOAD.icon()); + addButton(tr("Reload"), Icons::RELOAD.icon()); addLineageComboBox(); addVerboseToggleButton(); addItemTypeComboBox(); @@ -256,8 +258,8 @@ unsigned int FossilClient::synchronousBinaryVersion() const QStringList args("version"); - const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(QString(), args); - if (response.result != Utils::SynchronousProcessResponse::Finished) + const SynchronousProcessResponse response = vcsFullySynchronousExec(QString(), args); + if (response.result != SynchronousProcessResponse::Finished) return 0; QString output = response.stdOut(); @@ -294,8 +296,8 @@ BranchInfo FossilClient::synchronousCurrentBranch(const QString &workingDirector return BranchInfo(); // First try to get the current branch from the list of open branches - const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, {"branch", "list"}); - if (response.result != Utils::SynchronousProcessResponse::Finished) + const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, {"branch", "list"}); + if (response.result != SynchronousProcessResponse::Finished) return BranchInfo(); const QString output = sanitizeFossilOutput(response.stdOut()); @@ -305,8 +307,8 @@ BranchInfo FossilClient::synchronousCurrentBranch(const QString &workingDirector if (!currentBranch.isCurrent()) { // If not available from open branches, request it from the list of closed branches. - const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, {"branch", "list", "--closed"}); - if (response.result != Utils::SynchronousProcessResponse::Finished) + const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, {"branch", "list", "--closed"}); + if (response.result != SynchronousProcessResponse::Finished) return BranchInfo(); const QString output = sanitizeFossilOutput(response.stdOut()); @@ -327,8 +329,8 @@ QList FossilClient::synchronousBranchQuery(const QString &workingDir return QList(); // First get list of open branches - Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, {"branch", "list"}); - if (response.result != Utils::SynchronousProcessResponse::Finished) + SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, {"branch", "list"}); + if (response.result != SynchronousProcessResponse::Finished) return QList(); QString output = sanitizeFossilOutput(response.stdOut()); @@ -336,7 +338,7 @@ QList FossilClient::synchronousBranchQuery(const QString &workingDir // Append a list of closed branches. response = vcsFullySynchronousExec(workingDirectory, {"branch", "list", "--closed"}); - if (response.result != Utils::SynchronousProcessResponse::Finished) + if (response.result != SynchronousProcessResponse::Finished) return QList(); output = sanitizeFossilOutput(response.stdOut()); @@ -374,9 +376,9 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect if (!id.isEmpty()) args << id; - const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec( - workingDirectory, args, Utils::ShellCommand::SuppressCommandLogging); - if (response.result != Utils::SynchronousProcessResponse::Finished) + const SynchronousProcessResponse response = vcsFullySynchronousExec( + workingDirectory, args, ShellCommand::SuppressCommandLogging); + if (response.result != SynchronousProcessResponse::Finished) return RevisionInfo(); const QString output = sanitizeFossilOutput(response.stdOut()); @@ -436,8 +438,8 @@ QStringList FossilClient::synchronousTagQuery(const QString &workingDirectory, c if (!id.isEmpty()) args << id; - const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); - if (response.result != Utils::SynchronousProcessResponse::Finished) + const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); + if (response.result != SynchronousProcessResponse::Finished) return QStringList(); const QString output = sanitizeFossilOutput(response.stdOut()); @@ -458,8 +460,8 @@ RepositorySettings FossilClient::synchronousSettingsQuery(const QString &working const QStringList args("settings"); - const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); - if (response.result != Utils::SynchronousProcessResponse::Finished) + const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); + if (response.result != SynchronousProcessResponse::Finished) return RepositorySettings(); const QString output = sanitizeFossilOutput(response.stdOut()); @@ -512,8 +514,8 @@ bool FossilClient::synchronousSetSetting(const QString &workingDirectory, if (isGlobal) args << "--global"; - const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); - return (response.result == Utils::SynchronousProcessResponse::Finished); + const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); + return (response.result == SynchronousProcessResponse::Finished); } @@ -568,8 +570,8 @@ QString FossilClient::synchronousUserDefaultQuery(const QString &workingDirector const QStringList args({"user", "default"}); - const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); - if (response.result != Utils::SynchronousProcessResponse::Finished) + const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); + if (response.result != SynchronousProcessResponse::Finished) return QString(); QString output = sanitizeFossilOutput(response.stdOut()); @@ -584,8 +586,8 @@ bool FossilClient::synchronousSetUserDefault(const QString &workingDirectory, co // set repository-default user const QStringList args({"user", "default", userName, "--user", userName}); - const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); - return (response.result == Utils::SynchronousProcessResponse::Finished); + const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); + return (response.result == SynchronousProcessResponse::Finished); } QString FossilClient::synchronousGetRepositoryURL(const QString &workingDirectory) @@ -595,8 +597,8 @@ QString FossilClient::synchronousGetRepositoryURL(const QString &workingDirector const QStringList args("remote-url"); - const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); - if (response.result != Utils::SynchronousProcessResponse::Finished) + const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); + if (response.result != SynchronousProcessResponse::Finished) return QString(); QString output = sanitizeFossilOutput(response.stdOut()); @@ -641,15 +643,15 @@ bool FossilClient::synchronousCreateRepository(const QString &workingDirectory, // @TODO: handle spaces in the path // @TODO: what about --template options? - const Utils::FileName fullRepoName = Utils::FileName::fromStringWithExtension(repoName, Constants::FOSSIL_FILE_SUFFIX); - const Utils::FileName repoFilePath = Utils::FileName::fromString(repoPath) + const FileName fullRepoName = FileName::fromStringWithExtension(repoName, Constants::FOSSIL_FILE_SUFFIX); + const FileName repoFilePath = FileName::fromString(repoPath) .appendPath(fullRepoName.toString()); QStringList args(vcsCommandString(CreateRepositoryCommand)); if (!adminUser.isEmpty()) args << "--admin-user" << adminUser; args << extraOptions << repoFilePath.toUserOutput(); - Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); - if (response.result != Utils::SynchronousProcessResponse::Finished) + SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); + if (response.result != SynchronousProcessResponse::Finished) return false; QString output = sanitizeFossilOutput(response.stdOut()); @@ -663,7 +665,7 @@ bool FossilClient::synchronousCreateRepository(const QString &workingDirectory, args << "open" << repoFilePath.toUserOutput(); response = vcsFullySynchronousExec(workingDirectory, args); - if (response.result != Utils::SynchronousProcessResponse::Finished) + if (response.result != SynchronousProcessResponse::Finished) return false; output = sanitizeFossilOutput(response.stdOut()); @@ -678,7 +680,7 @@ bool FossilClient::synchronousCreateRepository(const QString &workingDirectory, args << "user" << "default" << adminUser << "--user" << adminUser; response = vcsFullySynchronousExec(workingDirectory, args); - if (response.result != Utils::SynchronousProcessResponse::Finished) + if (response.result != SynchronousProcessResponse::Finished) return false; QString output = sanitizeFossilOutput(response.stdOut()); @@ -703,8 +705,8 @@ bool FossilClient::synchronousMove(const QString &workingDir, QStringList args(vcsCommandString(MoveCommand)); args << extraOptions << from << to; - const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDir, args); - return (response.result == Utils::SynchronousProcessResponse::Finished); + const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDir, args); + return (response.result == SynchronousProcessResponse::Finished); } bool FossilClient::synchronousPull(const QString &workingDir, const QString &srcLocation, const QStringList &extraOptions) @@ -720,8 +722,8 @@ bool FossilClient::synchronousPull(const QString &workingDir, const QString &src VcsBase::VcsCommand::SshPasswordPrompt | VcsBase::VcsCommand::ShowStdOut | VcsBase::VcsCommand::ShowSuccessMessage; - const Utils::SynchronousProcessResponse resp = vcsSynchronousExec(workingDir, args, flags); - const bool success = (resp.result == Utils::SynchronousProcessResponse::Finished); + const SynchronousProcessResponse resp = vcsSynchronousExec(workingDir, args, flags); + const bool success = (resp.result == SynchronousProcessResponse::Finished); if (success) emit changed(QVariant(workingDir)); return success; @@ -740,8 +742,8 @@ bool FossilClient::synchronousPush(const QString &workingDir, const QString &dst VcsBase::VcsCommand::SshPasswordPrompt | VcsBase::VcsCommand::ShowStdOut | VcsBase::VcsCommand::ShowSuccessMessage; - const Utils::SynchronousProcessResponse resp = vcsSynchronousExec(workingDir, args, flags); - return (resp.result == Utils::SynchronousProcessResponse::Finished); + const SynchronousProcessResponse resp = vcsSynchronousExec(workingDir, args, flags); + return (resp.result == SynchronousProcessResponse::Finished); } void FossilClient::commit(const QString &repositoryRoot, const QStringList &files, @@ -812,12 +814,12 @@ VcsBase::VcsBaseEditorWidget *FossilClient::annotate( return fossilEditor; } -bool FossilClient::isVcsFileOrDirectory(const Utils::FileName &fileName) const +bool FossilClient::isVcsFileOrDirectory(const FileName &fileName) const { // false for any dir or file other than fossil checkout db-file return fileName.toFileInfo().isFile() && !fileName.fileName().compare(Constants::FOSSILREPO, - Utils::HostOsInfo::fileNameCaseSensitivity()); + HostOsInfo::fileNameCaseSensitivity()); } QString FossilClient::findTopLevelForFile(const QFileInfo &file) const @@ -833,8 +835,8 @@ QString FossilClient::findTopLevelForFile(const QFileInfo &file) const bool FossilClient::managesFile(const QString &workingDirectory, const QString &fileName) const { const QStringList args({"finfo", fileName}); - const Utils::SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); - if (response.result != Utils::SynchronousProcessResponse::Finished) + const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); + if (response.result != SynchronousProcessResponse::Finished) return false; QString output = sanitizeFossilOutput(response.stdOut()); return !output.startsWith("no history for file", Qt::CaseInsensitive); From 18841cc0f5c5d74f2830510a454f71350561e6a1 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 29 May 2019 10:04:47 +0200 Subject: [PATCH 029/133] Adapt to upstream FileName changes Change-Id: I5b2a3ec17024fdc569df0c65f8d48564d5a3afea Reviewed-by: hjk Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 12 ++++++------ plugins/fossil/fossilclient.h | 2 +- plugins/fossil/fossilcontrol.cpp | 20 ++++++++++---------- plugins/fossil/fossilcontrol.h | 4 ++-- plugins/fossil/fossilplugin.cpp | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index ec7bf98478b..5b5910429f9 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -643,9 +643,9 @@ bool FossilClient::synchronousCreateRepository(const QString &workingDirectory, // @TODO: handle spaces in the path // @TODO: what about --template options? - const FileName fullRepoName = FileName::fromStringWithExtension(repoName, Constants::FOSSIL_FILE_SUFFIX); - const FileName repoFilePath = FileName::fromString(repoPath) - .appendPath(fullRepoName.toString()); + const FilePath fullRepoName = FilePath::fromStringWithExtension(repoName, Constants::FOSSIL_FILE_SUFFIX); + const FilePath repoFilePath = FilePath::fromString(repoPath) + .pathAppended(fullRepoName.toString()); QStringList args(vcsCommandString(CreateRepositoryCommand)); if (!adminUser.isEmpty()) args << "--admin-user" << adminUser; @@ -814,11 +814,11 @@ VcsBase::VcsBaseEditorWidget *FossilClient::annotate( return fossilEditor; } -bool FossilClient::isVcsFileOrDirectory(const FileName &fileName) const +bool FossilClient::isVcsFileOrDirectory(const FilePath &filePath) const { // false for any dir or file other than fossil checkout db-file - return fileName.toFileInfo().isFile() - && !fileName.fileName().compare(Constants::FOSSILREPO, + return filePath.toFileInfo().isFile() + && !filePath.fileName().compare(Constants::FOSSILREPO, HostOsInfo::fileNameCaseSensitivity()); } diff --git a/plugins/fossil/fossilclient.h b/plugins/fossil/fossilclient.h index 3b0a414b583..2d35a861f9e 100644 --- a/plugins/fossil/fossilclient.h +++ b/plugins/fossil/fossilclient.h @@ -105,7 +105,7 @@ public: const QStringList &extraOptions = QStringList()) final; void revertAll(const QString &workingDir, const QString &revision = QString(), const QStringList &extraOptions = QStringList()) final; - bool isVcsFileOrDirectory(const Utils::FileName &fileName) const; + bool isVcsFileOrDirectory(const Utils::FilePath &filePath) const; QString findTopLevelForFile(const QFileInfo &file) const final; bool managesFile(const QString &workingDirectory, const QString &fileName) const; unsigned int binaryVersion() const; diff --git a/plugins/fossil/fossilcontrol.cpp b/plugins/fossil/fossilcontrol.cpp index 98b2ea8a532..20df6825daa 100644 --- a/plugins/fossil/fossilcontrol.cpp +++ b/plugins/fossil/fossilcontrol.cpp @@ -81,9 +81,9 @@ Core::Id FossilControl::id() const return Core::Id(Constants::VCS_ID_FOSSIL); } -bool FossilControl::isVcsFileOrDirectory(const Utils::FileName &fileName) const +bool FossilControl::isVcsFileOrDirectory(const Utils::FilePath &filePath) const { - return m_client->isVcsFileOrDirectory(fileName); + return m_client->isVcsFileOrDirectory(filePath); } bool FossilControl::managesDirectory(const QString &directory, QString *topLevel) const @@ -102,7 +102,7 @@ bool FossilControl::managesFile(const QString &workingDirectory, const QString & bool FossilControl::isConfigured() const { - const Utils::FileName binary = m_client->vcsBinary(); + const Utils::FilePath binary = m_client->vcsBinary(); if (binary.isEmpty()) return false; @@ -181,7 +181,7 @@ bool FossilControl::vcsAnnotate(const QString &file, int line) } Core::ShellCommand *FossilControl::createInitialCheckoutCommand(const QString &sourceUrl, - const Utils::FileName &baseDirectory, + const Utils::FilePath &baseDirectory, const QString &localName, const QStringList &extraArgs) { @@ -199,11 +199,11 @@ Core::ShellCommand *FossilControl::createInitialCheckoutCommand(const QString &s // -- open/checkout an existing local fossil // Clone URL is an absolute local path and is the same as the local fossil. - const QString checkoutPath = Utils::FileName(baseDirectory).appendPath(localName).toString(); + const QString checkoutPath = baseDirectory.pathAppended(localName).toString(); const QString fossilFile = options.value("fossil-file"); - const Utils::FileName fossilFileName = Utils::FileName::fromUserInput(QDir::fromNativeSeparators(fossilFile)); - const QString fossilFileNative = fossilFileName.toUserOutput(); - const QFileInfo cloneRepository(fossilFileName.toString()); + const Utils::FilePath fossilFilePath = Utils::FilePath::fromUserInput(QDir::fromNativeSeparators(fossilFile)); + const QString fossilFileNative = fossilFilePath.toUserOutput(); + const QFileInfo cloneRepository(fossilFilePath.toString()); // Check when requested to clone a local repository and clone-into repository file is the same // or not specified. @@ -235,14 +235,14 @@ Core::ShellCommand *FossilControl::createInitialCheckoutCommand(const QString &s && !cloneRepository.exists()) { const QString sslIdentityFile = options.value("ssl-identity"); - const Utils::FileName sslIdentityFileName = Utils::FileName::fromUserInput(QDir::fromNativeSeparators(sslIdentityFile)); + const Utils::FilePath sslIdentityFilePath = Utils::FilePath::fromUserInput(QDir::fromNativeSeparators(sslIdentityFile)); const bool includePrivate = (options.value("include-private") == "true"); QStringList extraOptions; if (includePrivate) extraOptions << "--private"; if (!sslIdentityFile.isEmpty()) - extraOptions << "--ssl-identity" << sslIdentityFileName.toUserOutput(); + extraOptions << "--ssl-identity" << sslIdentityFilePath.toUserOutput(); if (!adminUser.isEmpty()) extraOptions << "--admin-user" << adminUser; diff --git a/plugins/fossil/fossilcontrol.h b/plugins/fossil/fossilcontrol.h index 1fb1f58fca1..072d73c6d64 100644 --- a/plugins/fossil/fossilcontrol.h +++ b/plugins/fossil/fossilcontrol.h @@ -48,7 +48,7 @@ public: QString displayName() const final; Core::Id id() const final; - bool isVcsFileOrDirectory(const Utils::FileName &fileName) const final; + bool isVcsFileOrDirectory(const Utils::FilePath &filePath) const final; bool managesDirectory(const QString &filename, QString *topLevel = 0) const final; bool managesFile(const QString &workingDirectory, const QString &fileName) const final; bool isConfigured() const final; @@ -60,7 +60,7 @@ public: bool vcsCreateRepository(const QString &directory) final; bool vcsAnnotate(const QString &file, int line) final; Core::ShellCommand *createInitialCheckoutCommand(const QString &sourceUrl, - const Utils::FileName &baseDirectory, + const Utils::FilePath &baseDirectory, const QString &localName, const QStringList &extraArgs) final; diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 9d795b869ed..8def0f720e0 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -144,7 +144,7 @@ bool FossilPlugin::initialize(const QStringList &arguments, QString *errorMessag m_commandLocator = new Core::CommandLocator("Fossil", "fossil", "fossil", this); - ProjectExplorer::JsonWizardFactory::addWizardPath(Utils::FileName::fromString(Constants::WIZARD_PATH)); + ProjectExplorer::JsonWizardFactory::addWizardPath(Utils::FilePath::fromString(Constants::WIZARD_PATH)); Core::JsExpander::registerGlobalObject("Fossil"); createMenu(context); From 06a392feb419b85f03546ac77a39cb22700dd25a Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 19 Aug 2019 09:24:44 +0200 Subject: [PATCH 030/133] Add cmake build files Change-Id: I07353d37163807b9799d8336a9294a2bb99eaf6c Reviewed-by: Cristian Adam Reviewed-by: Alessandro Portale --- CMakeLists.txt | 10 ++++++++++ plugins/fossil/CMakeLists.txt | 27 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 plugins/fossil/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000000..2e5a9a5b903 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.9) + +project(Fossil) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_CXX_STANDARD 14) + +add_subdirectory(plugins/fossil) diff --git a/plugins/fossil/CMakeLists.txt b/plugins/fossil/CMakeLists.txt new file mode 100644 index 00000000000..d60bb19df55 --- /dev/null +++ b/plugins/fossil/CMakeLists.txt @@ -0,0 +1,27 @@ +find_package(QtCreator COMPONENTS Core TextEditor ProjectExplorer VcsBase REQUIRED) +find_package(Qt5 COMPONENTS Widgets REQUIRED) + +add_qtc_plugin(Fossil + PLUGIN_DEPENDS + QtCreator::Core QtCreator::TextEditor QtCreator::ProjectExplorer QtCreator::VcsBase + DEPENDS Qt5::Widgets QtCreator::ExtensionSystem QtCreator::Utils + SOURCES + annotationhighlighter.cpp annotationhighlighter.h + branchinfo.cpp branchinfo.h + commiteditor.cpp commiteditor.h + configuredialog.cpp configuredialog.h configuredialog.ui + constants.h + fossil.qrc + fossilclient.cpp fossilclient.h + fossilcommitpanel.ui + fossilcommitwidget.cpp fossilcommitwidget.h + fossilcontrol.cpp fossilcontrol.h + fossileditor.cpp fossileditor.h + fossilplugin.cpp fossilplugin.h + fossilsettings.cpp fossilsettings.h + optionspage.cpp optionspage.h optionspage.ui + pullorpushdialog.cpp pullorpushdialog.h pullorpushdialog.ui + revertdialog.ui + revisioninfo.cpp revisioninfo.h + wizard/fossiljsextension.cpp wizard/fossiljsextension.h +) From 6296335bf98d515ad97bc86027969873835cf075 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 23 Oct 2019 10:57:35 +0200 Subject: [PATCH 031/133] Adapt to changes in 4.11 Change-Id: Ie02d61ecdb1a636ca4d21b1e5b09bde530c1fdca Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilcontrol.cpp | 8 ++++---- plugins/fossil/fossilplugin.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/fossil/fossilcontrol.cpp b/plugins/fossil/fossilcontrol.cpp index 20df6825daa..a914078e536 100644 --- a/plugins/fossil/fossilcontrol.cpp +++ b/plugins/fossil/fossilcontrol.cpp @@ -265,7 +265,7 @@ Core::ShellCommand *FossilControl::createInitialCheckoutCommand(const QString &s << extraOptions << sourceUrl << fossilFileNative; - command->addJob(m_client->vcsBinary(), args, -1); + command->addJob({m_client->vcsBinary(), args}, -1); } // check out the cloned repository file into the working copy directory; @@ -274,20 +274,20 @@ Core::ShellCommand *FossilControl::createInitialCheckoutCommand(const QString &s QStringList args({"open", fossilFileNative}); if (!checkoutBranch.isEmpty()) args << checkoutBranch; - command->addJob(m_client->vcsBinary(), args, -1); + command->addJob({m_client->vcsBinary(), args}, -1); // set user default to admin user if specified if (!isLocalRepository && !adminUser.isEmpty()) { const QStringList args({ "user", "default", adminUser, "--user", adminUser}); - command->addJob(m_client->vcsBinary(), args, -1); + command->addJob({m_client->vcsBinary(), args}, -1); } // turn-off autosync if requested if (!isLocalRepository && disableAutosync) { const QStringList args({"settings", "autosync", "off"}); - command->addJob(m_client->vcsBinary(), args, -1); + command->addJob({m_client->vcsBinary(), args}, -1); } return command; diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 8def0f720e0..e849caf1c64 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -617,7 +617,7 @@ void FossilPlugin::createRepository() // Find current starting directory QString directory; if (const ProjectExplorer::Project *currentProject = ProjectExplorer::ProjectTree::currentProject()) - directory = currentProject->document()->filePath().toFileInfo().absolutePath(); + directory = currentProject->projectDirectory().toString(); // Prompt for a directory that is not under version control yet QWidget *mw = Core::ICore::mainWindow(); do { From b418e205cf3661a491afa5f608a612dee316141b Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 19 Dec 2019 15:13:45 +0100 Subject: [PATCH 032/133] Adapt to upstream changes Change-Id: I105277aba8e7d897ed65f8bba4cd803091046212 Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 7 +++---- plugins/fossil/pullorpushdialog.cpp | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 5b5910429f9..7e7fe80a8c5 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -70,7 +70,7 @@ public: VcsBase::VcsBaseClientSettings &settings = client->settings(); FossilClient::SupportedFeatures features = client->supportedFeatures(); - addButton(tr("Reload"), Icons::RELOAD.icon()); + addReloadButton(); if (features.testFlag(FossilClient::DiffIgnoreWhiteSpaceFeature)) { mapSetting(addToggleButton("-w", tr("Ignore All Whitespace")), settings.boolPointer(FossilSettings::diffIgnoreAllWhiteSpaceKey)); @@ -117,8 +117,7 @@ public: VcsBase::VcsBaseEditorConfig(toolBar) { QTC_ASSERT(client, return); - - addButton(tr("Reload"), Icons::RELOAD.icon()); + addReloadButton(); } }; @@ -134,7 +133,7 @@ public: { QTC_ASSERT(client, return); - addButton(tr("Reload"), Icons::RELOAD.icon()); + addReloadButton(); addLineageComboBox(); addVerboseToggleButton(); addItemTypeComboBox(); diff --git a/plugins/fossil/pullorpushdialog.cpp b/plugins/fossil/pullorpushdialog.cpp index 4977c9013ba..f9fda3cdb65 100644 --- a/plugins/fossil/pullorpushdialog.cpp +++ b/plugins/fossil/pullorpushdialog.cpp @@ -91,7 +91,7 @@ void PullOrPushDialog::setDefaultRemoteLocation(const QString &url) void PullOrPushDialog::setLocalBaseDirectory(const QString &dir) { - m_ui->localPathChooser->setBaseDirectory(dir); + m_ui->localPathChooser->setBaseDirectory(Utils::FilePath::fromString(dir)); } void PullOrPushDialog::changeEvent(QEvent *e) From b6f137afef222bfde9b13f1685cde9737f4c5a2b Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 27 Jan 2020 22:46:18 +0200 Subject: [PATCH 033/133] Adapt to upstream changes Change-Id: Ibdbd3abcfd65b091744451830625e2135c6573d9 Reviewed-by: hjk --- plugins/fossil/fossilclient.cpp | 8 +- plugins/fossil/fossilclient.h | 2 +- plugins/fossil/fossileditor.cpp | 4 +- plugins/fossil/fossilplugin.cpp | 130 +++++++++++--------- plugins/fossil/fossilplugin.h | 24 ++-- plugins/fossil/optionspage.cpp | 80 +++++++----- plugins/fossil/optionspage.h | 26 +--- plugins/fossil/wizard/fossiljsextension.cpp | 2 +- 8 files changed, 147 insertions(+), 129 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 7e7fe80a8c5..092cd566a7c 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -243,7 +243,7 @@ QString FossilClient::makeVersionString(unsigned version) .arg(versionPart(version)); } -FossilClient::FossilClient() : VcsBase::VcsBaseClient(new FossilSettings) +FossilClient::FossilClient(FossilSettings *settings) : VcsBase::VcsBaseClient(settings) { setDiffConfigCreator([this](QToolBar *toolBar) { return new FossilDiffConfig(this, toolBar); @@ -825,10 +825,8 @@ QString FossilClient::findTopLevelForFile(const QFileInfo &file) const { const QString repositoryCheckFile = Constants::FOSSILREPO; return file.isDir() ? - VcsBase::VcsBasePlugin::findRepositoryForDirectory(file.absoluteFilePath(), - repositoryCheckFile) : - VcsBase::VcsBasePlugin::findRepositoryForDirectory(file.absolutePath(), - repositoryCheckFile); + VcsBase::findRepositoryForDirectory(file.absoluteFilePath(), repositoryCheckFile) : + VcsBase::findRepositoryForDirectory(file.absolutePath(), repositoryCheckFile); } bool FossilClient::managesFile(const QString &workingDirectory, const QString &fileName) const diff --git a/plugins/fossil/fossilclient.h b/plugins/fossil/fossilclient.h index 2d35a861f9e..19007789da2 100644 --- a/plugins/fossil/fossilclient.h +++ b/plugins/fossil/fossilclient.h @@ -61,7 +61,7 @@ public: static unsigned makeVersionNumber(int major, int minor, int patch); static QString makeVersionString(unsigned version); - FossilClient(); + explicit FossilClient(FossilSettings *settings); unsigned int synchronousBinaryVersion() const; BranchInfo synchronousCurrentBranch(const QString &workingDirectory); diff --git a/plugins/fossil/fossileditor.cpp b/plugins/fossil/fossileditor.cpp index 74a7c8697a9..e01a95397a9 100644 --- a/plugins/fossil/fossileditor.cpp +++ b/plugins/fossil/fossileditor.cpp @@ -131,7 +131,7 @@ QString FossilEditorWidget::decorateVersion(const QString &revision) const const QFileInfo fi(source()); const QString workingDirectory = fi.absolutePath(); - FossilClient *client = FossilPlugin::instance()->client(); + FossilClient *client = FossilPluginPrivate::instance()->client(); RevisionInfo revisionInfo = client->synchronousRevisionQuery(workingDirectory, revision, true); @@ -153,7 +153,7 @@ QStringList FossilEditorWidget::annotationPreviousVersions(const QString &revisi QStringList revisions; const QFileInfo fi(source()); const QString workingDirectory = fi.absolutePath(); - FossilClient *client = FossilPlugin::instance()->client(); + FossilClient *client = FossilPluginPrivate::instance()->client(); RevisionInfo revisionInfo = client->synchronousRevisionQuery(workingDirectory, revision); if (revisionInfo.parentId.isEmpty()) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index e849caf1c64..c2fe8b9a1e8 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -103,18 +103,18 @@ static const VcsBase::VcsBaseSubmitEditorParameters submitEditorParameters = { }; -FossilPlugin *FossilPlugin::m_instance = nullptr; +static FossilPluginPrivate *dd = nullptr; -FossilPlugin::FossilPlugin() +FossilPluginPrivate::~FossilPluginPrivate() { - m_instance = this; + delete m_client; + m_client = nullptr; } FossilPlugin::~FossilPlugin() { - delete m_client; - m_client = nullptr; - m_instance = nullptr; + delete dd; + dd = nullptr; } bool FossilPlugin::initialize(const QStringList &arguments, QString *errorMessage) @@ -122,13 +122,25 @@ bool FossilPlugin::initialize(const QStringList &arguments, QString *errorMessag Q_UNUSED(arguments); Q_UNUSED(errorMessage); + dd = new FossilPluginPrivate; + return true; +} + +void FossilPlugin::extensionsInitialized() +{ + dd->extensionsInitialized(); +} + +FossilPluginPrivate::FossilPluginPrivate() +{ Core::Context context(Constants::FOSSIL_CONTEXT); - m_client = new FossilClient; - auto vcsCtrl = initializeVcs(context, m_client); + m_client = new FossilClient(&m_fossilSettings); + auto vcsCtrl = new FossilControl(m_client); + initializeVcs(vcsCtrl, context); connect(m_client, &VcsBase::VcsBaseClient::changed, vcsCtrl, &FossilControl::changed); - new OptionsPage(vcsCtrl, this); + new OptionsPage(vcsCtrl, &m_fossilSettings, this); const auto describeFunc = [this](const QString &source, const QString &id) { m_client->view(source, id); @@ -151,22 +163,20 @@ bool FossilPlugin::initialize(const QStringList &arguments, QString *errorMessag Core::HelpManager::registerDocumentation({Core::HelpManager::documentationPath() + "/fossil.qch"}); - - return true; } -FossilPlugin *FossilPlugin::instance() +FossilPluginPrivate *FossilPluginPrivate::instance() { - return m_instance; + return dd; } -FossilClient *FossilPlugin::client() const +FossilClient *FossilPluginPrivate::client() const { return m_client; } -void FossilPlugin::createMenu(const Core::Context &context) +void FossilPluginPrivate::createMenu(const Core::Context &context) { // Create menu item for Fossil m_fossilContainer = Core::ActionManager::createMenu("Fossil.FossilMenu"); @@ -186,14 +196,14 @@ void FossilPlugin::createMenu(const Core::Context &context) m_menuAction = m_fossilContainer->menu()->menuAction(); } -void FossilPlugin::createFileActions(const Core::Context &context) +void FossilPluginPrivate::createFileActions(const Core::Context &context) { Core::Command *command; m_annotateFile = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = Core::ActionManager::registerAction(m_annotateFile, Constants::ANNOTATE, context); command->setAttribute(Core::Command::CA_UpdateText); - connect(m_annotateFile, &QAction::triggered, this, &FossilPlugin::annotateCurrentFile); + connect(m_annotateFile, &QAction::triggered, this, &FossilPluginPrivate::annotateCurrentFile); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); @@ -201,7 +211,7 @@ void FossilPlugin::createFileActions(const Core::Context &context) command = Core::ActionManager::registerAction(m_diffFile, Constants::DIFF, context); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+I,Meta+D") : tr("ALT+I,Alt+D"))); - connect(m_diffFile, &QAction::triggered, this, &FossilPlugin::diffCurrentFile); + connect(m_diffFile, &QAction::triggered, this, &FossilPluginPrivate::diffCurrentFile); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); @@ -209,7 +219,7 @@ void FossilPlugin::createFileActions(const Core::Context &context) command = Core::ActionManager::registerAction(m_logFile, Constants::LOG, context); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+I,Meta+L") : tr("ALT+I,Alt+L"))); - connect(m_logFile, &QAction::triggered, this, &FossilPlugin::logCurrentFile); + connect(m_logFile, &QAction::triggered, this, &FossilPluginPrivate::logCurrentFile); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); @@ -217,7 +227,7 @@ void FossilPlugin::createFileActions(const Core::Context &context) command = Core::ActionManager::registerAction(m_statusFile, Constants::STATUS, context); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+I,Meta+S") : tr("ALT+I,Alt+S"))); - connect(m_statusFile, &QAction::triggered, this, &FossilPlugin::statusCurrentFile); + connect(m_statusFile, &QAction::triggered, this, &FossilPluginPrivate::statusCurrentFile); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); @@ -226,38 +236,38 @@ void FossilPlugin::createFileActions(const Core::Context &context) m_addAction = new Utils::ParameterAction(tr("Add Current File"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = Core::ActionManager::registerAction(m_addAction, Constants::ADD, context); command->setAttribute(Core::Command::CA_UpdateText); - connect(m_addAction, &QAction::triggered, this, &FossilPlugin::addCurrentFile); + connect(m_addAction, &QAction::triggered, this, &FossilPluginPrivate::addCurrentFile); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); m_deleteAction = new Utils::ParameterAction(tr("Delete Current File..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this); command = Core::ActionManager::registerAction(m_deleteAction, Constants::DELETE, context); command->setAttribute(Core::Command::CA_UpdateText); - connect(m_deleteAction, &QAction::triggered, this, &FossilPlugin::deleteCurrentFile); + connect(m_deleteAction, &QAction::triggered, this, &FossilPluginPrivate::deleteCurrentFile); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); m_revertFile = new Utils::ParameterAction(tr("Revert Current File..."), tr("Revert \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this); command = Core::ActionManager::registerAction(m_revertFile, Constants::REVERT, context); command->setAttribute(Core::Command::CA_UpdateText); - connect(m_revertFile, &QAction::triggered, this, &FossilPlugin::revertCurrentFile); + connect(m_revertFile, &QAction::triggered, this, &FossilPluginPrivate::revertCurrentFile); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); } -void FossilPlugin::addCurrentFile() +void FossilPluginPrivate::addCurrentFile() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasFile(), return); m_client->synchronousAdd(state.currentFileTopLevel(), state.relativeCurrentFile()); } -void FossilPlugin::deleteCurrentFile() +void FossilPluginPrivate::deleteCurrentFile() { promptToDeleteCurrentFile(); } -void FossilPlugin::annotateCurrentFile() +void FossilPluginPrivate::annotateCurrentFile() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasFile(), return); @@ -265,14 +275,14 @@ void FossilPlugin::annotateCurrentFile() m_client->annotate(state.currentFileTopLevel(), state.relativeCurrentFile(), QString(), lineNumber); } -void FossilPlugin::diffCurrentFile() +void FossilPluginPrivate::diffCurrentFile() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasFile(), return); m_client->diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile())); } -void FossilPlugin::logCurrentFile() +void FossilPluginPrivate::logCurrentFile() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasFile(), return); @@ -290,7 +300,7 @@ void FossilPlugin::logCurrentFile() extraOptions, enableAnnotationContextMenu); } -void FossilPlugin::revertCurrentFile() +void FossilPluginPrivate::revertCurrentFile() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasFile(), return); @@ -305,14 +315,14 @@ void FossilPlugin::revertCurrentFile() revertUi.revisionLineEdit->text()); } -void FossilPlugin::statusCurrentFile() +void FossilPluginPrivate::statusCurrentFile() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasFile(), return); m_client->status(state.currentFileTopLevel(), state.relativeCurrentFile()); } -void FossilPlugin::createDirectoryActions(const Core::Context &context) +void FossilPluginPrivate::createDirectoryActions(const Core::Context &context) { QAction *action; Core::Command *command; @@ -320,7 +330,7 @@ void FossilPlugin::createDirectoryActions(const Core::Context &context) action = new QAction(tr("Diff"), this); m_repositoryActionList.append(action); command = Core::ActionManager::registerAction(action, Constants::DIFFMULTI, context); - connect(action, &QAction::triggered, this, &FossilPlugin::diffRepository); + connect(action, &QAction::triggered, this, &FossilPluginPrivate::diffRepository); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); @@ -328,34 +338,34 @@ void FossilPlugin::createDirectoryActions(const Core::Context &context) m_repositoryActionList.append(action); command = Core::ActionManager::registerAction(action, Constants::LOGMULTI, context); command->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+I,Meta+T") : tr("ALT+I,Alt+T"))); - connect(action, &QAction::triggered, this, &FossilPlugin::logRepository); + connect(action, &QAction::triggered, this, &FossilPluginPrivate::logRepository); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Revert..."), this); m_repositoryActionList.append(action); command = Core::ActionManager::registerAction(action, Constants::REVERTMULTI, context); - connect(action, &QAction::triggered, this, &FossilPlugin::revertAll); + connect(action, &QAction::triggered, this, &FossilPluginPrivate::revertAll); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Status"), this); m_repositoryActionList.append(action); command = Core::ActionManager::registerAction(action, Constants::STATUSMULTI, context); - connect(action, &QAction::triggered, this, &FossilPlugin::statusMulti); + connect(action, &QAction::triggered, this, &FossilPluginPrivate::statusMulti); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); } -void FossilPlugin::diffRepository() +void FossilPluginPrivate::diffRepository() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return); m_client->diff(state.topLevel()); } -void FossilPlugin::logRepository() +void FossilPluginPrivate::logRepository() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return); @@ -369,7 +379,7 @@ void FossilPlugin::logRepository() m_client->log(state.topLevel(), QStringList(), extraOptions); } -void FossilPlugin::revertAll() +void FossilPluginPrivate::revertAll() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return); @@ -382,14 +392,14 @@ void FossilPlugin::revertAll() m_client->revertAll(state.topLevel(), revertUi.revisionLineEdit->text()); } -void FossilPlugin::statusMulti() +void FossilPluginPrivate::statusMulti() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return); m_client->status(state.topLevel()); } -void FossilPlugin::createRepositoryActions(const Core::Context &context) +void FossilPluginPrivate::createRepositoryActions(const Core::Context &context) { QAction *action = 0; Core::Command *command = 0; @@ -397,14 +407,14 @@ void FossilPlugin::createRepositoryActions(const Core::Context &context) action = new QAction(tr("Pull..."), this); m_repositoryActionList.append(action); command = Core::ActionManager::registerAction(action, Constants::PULL, context); - connect(action, &QAction::triggered, this, &FossilPlugin::pull); + connect(action, &QAction::triggered, this, &FossilPluginPrivate::pull); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Push..."), this); m_repositoryActionList.append(action); command = Core::ActionManager::registerAction(action, Constants::PUSH, context); - connect(action, &QAction::triggered, this, &FossilPlugin::push); + connect(action, &QAction::triggered, this, &FossilPluginPrivate::push); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); @@ -412,7 +422,7 @@ void FossilPlugin::createRepositoryActions(const Core::Context &context) m_repositoryActionList.append(action); command = Core::ActionManager::registerAction(action, Constants::UPDATE, context); command->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+I,Meta+U") : tr("ALT+I,Alt+U"))); - connect(action, &QAction::triggered, this, &FossilPlugin::update); + connect(action, &QAction::triggered, this, &FossilPluginPrivate::update); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); @@ -420,14 +430,14 @@ void FossilPlugin::createRepositoryActions(const Core::Context &context) m_repositoryActionList.append(action); command = Core::ActionManager::registerAction(action, Constants::COMMIT, context); command->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+I,Meta+C") : tr("ALT+I,Alt+C"))); - connect(action, &QAction::triggered, this, &FossilPlugin::commit); + connect(action, &QAction::triggered, this, &FossilPluginPrivate::commit); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Settings ..."), this); m_repositoryActionList.append(action); command = Core::ActionManager::registerAction(action, Constants::CONFIGURE_REPOSITORY, context); - connect(action, &QAction::triggered, this, &FossilPlugin::configureRepository); + connect(action, &QAction::triggered, this, &FossilPluginPrivate::configureRepository); m_fossilContainer->addAction(command); m_commandLocator->appendCommand(command); @@ -435,11 +445,11 @@ void FossilPlugin::createRepositoryActions(const Core::Context &context) // without active repository to allow creating a new one. m_createRepositoryAction = new QAction(tr("Create Repository..."), this); command = Core::ActionManager::registerAction(m_createRepositoryAction, Constants::CREATE_REPOSITORY); - connect(m_createRepositoryAction, &QAction::triggered, this, &FossilPlugin::createRepository); + connect(m_createRepositoryAction, &QAction::triggered, this, &FossilPluginPrivate::createRepository); m_fossilContainer->addAction(command); } -void FossilPlugin::pull() +void FossilPluginPrivate::pull() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return); @@ -467,7 +477,7 @@ void FossilPlugin::pull() m_client->synchronousPull(state.topLevel(), remoteLocation, extraOptions); } -void FossilPlugin::push() +void FossilPluginPrivate::push() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return); @@ -495,7 +505,7 @@ void FossilPlugin::push() m_client->synchronousPush(state.topLevel(), remoteLocation, extraOptions); } -void FossilPlugin::update() +void FossilPluginPrivate::update() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return); @@ -509,7 +519,7 @@ void FossilPlugin::update() m_client->update(state.topLevel(), revertUi.revisionLineEdit->text()); } -void FossilPlugin::configureRepository() +void FossilPluginPrivate::configureRepository() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return); @@ -527,7 +537,7 @@ void FossilPlugin::configureRepository() m_client->synchronousConfigureRepository(state.topLevel(), newSettings, currentSettings); } -void FossilPlugin::commit() +void FossilPluginPrivate::commit() { if (!promptBeforeCommit()) return; @@ -541,17 +551,17 @@ void FossilPlugin::commit() m_submitRepository = state.topLevel(); connect(m_client, &VcsBase::VcsBaseClient::parsedStatus, - this, &FossilPlugin::showCommitWidget); + this, &FossilPluginPrivate::showCommitWidget); QStringList extraOptions; m_client->emitParsedStatus(m_submitRepository, extraOptions); } -void FossilPlugin::showCommitWidget(const QList &status) +void FossilPluginPrivate::showCommitWidget(const QList &status) { //Once we receive our data release the connection so it can be reused elsewhere disconnect(m_client, &VcsBase::VcsBaseClient::parsedStatus, - this, &FossilPlugin::showCommitWidget); + this, &FossilPluginPrivate::showCommitWidget); if (status.isEmpty()) { VcsBase::VcsOutputWindow::appendError(tr("There are no changes to commit.")); @@ -594,11 +604,11 @@ void FossilPlugin::showCommitWidget(const QListsetFields(m_submitRepository, currentBranch, tags, currentUser, status); connect(commitEditor, &VcsBase::VcsBaseSubmitEditor::diffSelectedFiles, - this, &FossilPlugin::diffFromEditorSelected); + this, &FossilPluginPrivate::diffFromEditorSelected); commitEditor->setCheckScriptWorkingDirectory(m_submitRepository); } -void FossilPlugin::diffFromEditorSelected(const QStringList &files) +void FossilPluginPrivate::diffFromEditorSelected(const QStringList &files) { m_client->diff(m_submitRepository, files); } @@ -610,7 +620,7 @@ static inline bool ask(QWidget *parent, const QString &title, const QString &que return QMessageBox::question(parent, title, question, QMessageBox::Yes|QMessageBox::No, defaultButton) == QMessageBox::Yes; } -void FossilPlugin::createRepository() +void FossilPluginPrivate::createRepository() { // re-implemented from void VcsBasePlugin::createRepository() @@ -647,7 +657,7 @@ void FossilPlugin::createRepository() } } -void FossilPlugin::commitFromEditor() +void FossilPluginPrivate::commitFromEditor() { // Close the submit editor m_submitActionTriggered = true; @@ -655,7 +665,7 @@ void FossilPlugin::commitFromEditor() Core::EditorManager::closeDocument(submitEditor()->document()); } -bool FossilPlugin::submitEditorAboutToClose() +bool FossilPluginPrivate::submitEditorAboutToClose() { CommitEditor *commitEditor = qobject_cast(submitEditor()); QTC_ASSERT(commitEditor, return true); @@ -718,7 +728,7 @@ bool FossilPlugin::submitEditorAboutToClose() } -void FossilPlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as) +void FossilPluginPrivate::updateActions(VcsBase::VcsBasePluginPrivate::ActionState as) { m_createRepositoryAction->setEnabled(true); diff --git a/plugins/fossil/fossilplugin.h b/plugins/fossil/fossilplugin.h index 2a67cc628a3..aa77989e004 100644 --- a/plugins/fossil/fossilplugin.h +++ b/plugins/fossil/fossilplugin.h @@ -51,21 +51,19 @@ class FossilClient; class FossilControl; class FossilEditorWidget; -class FossilPlugin : public VcsBase::VcsBasePlugin +class FossilPluginPrivate final : public VcsBase::VcsBasePluginPrivate { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Fossil.json") public: - FossilPlugin(); - ~FossilPlugin(); - bool initialize(const QStringList &arguments, QString *errorMessage) override; + FossilPluginPrivate(); + ~FossilPluginPrivate(); - static FossilPlugin *instance(); + static FossilPluginPrivate *instance(); FossilClient *client() const; protected: - void updateActions(VcsBase::VcsBasePlugin::ActionState) override; + void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override; bool submitEditorAboutToClose() override; private: @@ -102,7 +100,7 @@ private: void createRepositoryActions(const Core::Context &context); // Variables - static FossilPlugin *m_instance; + FossilSettings m_fossilSettings; FossilClient *m_client = nullptr; Core::CommandLocator *m_commandLocator = nullptr; @@ -127,7 +125,17 @@ private: QString m_submitRepository; bool m_submitActionTriggered = false; +}; +class FossilPlugin final : public ExtensionSystem::IPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Fossil.json") + + ~FossilPlugin() final; + + bool initialize(const QStringList &arguments, QString *errorMessage) final; + void extensionsInitialized() final; #ifdef WITH_TESTS private slots: diff --git a/plugins/fossil/optionspage.cpp b/plugins/fossil/optionspage.cpp index 361c7d1a6f6..40cd82ff5cf 100644 --- a/plugins/fossil/optionspage.cpp +++ b/plugins/fossil/optionspage.cpp @@ -28,32 +28,32 @@ #include "fossilclient.h" #include "fossilsettings.h" #include "fossilplugin.h" +#include "ui_optionspage.h" #include #include #include -#include +namespace Fossil { +namespace Internal { -using namespace Fossil::Internal; -using namespace Fossil; - -OptionsPageWidget::OptionsPageWidget(QWidget *parent) : - VcsClientOptionsPageWidget(parent) +class OptionsPageWidget final : public Core::IOptionsPageWidget { - m_ui.setupUi(this); - m_ui.commandChooser->setExpectedKind(Utils::PathChooser::ExistingCommand); - m_ui.commandChooser->setPromptDialogTitle(tr("Fossil Command")); - m_ui.commandChooser->setHistoryCompleter("Fossil.Command.History"); - m_ui.defaultRepoPathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory); - m_ui.defaultRepoPathChooser->setPromptDialogTitle(tr("Fossil Repositories")); - m_ui.sslIdentityFilePathChooser->setExpectedKind(Utils::PathChooser::File); - m_ui.sslIdentityFilePathChooser->setPromptDialogTitle(tr("SSL/TLS Identity Key")); -} + Q_DECLARE_TR_FUNCTIONS(Fossil::Internal::OptionsPageWidget) -VcsBase::VcsBaseClientSettings OptionsPageWidget::settings() const +public: + OptionsPageWidget(Core::IVersionControl *control, FossilSettings *settings); + void apply() final; + +private: + Ui::OptionsPage m_ui; + Core::IVersionControl *m_control; + FossilSettings *m_settings; +}; + +void OptionsPageWidget::apply() { - VcsBase::VcsBaseClientSettings s = FossilPlugin::instance()->client()->settings(); + FossilSettings s = *m_settings; s.setValue(FossilSettings::binaryPathKey, m_ui.commandChooser->rawPath()); s.setValue(FossilSettings::defaultRepoPathKey, m_ui.defaultRepoPathChooser->path()); s.setValue(FossilSettings::userNameKey, m_ui.defaultUsernameLineEdit->text().trimmed()); @@ -62,25 +62,43 @@ VcsBase::VcsBaseClientSettings OptionsPageWidget::settings() const s.setValue(FossilSettings::timelineWidthKey, m_ui.logEntriesWidth->value()); s.setValue(FossilSettings::timeoutKey, m_ui.timeout->value()); s.setValue(FossilSettings::disableAutosyncKey, m_ui.disableAutosyncCheckBox->isChecked()); - return s; + if (*m_settings == s) + return; + + *m_settings = s; + emit m_control->configurationChanged(); } -void OptionsPageWidget::setSettings(const VcsBase::VcsBaseClientSettings &s) +OptionsPageWidget::OptionsPageWidget(Core::IVersionControl *control, FossilSettings *settings) : + m_control(control), + m_settings(settings) { - m_ui.commandChooser->setPath(s.stringValue(FossilSettings::binaryPathKey)); - m_ui.defaultRepoPathChooser->setPath(s.stringValue(FossilSettings::defaultRepoPathKey)); - m_ui.defaultUsernameLineEdit->setText(s.stringValue(FossilSettings::userNameKey)); - m_ui.sslIdentityFilePathChooser->setPath(s.stringValue(FossilSettings::sslIdentityFileKey)); - m_ui.logEntriesCount->setValue(s.intValue(FossilSettings::logCountKey)); - m_ui.logEntriesWidth->setValue(s.intValue(FossilSettings::timelineWidthKey)); - m_ui.timeout->setValue(s.intValue(FossilSettings::timeoutKey)); - m_ui.disableAutosyncCheckBox->setChecked(s.boolValue(FossilSettings::disableAutosyncKey)); + m_ui.setupUi(this); + m_ui.commandChooser->setExpectedKind(Utils::PathChooser::ExistingCommand); + m_ui.commandChooser->setPromptDialogTitle(tr("Fossil Command")); + m_ui.commandChooser->setHistoryCompleter("Fossil.Command.History"); + m_ui.commandChooser->setPath(m_settings->stringValue(FossilSettings::binaryPathKey)); + m_ui.defaultRepoPathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory); + m_ui.defaultRepoPathChooser->setPromptDialogTitle(tr("Fossil Repositories")); + m_ui.defaultRepoPathChooser->setPath(m_settings->stringValue(FossilSettings::defaultRepoPathKey)); + m_ui.sslIdentityFilePathChooser->setExpectedKind(Utils::PathChooser::File); + m_ui.sslIdentityFilePathChooser->setPromptDialogTitle(tr("SSL/TLS Identity Key")); + m_ui.sslIdentityFilePathChooser->setPath(m_settings->stringValue(FossilSettings::sslIdentityFileKey)); + m_ui.defaultUsernameLineEdit->setText(m_settings->stringValue(FossilSettings::userNameKey)); + m_ui.logEntriesCount->setValue(m_settings->intValue(FossilSettings::logCountKey)); + m_ui.logEntriesWidth->setValue(m_settings->intValue(FossilSettings::timelineWidthKey)); + m_ui.timeout->setValue(m_settings->intValue(FossilSettings::timeoutKey)); + m_ui.disableAutosyncCheckBox->setChecked(m_settings->boolValue(FossilSettings::disableAutosyncKey)); } -OptionsPage::OptionsPage(Core::IVersionControl *control, QObject *parent) : - VcsClientOptionsPage(control, FossilPlugin::instance()->client(), parent) +OptionsPage::OptionsPage(Core::IVersionControl *control, FossilSettings *settings, QObject *parent) : + Core::IOptionsPage(parent) { setId(Constants::VCS_ID_FOSSIL); - setDisplayName(tr("Fossil")); - setWidgetFactory([]() { return new OptionsPageWidget; }); + setDisplayName(OptionsPageWidget::tr("Fossil")); + setWidgetCreator([control, settings]() { return new OptionsPageWidget(control, settings); }); + setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY); } + +} // Internal +} // Fossil diff --git a/plugins/fossil/optionspage.h b/plugins/fossil/optionspage.h index 6babddbd8a0..cee4aaa27c0 100644 --- a/plugins/fossil/optionspage.h +++ b/plugins/fossil/optionspage.h @@ -25,38 +25,22 @@ #pragma once -#include "ui_optionspage.h" +#include -#include - -namespace VcsBase { class VcsBaseClientSettings; } // namespace VcsBase +namespace Core { class IVersionControl; } +namespace VcsBase { class VcsBaseClientSettings; } namespace Fossil { namespace Internal { class FossilSettings; -class OptionsPageWidget : public VcsBase::VcsClientOptionsPageWidget +class OptionsPage : public Core::IOptionsPage { Q_OBJECT public: - explicit OptionsPageWidget(QWidget *parent = 0); - - VcsBase::VcsBaseClientSettings settings() const; - void setSettings(const VcsBase::VcsBaseClientSettings &s); - -private: - Ui::OptionsPage m_ui; -}; - - -class OptionsPage : public VcsBase::VcsClientOptionsPage -{ - Q_OBJECT - -public: - OptionsPage(Core::IVersionControl *control, QObject *parent); + OptionsPage(Core::IVersionControl *control, FossilSettings *settings, QObject *parent); }; } // namespace Internal diff --git a/plugins/fossil/wizard/fossiljsextension.cpp b/plugins/fossil/wizard/fossiljsextension.cpp index 17c8dfa5ad8..f2466dfe91f 100644 --- a/plugins/fossil/wizard/fossiljsextension.cpp +++ b/plugins/fossil/wizard/fossiljsextension.cpp @@ -47,7 +47,7 @@ public: m_vscId(Constants::VCS_ID_FOSSIL) { } FossilClient *client() const { - return FossilPlugin::instance()->client(); + return FossilPluginPrivate::instance()->client(); } Core::Id m_vscId; From a565e05fb047fbdaaeadbfecc5ffbbfefe80d2f2 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Fri, 31 Jan 2020 14:44:33 +0200 Subject: [PATCH 034/133] Adapt to upstream changes Change-Id: I3c55a84419b22d02bf275729220572c10ca11e35 Reviewed-by: hjk --- plugins/fossil/fossil.pro | 2 - plugins/fossil/fossilclient.h | 4 +- plugins/fossil/fossilcontrol.cpp | 311 -------------------- plugins/fossil/fossilcontrol.h | 77 ----- plugins/fossil/fossileditor.cpp | 4 +- plugins/fossil/fossilplugin.cpp | 278 ++++++++++++++++- plugins/fossil/fossilplugin.h | 34 ++- plugins/fossil/optionspage.cpp | 14 +- plugins/fossil/optionspage.h | 2 +- plugins/fossil/wizard/fossiljsextension.cpp | 24 +- plugins/fossil/wizard/fossiljsextension.h | 1 + 11 files changed, 318 insertions(+), 433 deletions(-) delete mode 100644 plugins/fossil/fossilcontrol.cpp delete mode 100644 plugins/fossil/fossilcontrol.h diff --git a/plugins/fossil/fossil.pro b/plugins/fossil/fossil.pro index 31946520b1a..bdec45dfa07 100644 --- a/plugins/fossil/fossil.pro +++ b/plugins/fossil/fossil.pro @@ -7,7 +7,6 @@ isEmpty(IDE_BUILD_TREE): error("You need to set the environment variable QTC_BUI include($$IDE_SOURCE_TREE/src/qtcreatorplugin.pri) SOURCES += \ fossilclient.cpp \ - fossilcontrol.cpp \ fossilplugin.cpp \ optionspage.cpp \ fossilsettings.cpp \ @@ -23,7 +22,6 @@ SOURCES += \ HEADERS += \ fossilclient.h \ constants.h \ - fossilcontrol.h \ fossilplugin.h \ optionspage.h \ fossilsettings.h \ diff --git a/plugins/fossil/fossilclient.h b/plugins/fossil/fossilclient.h index 19007789da2..fa0da984cd3 100644 --- a/plugins/fossil/fossilclient.h +++ b/plugins/fossil/fossilclient.h @@ -37,7 +37,7 @@ namespace Fossil { namespace Internal { class FossilSettings; -class FossilControl; +class FossilPluginPrivate; class FossilClient : public VcsBase::VcsBaseClient { @@ -127,7 +127,7 @@ private: VcsBase::VcsBaseEditorConfig *createLogCurrentFileEditor(VcsBase::VcsBaseEditorWidget *editor); VcsBase::VcsBaseEditorConfig *createLogEditor(VcsBase::VcsBaseEditorWidget *editor); - friend class FossilControl; + friend class FossilPluginPrivate; }; Q_DECLARE_OPERATORS_FOR_FLAGS(FossilClient::SupportedFeatures) diff --git a/plugins/fossil/fossilcontrol.cpp b/plugins/fossil/fossilcontrol.cpp deleted file mode 100644 index a914078e536..00000000000 --- a/plugins/fossil/fossilcontrol.cpp +++ /dev/null @@ -1,311 +0,0 @@ -/**************************************************************************** -** -** Copyright (c) 2018 Artur Shepilko -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "constants.h" -#include "fossilcontrol.h" -#include "fossilclient.h" -#include "fossilplugin.h" -#include "wizard/fossiljsextension.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -namespace Fossil { -namespace Internal { - -class FossilTopicCache : public Core::IVersionControl::TopicCache -{ -public: - FossilTopicCache(FossilClient *client) : - m_client(client) - { } - -protected: - QString trackFile(const QString &repository) final - { - return repository + "/" + Constants::FOSSILREPO; - } - - QString refreshTopic(const QString &repository) final - { - return m_client->synchronousTopic(repository); - } - -private: - FossilClient *m_client; -}; - -FossilControl::FossilControl(FossilClient *client) : - Core::IVersionControl(new FossilTopicCache(client)), - m_client(client) -{ } - -QString FossilControl::displayName() const -{ - return tr("Fossil"); -} - -Core::Id FossilControl::id() const -{ - return Core::Id(Constants::VCS_ID_FOSSIL); -} - -bool FossilControl::isVcsFileOrDirectory(const Utils::FilePath &filePath) const -{ - return m_client->isVcsFileOrDirectory(filePath); -} - -bool FossilControl::managesDirectory(const QString &directory, QString *topLevel) const -{ - QFileInfo dir(directory); - const QString topLevelFound = m_client->findTopLevelForFile(dir); - if (topLevel) - *topLevel = topLevelFound; - return !topLevelFound.isEmpty(); -} - -bool FossilControl::managesFile(const QString &workingDirectory, const QString &fileName) const -{ - return m_client->managesFile(workingDirectory, fileName); -} - -bool FossilControl::isConfigured() const -{ - const Utils::FilePath binary = m_client->vcsBinary(); - if (binary.isEmpty()) - return false; - - const QFileInfo fi = binary.toFileInfo(); - if ( !(fi.exists() && fi.isFile() && fi.isExecutable()) ) - return false; - - // Local repositories default path must be set and exist - const QString repoPath = m_client->settings().stringValue(FossilSettings::defaultRepoPathKey); - if (repoPath.isEmpty()) - return false; - - const QDir dir(repoPath); - if (!dir.exists()) - return false; - - return true; -} - -bool FossilControl::supportsOperation(Operation operation) const -{ - bool supported = isConfigured(); - - switch (operation) { - case Core::IVersionControl::AddOperation: - case Core::IVersionControl::DeleteOperation: - case Core::IVersionControl::MoveOperation: - case Core::IVersionControl::CreateRepositoryOperation: - case Core::IVersionControl::AnnotateOperation: - case Core::IVersionControl::InitialCheckoutOperation: - break; - case Core::IVersionControl::SnapshotOperations: - supported = false; - break; - } - return supported; -} - -bool FossilControl::vcsOpen(const QString &filename) -{ - Q_UNUSED(filename) - return true; -} - -bool FossilControl::vcsAdd(const QString &filename) -{ - const QFileInfo fi(filename); - return m_client->synchronousAdd(fi.absolutePath(), fi.fileName()); -} - -bool FossilControl::vcsDelete(const QString &filename) -{ - const QFileInfo fi(filename); - return m_client->synchronousRemove(fi.absolutePath(), fi.fileName()); -} - -bool FossilControl::vcsMove(const QString &from, const QString &to) -{ - const QFileInfo fromInfo(from); - const QFileInfo toInfo(to); - return m_client->synchronousMove(fromInfo.absolutePath(), - fromInfo.absoluteFilePath(), - toInfo.absoluteFilePath()); -} - -bool FossilControl::vcsCreateRepository(const QString &directory) -{ - return m_client->synchronousCreateRepository(directory); -} - -bool FossilControl::vcsAnnotate(const QString &file, int line) -{ - const QFileInfo fi(file); - m_client->annotate(fi.absolutePath(), fi.fileName(), QString(), line); - return true; -} - -Core::ShellCommand *FossilControl::createInitialCheckoutCommand(const QString &sourceUrl, - const Utils::FilePath &baseDirectory, - const QString &localName, - const QStringList &extraArgs) -{ - QMap options; - FossilJsExtension::parseArgOptions(extraArgs, options); - - // Two operating modes: - // 1) CloneCheckout: - // -- clone from remote-URL or a local-fossil a repository into a local-clone fossil. - // -- open/checkout the local-clone fossil - // The local-clone fossil must not point to an existing repository. - // Clone URL may be either schema-based (http, ssh, file) or an absolute local path. - // - // 2) LocalCheckout: - // -- open/checkout an existing local fossil - // Clone URL is an absolute local path and is the same as the local fossil. - - const QString checkoutPath = baseDirectory.pathAppended(localName).toString(); - const QString fossilFile = options.value("fossil-file"); - const Utils::FilePath fossilFilePath = Utils::FilePath::fromUserInput(QDir::fromNativeSeparators(fossilFile)); - const QString fossilFileNative = fossilFilePath.toUserOutput(); - const QFileInfo cloneRepository(fossilFilePath.toString()); - - // Check when requested to clone a local repository and clone-into repository file is the same - // or not specified. - // In this case handle it as local fossil checkout request. - const QUrl url(sourceUrl); - bool isLocalRepository = (options.value("repository-type") == "localRepo"); - - if (url.isLocalFile() || url.isRelative()) { - const QFileInfo sourcePath(url.path()); - isLocalRepository = (sourcePath.canonicalFilePath() == cloneRepository.canonicalFilePath()); - } - - // set clone repository admin user to configured user name - // OR override it with the specified user from clone panel - const QString adminUser = options.value("admin-user"); - const bool disableAutosync = (options.value("settings-autosync") == "off"); - const QString checkoutBranch = options.value("branch-tag"); - - // first create the checkout directory, - // as it needs to become a working directory for wizard command jobs - - const QDir checkoutDir(checkoutPath); - checkoutDir.mkpath(checkoutPath); - - // Setup the wizard page command job - auto command = new VcsBase::VcsCommand(checkoutDir.path(), m_client->processEnvironment()); - - if (!isLocalRepository - && !cloneRepository.exists()) { - - const QString sslIdentityFile = options.value("ssl-identity"); - const Utils::FilePath sslIdentityFilePath = Utils::FilePath::fromUserInput(QDir::fromNativeSeparators(sslIdentityFile)); - const bool includePrivate = (options.value("include-private") == "true"); - - QStringList extraOptions; - if (includePrivate) - extraOptions << "--private"; - if (!sslIdentityFile.isEmpty()) - extraOptions << "--ssl-identity" << sslIdentityFilePath.toUserOutput(); - if (!adminUser.isEmpty()) - extraOptions << "--admin-user" << adminUser; - - // Fossil allows saving the remote address and login. This is used to - // facilitate autosync (commit/update) functionality. - // When no password is given, it prompts for that. - // When both username and password are specified, it prompts whether to - // save them. - // NOTE: In non-interactive context, these prompts won't work. - // Fossil currently does not support SSH_ASKPASS way for login query. - // - // Alternatively, "--once" option does not save the remote details. - // In such case remote details must be provided on the command-line every - // time. This also precludes autosync. - // - // So here we want Fossil to save the remote details when specified. - - QStringList args; - args << m_client->vcsCommandString(FossilClient::CloneCommand) - << extraOptions - << sourceUrl - << fossilFileNative; - command->addJob({m_client->vcsBinary(), args}, -1); - } - - // check out the cloned repository file into the working copy directory; - // by default the latest revision is checked out - - QStringList args({"open", fossilFileNative}); - if (!checkoutBranch.isEmpty()) - args << checkoutBranch; - command->addJob({m_client->vcsBinary(), args}, -1); - - // set user default to admin user if specified - if (!isLocalRepository - && !adminUser.isEmpty()) { - const QStringList args({ "user", "default", adminUser, "--user", adminUser}); - command->addJob({m_client->vcsBinary(), args}, -1); - } - - // turn-off autosync if requested - if (!isLocalRepository - && disableAutosync) { - const QStringList args({"settings", "autosync", "off"}); - command->addJob({m_client->vcsBinary(), args}, -1); - } - - return command; -} - -void FossilControl::changed(const QVariant &v) -{ - switch (v.type()) { - case QVariant::String: - emit repositoryChanged(v.toString()); - break; - case QVariant::StringList: - emit filesChanged(v.toStringList()); - break; - default: - break; - } -} - -} // namespace Internal -} // namespace Fossil diff --git a/plugins/fossil/fossilcontrol.h b/plugins/fossil/fossilcontrol.h deleted file mode 100644 index 072d73c6d64..00000000000 --- a/plugins/fossil/fossilcontrol.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (c) 2018 Artur Shepilko -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include - -QT_BEGIN_NAMESPACE -class QVariant; -QT_END_NAMESPACE - -namespace Fossil { -namespace Internal { - -class FossilClient; - -//Implements just the basics of the Version Control Interface -//FossilClient handles all the work -class FossilControl: public Core::IVersionControl -{ - Q_OBJECT - -public: - explicit FossilControl(FossilClient *fossilClient); - - QString displayName() const final; - Core::Id id() const final; - - bool isVcsFileOrDirectory(const Utils::FilePath &filePath) const final; - bool managesDirectory(const QString &filename, QString *topLevel = 0) const final; - bool managesFile(const QString &workingDirectory, const QString &fileName) const final; - bool isConfigured() const final; - bool supportsOperation(Operation operation) const final; - bool vcsOpen(const QString &fileName) final; - bool vcsAdd(const QString &filename) final; - bool vcsDelete(const QString &filename) final; - bool vcsMove(const QString &from, const QString &to) final; - bool vcsCreateRepository(const QString &directory) final; - bool vcsAnnotate(const QString &file, int line) final; - Core::ShellCommand *createInitialCheckoutCommand(const QString &sourceUrl, - const Utils::FilePath &baseDirectory, - const QString &localName, - const QStringList &extraArgs) final; - - // To be connected to the VcsTask's success signal to emit the repository/ - // files changed signals according to the variant's type: - // String -> repository, StringList -> files - void changed(const QVariant &); - -private: - FossilClient *const m_client; -}; - -} // namespace Internal -} // namespace Fossil diff --git a/plugins/fossil/fossileditor.cpp b/plugins/fossil/fossileditor.cpp index e01a95397a9..139f19d12c1 100644 --- a/plugins/fossil/fossileditor.cpp +++ b/plugins/fossil/fossileditor.cpp @@ -131,7 +131,7 @@ QString FossilEditorWidget::decorateVersion(const QString &revision) const const QFileInfo fi(source()); const QString workingDirectory = fi.absolutePath(); - FossilClient *client = FossilPluginPrivate::instance()->client(); + const FossilClient *client = FossilPluginPrivate::instance()->client(); RevisionInfo revisionInfo = client->synchronousRevisionQuery(workingDirectory, revision, true); @@ -153,7 +153,7 @@ QStringList FossilEditorWidget::annotationPreviousVersions(const QString &revisi QStringList revisions; const QFileInfo fi(source()); const QString workingDirectory = fi.absolutePath(); - FossilClient *client = FossilPluginPrivate::instance()->client(); + const FossilClient *client = FossilPluginPrivate::instance()->client(); RevisionInfo revisionInfo = client->synchronousRevisionQuery(workingDirectory, revision); if (revisionInfo.parentId.isEmpty()) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index c2fe8b9a1e8..eb82cb4ab52 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -26,7 +26,6 @@ #include "fossilplugin.h" #include "constants.h" #include "fossilclient.h" -#include "fossilcontrol.h" #include "optionspage.h" #include "fossilcommitwidget.h" #include "fossileditor.h" @@ -64,6 +63,7 @@ #include #include #include +#include #include #include @@ -78,6 +78,28 @@ namespace Fossil { namespace Internal { +class FossilTopicCache : public Core::IVersionControl::TopicCache +{ +public: + FossilTopicCache(FossilClient *client) : + m_client(client) + { } + +protected: + QString trackFile(const QString &repository) final + { + return repository + "/" + Constants::FOSSILREPO; + } + + QString refreshTopic(const QString &repository) final + { + return m_client->synchronousTopic(repository); + } + +private: + FossilClient *m_client; +}; + static const VcsBase::VcsBaseEditorParameters editorParameters[] = { { VcsBase::LogOutput, Constants::FILELOG_ID, @@ -105,12 +127,6 @@ static const VcsBase::VcsBaseSubmitEditorParameters submitEditorParameters = { static FossilPluginPrivate *dd = nullptr; -FossilPluginPrivate::~FossilPluginPrivate() -{ - delete m_client; - m_client = nullptr; -} - FossilPlugin::~FossilPlugin() { delete dd; @@ -132,15 +148,15 @@ void FossilPlugin::extensionsInitialized() } FossilPluginPrivate::FossilPluginPrivate() + : VcsBase::VcsBasePluginPrivate(Core::Context(Constants::FOSSIL_CONTEXT)) { Core::Context context(Constants::FOSSIL_CONTEXT); m_client = new FossilClient(&m_fossilSettings); - auto vcsCtrl = new FossilControl(m_client); - initializeVcs(vcsCtrl, context); - connect(m_client, &VcsBase::VcsBaseClient::changed, vcsCtrl, &FossilControl::changed); + setTopicCache(new FossilTopicCache(m_client)); + connect(m_client, &VcsBase::VcsBaseClient::changed, this, &FossilPluginPrivate::changed); - new OptionsPage(vcsCtrl, &m_fossilSettings, this); + new OptionsPage([this] { configurationChanged(); }, &m_fossilSettings, this); const auto describeFunc = [this](const QString &source, const QString &id) { m_client->view(source, id); @@ -170,7 +186,7 @@ FossilPluginPrivate *FossilPluginPrivate::instance() return dd; } -FossilClient *FossilPluginPrivate::client() const +const FossilClient *FossilPluginPrivate::client() const { return m_client; } @@ -644,7 +660,7 @@ void FossilPluginPrivate::createRepository() return; } while (true); // Create - const bool rc = static_cast(versionControl())->vcsCreateRepository(directory); + const bool rc = vcsCreateRepository(directory); const QString nativeDir = QDir::toNativeSeparators(directory); if (rc) { QMessageBox::information(mw, tr("Repository Created"), @@ -752,6 +768,242 @@ void FossilPluginPrivate::updateActions(VcsBase::VcsBasePluginPrivate::ActionSta repoAction->setEnabled(repoEnabled); } +QString FossilPluginPrivate::displayName() const +{ + return tr("Fossil"); +} + +Core::Id FossilPluginPrivate::id() const +{ + return Core::Id(Constants::VCS_ID_FOSSIL); +} + +bool FossilPluginPrivate::isVcsFileOrDirectory(const Utils::FilePath &filePath) const +{ + return m_client->isVcsFileOrDirectory(filePath); +} + +bool FossilPluginPrivate::managesDirectory(const QString &directory, QString *topLevel) const +{ + QFileInfo dir(directory); + const QString topLevelFound = m_client->findTopLevelForFile(dir); + if (topLevel) + *topLevel = topLevelFound; + return !topLevelFound.isEmpty(); +} + +bool FossilPluginPrivate::managesFile(const QString &workingDirectory, const QString &fileName) const +{ + return m_client->managesFile(workingDirectory, fileName); +} + +bool FossilPluginPrivate::isConfigured() const +{ + const Utils::FilePath binary = m_client->vcsBinary(); + if (binary.isEmpty()) + return false; + + const QFileInfo fi = binary.toFileInfo(); + if ( !(fi.exists() && fi.isFile() && fi.isExecutable()) ) + return false; + + // Local repositories default path must be set and exist + const QString repoPath = m_client->settings().stringValue(FossilSettings::defaultRepoPathKey); + if (repoPath.isEmpty()) + return false; + + const QDir dir(repoPath); + if (!dir.exists()) + return false; + + return true; +} + +bool FossilPluginPrivate::supportsOperation(Operation operation) const +{ + bool supported = isConfigured(); + + switch (operation) { + case Core::IVersionControl::AddOperation: + case Core::IVersionControl::DeleteOperation: + case Core::IVersionControl::MoveOperation: + case Core::IVersionControl::CreateRepositoryOperation: + case Core::IVersionControl::AnnotateOperation: + case Core::IVersionControl::InitialCheckoutOperation: + break; + case Core::IVersionControl::SnapshotOperations: + supported = false; + break; + } + return supported; +} + +bool FossilPluginPrivate::vcsOpen(const QString &filename) +{ + Q_UNUSED(filename) + return true; +} + +bool FossilPluginPrivate::vcsAdd(const QString &filename) +{ + const QFileInfo fi(filename); + return m_client->synchronousAdd(fi.absolutePath(), fi.fileName()); +} + +bool FossilPluginPrivate::vcsDelete(const QString &filename) +{ + const QFileInfo fi(filename); + return m_client->synchronousRemove(fi.absolutePath(), fi.fileName()); +} + +bool FossilPluginPrivate::vcsMove(const QString &from, const QString &to) +{ + const QFileInfo fromInfo(from); + const QFileInfo toInfo(to); + return m_client->synchronousMove(fromInfo.absolutePath(), + fromInfo.absoluteFilePath(), + toInfo.absoluteFilePath()); +} + +bool FossilPluginPrivate::vcsCreateRepository(const QString &directory) +{ + return m_client->synchronousCreateRepository(directory); +} + +bool FossilPluginPrivate::vcsAnnotate(const QString &file, int line) +{ + const QFileInfo fi(file); + m_client->annotate(fi.absolutePath(), fi.fileName(), QString(), line); + return true; +} + +Core::ShellCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QString &sourceUrl, + const Utils::FilePath &baseDirectory, + const QString &localName, + const QStringList &extraArgs) +{ + QMap options; + FossilJsExtension::parseArgOptions(extraArgs, options); + + // Two operating modes: + // 1) CloneCheckout: + // -- clone from remote-URL or a local-fossil a repository into a local-clone fossil. + // -- open/checkout the local-clone fossil + // The local-clone fossil must not point to an existing repository. + // Clone URL may be either schema-based (http, ssh, file) or an absolute local path. + // + // 2) LocalCheckout: + // -- open/checkout an existing local fossil + // Clone URL is an absolute local path and is the same as the local fossil. + + const QString checkoutPath = baseDirectory.pathAppended(localName).toString(); + const QString fossilFile = options.value("fossil-file"); + const Utils::FilePath fossilFilePath = Utils::FilePath::fromUserInput(QDir::fromNativeSeparators(fossilFile)); + const QString fossilFileNative = fossilFilePath.toUserOutput(); + const QFileInfo cloneRepository(fossilFilePath.toString()); + + // Check when requested to clone a local repository and clone-into repository file is the same + // or not specified. + // In this case handle it as local fossil checkout request. + const QUrl url(sourceUrl); + bool isLocalRepository = (options.value("repository-type") == "localRepo"); + + if (url.isLocalFile() || url.isRelative()) { + const QFileInfo sourcePath(url.path()); + isLocalRepository = (sourcePath.canonicalFilePath() == cloneRepository.canonicalFilePath()); + } + + // set clone repository admin user to configured user name + // OR override it with the specified user from clone panel + const QString adminUser = options.value("admin-user"); + const bool disableAutosync = (options.value("settings-autosync") == "off"); + const QString checkoutBranch = options.value("branch-tag"); + + // first create the checkout directory, + // as it needs to become a working directory for wizard command jobs + + const QDir checkoutDir(checkoutPath); + checkoutDir.mkpath(checkoutPath); + + // Setup the wizard page command job + auto command = new VcsBase::VcsCommand(checkoutDir.path(), m_client->processEnvironment()); + + if (!isLocalRepository + && !cloneRepository.exists()) { + + const QString sslIdentityFile = options.value("ssl-identity"); + const Utils::FilePath sslIdentityFilePath = Utils::FilePath::fromUserInput(QDir::fromNativeSeparators(sslIdentityFile)); + const bool includePrivate = (options.value("include-private") == "true"); + + QStringList extraOptions; + if (includePrivate) + extraOptions << "--private"; + if (!sslIdentityFile.isEmpty()) + extraOptions << "--ssl-identity" << sslIdentityFilePath.toUserOutput(); + if (!adminUser.isEmpty()) + extraOptions << "--admin-user" << adminUser; + + // Fossil allows saving the remote address and login. This is used to + // facilitate autosync (commit/update) functionality. + // When no password is given, it prompts for that. + // When both username and password are specified, it prompts whether to + // save them. + // NOTE: In non-interactive context, these prompts won't work. + // Fossil currently does not support SSH_ASKPASS way for login query. + // + // Alternatively, "--once" option does not save the remote details. + // In such case remote details must be provided on the command-line every + // time. This also precludes autosync. + // + // So here we want Fossil to save the remote details when specified. + + QStringList args; + args << m_client->vcsCommandString(FossilClient::CloneCommand) + << extraOptions + << sourceUrl + << fossilFileNative; + command->addJob({m_client->vcsBinary(), args}, -1); + } + + // check out the cloned repository file into the working copy directory; + // by default the latest revision is checked out + + QStringList args({"open", fossilFileNative}); + if (!checkoutBranch.isEmpty()) + args << checkoutBranch; + command->addJob({m_client->vcsBinary(), args}, -1); + + // set user default to admin user if specified + if (!isLocalRepository + && !adminUser.isEmpty()) { + const QStringList args({ "user", "default", adminUser, "--user", adminUser}); + command->addJob({m_client->vcsBinary(), args}, -1); + } + + // turn-off autosync if requested + if (!isLocalRepository + && disableAutosync) { + const QStringList args({"settings", "autosync", "off"}); + command->addJob({m_client->vcsBinary(), args}, -1); + } + + return command; +} + +void FossilPluginPrivate::changed(const QVariant &v) +{ + switch (v.type()) { + case QVariant::String: + emit repositoryChanged(v.toString()); + break; + case QVariant::StringList: + emit filesChanged(v.toStringList()); + break; + default: + break; + } +} + } // namespace Internal } // namespace Fossil diff --git a/plugins/fossil/fossilplugin.h b/plugins/fossil/fossilplugin.h index aa77989e004..01aa3b8b749 100644 --- a/plugins/fossil/fossilplugin.h +++ b/plugins/fossil/fossilplugin.h @@ -48,7 +48,7 @@ namespace Internal { class OptionsPage; class FossilClient; -class FossilControl; +class FossilPluginPrivate; class FossilEditorWidget; class FossilPluginPrivate final : public VcsBase::VcsBasePluginPrivate @@ -57,10 +57,33 @@ class FossilPluginPrivate final : public VcsBase::VcsBasePluginPrivate public: FossilPluginPrivate(); - ~FossilPluginPrivate(); static FossilPluginPrivate *instance(); - FossilClient *client() const; + const FossilClient *client() const; + + // IVersionControl + QString displayName() const final; + Core::Id id() const final; + + bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const final; + + bool managesDirectory(const QString &directory, QString *topLevel) const final; + bool managesFile(const QString &workingDirectory, const QString &fileName) const final; + + bool isConfigured() const final; + bool supportsOperation(Operation operation) const final; + bool vcsOpen(const QString &fileName) final; + bool vcsAdd(const QString &fileName) final; + bool vcsDelete(const QString &filename) final; + bool vcsMove(const QString &from, const QString &to) final; + bool vcsCreateRepository(const QString &directory) final; + + bool vcsAnnotate(const QString &file, int line) final; + + Core::ShellCommand *createInitialCheckoutCommand(const QString &url, + const Utils::FilePath &baseDirectory, + const QString &localName, + const QStringList &extraArgs) final; protected: void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override; @@ -125,6 +148,11 @@ private: QString m_submitRepository; bool m_submitActionTriggered = false; + + // To be connected to the VcsTask's success signal to emit the repository/ + // files changed signals according to the variant's type: + // String -> repository, StringList -> files + void changed(const QVariant &); }; class FossilPlugin final : public ExtensionSystem::IPlugin diff --git a/plugins/fossil/optionspage.cpp b/plugins/fossil/optionspage.cpp index 40cd82ff5cf..e9d23081630 100644 --- a/plugins/fossil/optionspage.cpp +++ b/plugins/fossil/optionspage.cpp @@ -42,12 +42,12 @@ class OptionsPageWidget final : public Core::IOptionsPageWidget Q_DECLARE_TR_FUNCTIONS(Fossil::Internal::OptionsPageWidget) public: - OptionsPageWidget(Core::IVersionControl *control, FossilSettings *settings); + OptionsPageWidget(const std::function &onApply, FossilSettings *settings); void apply() final; private: Ui::OptionsPage m_ui; - Core::IVersionControl *m_control; + const std::function m_onApply; FossilSettings *m_settings; }; @@ -66,11 +66,11 @@ void OptionsPageWidget::apply() return; *m_settings = s; - emit m_control->configurationChanged(); + m_onApply(); } -OptionsPageWidget::OptionsPageWidget(Core::IVersionControl *control, FossilSettings *settings) : - m_control(control), +OptionsPageWidget::OptionsPageWidget(const std::function &onApply, FossilSettings *settings) : + m_onApply(onApply), m_settings(settings) { m_ui.setupUi(this); @@ -91,12 +91,12 @@ OptionsPageWidget::OptionsPageWidget(Core::IVersionControl *control, FossilSetti m_ui.disableAutosyncCheckBox->setChecked(m_settings->boolValue(FossilSettings::disableAutosyncKey)); } -OptionsPage::OptionsPage(Core::IVersionControl *control, FossilSettings *settings, QObject *parent) : +OptionsPage::OptionsPage(const std::function &onApply, FossilSettings *settings, QObject *parent) : Core::IOptionsPage(parent) { setId(Constants::VCS_ID_FOSSIL); setDisplayName(OptionsPageWidget::tr("Fossil")); - setWidgetCreator([control, settings]() { return new OptionsPageWidget(control, settings); }); + setWidgetCreator([onApply, settings]() { return new OptionsPageWidget(onApply, settings); }); setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY); } diff --git a/plugins/fossil/optionspage.h b/plugins/fossil/optionspage.h index cee4aaa27c0..a00ccae16d9 100644 --- a/plugins/fossil/optionspage.h +++ b/plugins/fossil/optionspage.h @@ -40,7 +40,7 @@ class OptionsPage : public Core::IOptionsPage Q_OBJECT public: - OptionsPage(Core::IVersionControl *control, FossilSettings *settings, QObject *parent); + OptionsPage(const std::function &onApply, FossilSettings *settings, QObject *parent); }; } // namespace Internal diff --git a/plugins/fossil/wizard/fossiljsextension.cpp b/plugins/fossil/wizard/fossiljsextension.cpp index f2466dfe91f..6124557c6d8 100644 --- a/plugins/fossil/wizard/fossiljsextension.cpp +++ b/plugins/fossil/wizard/fossiljsextension.cpp @@ -39,18 +39,16 @@ using namespace Core; namespace Fossil { namespace Internal { - class FossilJsExtensionPrivate { - public: FossilJsExtensionPrivate() : - m_vscId(Constants::VCS_ID_FOSSIL) { } - - FossilClient *client() const { - return FossilPluginPrivate::instance()->client(); + m_vscId(Constants::VCS_ID_FOSSIL), + m_settings(&FossilPluginPrivate::instance()->client()->settings()) + { } Core::Id m_vscId; + VcsBase::VcsBaseClientSettings *m_settings; }; @@ -67,7 +65,7 @@ void FossilJsExtension::parseArgOptions(const QStringList &args, QMapclient()->settings(); - return settings.stringValue(FossilSettings::userNameKey); + return d->m_settings->stringValue(FossilSettings::userNameKey); } QString FossilJsExtension::defaultSslIdentityFile() const @@ -101,8 +98,7 @@ QString FossilJsExtension::defaultSslIdentityFile() const if (!isConfigured()) return QString(); - VcsBase::VcsBaseClientSettings &settings = d->client()->settings(); - return settings.stringValue(FossilSettings::sslIdentityFileKey); + return d->m_settings->stringValue(FossilSettings::sslIdentityFileKey); } QString FossilJsExtension::defaultLocalRepoPath() const @@ -110,8 +106,7 @@ QString FossilJsExtension::defaultLocalRepoPath() const if (!isConfigured()) return QString(); - VcsBase::VcsBaseClientSettings &settings = d->client()->settings(); - return settings.stringValue(FossilSettings::defaultRepoPathKey); + return d->m_settings->stringValue(FossilSettings::defaultRepoPathKey); } bool FossilJsExtension::defaultDisableAutosync() const @@ -119,8 +114,7 @@ bool FossilJsExtension::defaultDisableAutosync() const if (!isConfigured()) return false; - VcsBase::VcsBaseClientSettings &settings = d->client()->settings(); - return settings.boolValue(FossilSettings::disableAutosyncKey); + return d->m_settings->boolValue(FossilSettings::disableAutosyncKey); } } // namespace Internal diff --git a/plugins/fossil/wizard/fossiljsextension.h b/plugins/fossil/wizard/fossiljsextension.h index 0f123c9529c..926a92c34f1 100644 --- a/plugins/fossil/wizard/fossiljsextension.h +++ b/plugins/fossil/wizard/fossiljsextension.h @@ -35,6 +35,7 @@ namespace Fossil { namespace Internal { class FossilJsExtensionPrivate; +class FossilSettings; class FossilJsExtension : public QObject { From d5c720379e4781d1a7f959f17548b77775115750 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 31 Jan 2020 14:20:00 +0100 Subject: [PATCH 035/133] Use default constructed QFlags Recent Qt versions complain about the nullptr constructor. Change-Id: I4c670c3f6e4c3e7080305f5b0dd4639f070af66e Reviewed-by: Orgad Shaneh --- plugins/fossil/branchinfo.h | 2 +- plugins/fossil/fossilclient.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/fossil/branchinfo.h b/plugins/fossil/branchinfo.h index ff1a1e590f4..034280b4dd4 100644 --- a/plugins/fossil/branchinfo.h +++ b/plugins/fossil/branchinfo.h @@ -40,7 +40,7 @@ public: }; Q_DECLARE_FLAGS(BranchFlags, BranchFlag) - explicit BranchInfo(const QString &name = QString(), BranchFlags flags = 0); + explicit BranchInfo(const QString &name = QString(), BranchFlags flags = {}); public: const QString &name() const; diff --git a/plugins/fossil/fossilclient.h b/plugins/fossil/fossilclient.h index fa0da984cd3..7c9fba07785 100644 --- a/plugins/fossil/fossilclient.h +++ b/plugins/fossil/fossilclient.h @@ -115,7 +115,7 @@ public: const QStringList &extraOptions = QStringList()) final; private: - static QList branchListFromOutput(const QString &output, const BranchInfo::BranchFlags defaultFlags = 0); + static QList branchListFromOutput(const QString &output, const BranchInfo::BranchFlags defaultFlags = {}); static QStringList parseRevisionCommentLine(const QString &commentLine); QString sanitizeFossilOutput(const QString &output) const; From cf8dd5cb3c40b8a071220dfa2e319eb8bdd2df48 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 31 Jan 2020 14:47:53 +0100 Subject: [PATCH 036/133] Fix CMake and Qbs build Change-Id: I7642edb86c8302883f4e163172a0e5f3ad3de417 Reviewed-by: Orgad Shaneh --- plugins/fossil/CMakeLists.txt | 1 - plugins/fossil/fossil.qbs | 1 - 2 files changed, 2 deletions(-) diff --git a/plugins/fossil/CMakeLists.txt b/plugins/fossil/CMakeLists.txt index d60bb19df55..af91d14c6e3 100644 --- a/plugins/fossil/CMakeLists.txt +++ b/plugins/fossil/CMakeLists.txt @@ -15,7 +15,6 @@ add_qtc_plugin(Fossil fossilclient.cpp fossilclient.h fossilcommitpanel.ui fossilcommitwidget.cpp fossilcommitwidget.h - fossilcontrol.cpp fossilcontrol.h fossileditor.cpp fossileditor.h fossilplugin.cpp fossilplugin.h fossilsettings.cpp fossilsettings.h diff --git a/plugins/fossil/fossil.qbs b/plugins/fossil/fossil.qbs index b725cd8dfb9..69730c93cf2 100644 --- a/plugins/fossil/fossil.qbs +++ b/plugins/fossil/fossil.qbs @@ -14,7 +14,6 @@ QtcPlugin { files: [ "constants.h", "fossilclient.cpp", "fossilclient.h", - "fossilcontrol.cpp", "fossilcontrol.h", "fossilplugin.cpp", "fossilplugin.h", "optionspage.cpp", "optionspage.h", "optionspage.ui", "fossilsettings.cpp", "fossilsettings.h", From 7855122c5398a01f3d8e0e6d1885a2e723106871 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Fri, 31 Jan 2020 16:36:29 +0200 Subject: [PATCH 037/133] Fix crash on startup FossilPluginPrivate::instance() was called before dd was assigned. Change-Id: Id6bb6a0134ffa80e18c9c9cc144fb25ca6a2be6b Reviewed-by: hjk --- plugins/fossil/fossilplugin.cpp | 4 +++- plugins/fossil/wizard/fossiljsextension.cpp | 8 ++++---- plugins/fossil/wizard/fossiljsextension.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index eb82cb4ab52..94cbf88e37c 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -173,7 +173,9 @@ FossilPluginPrivate::FossilPluginPrivate() m_commandLocator = new Core::CommandLocator("Fossil", "fossil", "fossil", this); ProjectExplorer::JsonWizardFactory::addWizardPath(Utils::FilePath::fromString(Constants::WIZARD_PATH)); - Core::JsExpander::registerGlobalObject("Fossil"); + Core::JsExpander::registerGlobalObject("Fossil", [this] { + return new FossilJsExtension(&m_fossilSettings); + }); createMenu(context); diff --git a/plugins/fossil/wizard/fossiljsextension.cpp b/plugins/fossil/wizard/fossiljsextension.cpp index 6124557c6d8..0908278437f 100644 --- a/plugins/fossil/wizard/fossiljsextension.cpp +++ b/plugins/fossil/wizard/fossiljsextension.cpp @@ -41,9 +41,9 @@ namespace Internal { class FossilJsExtensionPrivate { public: - FossilJsExtensionPrivate() : + FossilJsExtensionPrivate(FossilSettings *settings) : m_vscId(Constants::VCS_ID_FOSSIL), - m_settings(&FossilPluginPrivate::instance()->client()->settings()) + m_settings(settings) { } @@ -64,8 +64,8 @@ void FossilJsExtension::parseArgOptions(const QStringList &args, QMap &options); - FossilJsExtension(); + FossilJsExtension(FossilSettings *settings); ~FossilJsExtension(); Q_INVOKABLE bool isConfigured() const; From 4a9b113c5c27e818db8d6aa6bc03f4eafa296fe8 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 6 Feb 2020 12:57:53 +0200 Subject: [PATCH 038/133] Adapt to upstream changes Change-Id: Ib8884f1d62129d8275f4036bfd8880137733217c Reviewed-by: hjk --- plugins/fossil/commiteditor.cpp | 4 ++-- plugins/fossil/commiteditor.h | 2 +- plugins/fossil/fossilplugin.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/fossil/commiteditor.cpp b/plugins/fossil/commiteditor.cpp index 756fe13938e..58d62144456 100644 --- a/plugins/fossil/commiteditor.cpp +++ b/plugins/fossil/commiteditor.cpp @@ -36,8 +36,8 @@ namespace Fossil { namespace Internal { -CommitEditor::CommitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters) : - VcsBase::VcsBaseSubmitEditor(parameters, new FossilCommitWidget) +CommitEditor::CommitEditor() : + VcsBase::VcsBaseSubmitEditor(new FossilCommitWidget) { document()->setPreferredDisplayName(tr("Commit Editor")); } diff --git a/plugins/fossil/commiteditor.h b/plugins/fossil/commiteditor.h index 5cc4b3ae382..cb8bbfa289e 100644 --- a/plugins/fossil/commiteditor.h +++ b/plugins/fossil/commiteditor.h @@ -41,7 +41,7 @@ class CommitEditor : public VcsBase::VcsBaseSubmitEditor Q_OBJECT public: - explicit CommitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters); + CommitEditor(); void setFields(const QString &repositoryRoot, const BranchInfo &branch, const QStringList &tags, const QString &userName, diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 94cbf88e37c..75c9f0328d1 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -167,8 +167,8 @@ FossilPluginPrivate::FossilPluginPrivate() for (int i = 0; i < editorCount; i++) new VcsBase::VcsEditorFactory(editorParameters + i, widgetCreator, describeFunc, this); - new VcsBase::VcsSubmitEditorFactory(&submitEditorParameters, - []() { return new CommitEditor(&submitEditorParameters); }, this); + new VcsBase::VcsSubmitEditorFactory(submitEditorParameters, + [] { return new CommitEditor; }, this); m_commandLocator = new Core::CommandLocator("Fossil", "fossil", "fossil", this); From 86f7c7bf12703d9af75486b807a911b9daf70f35 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 7 Feb 2020 14:23:28 +0100 Subject: [PATCH 039/133] Adapt to recent VCS base changes Change-Id: Ia55808cb0e0959ab77333120dabd5401ec51d2a3 Reviewed-by: Orgad Shaneh --- plugins/fossil/fossileditor.cpp | 4 +- plugins/fossil/fossilplugin.cpp | 322 ++++++++++++++++++++++---------- plugins/fossil/fossilplugin.h | 117 +----------- plugins/fossil/optionspage.cpp | 3 +- plugins/fossil/optionspage.h | 7 +- 5 files changed, 233 insertions(+), 220 deletions(-) diff --git a/plugins/fossil/fossileditor.cpp b/plugins/fossil/fossileditor.cpp index 139f19d12c1..92fd9355be4 100644 --- a/plugins/fossil/fossileditor.cpp +++ b/plugins/fossil/fossileditor.cpp @@ -131,7 +131,7 @@ QString FossilEditorWidget::decorateVersion(const QString &revision) const const QFileInfo fi(source()); const QString workingDirectory = fi.absolutePath(); - const FossilClient *client = FossilPluginPrivate::instance()->client(); + const FossilClient *client = FossilPlugin::client(); RevisionInfo revisionInfo = client->synchronousRevisionQuery(workingDirectory, revision, true); @@ -153,7 +153,7 @@ QStringList FossilEditorWidget::annotationPreviousVersions(const QString &revisi QStringList revisions; const QFileInfo fi(source()); const QString workingDirectory = fi.absolutePath(); - const FossilClient *client = FossilPluginPrivate::instance()->client(); + const FossilClient *client = FossilPlugin::client(); RevisionInfo revisionInfo = client->synchronousRevisionQuery(workingDirectory, revision); if (revisionInfo.parentId.isEmpty()) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 75c9f0328d1..e811443daf9 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -75,6 +75,11 @@ #include #include +using namespace Core; +using namespace Utils; +using namespace VcsBase; +using namespace std::placeholders; + namespace Fossil { namespace Internal { @@ -100,31 +105,161 @@ private: FossilClient *m_client; }; -static const VcsBase::VcsBaseEditorParameters editorParameters[] = { - { VcsBase::LogOutput, - Constants::FILELOG_ID, - Constants::FILELOG_DISPLAY_NAME, - Constants::LOGAPP}, - - { VcsBase::AnnotateOutput, - Constants::ANNOTATELOG_ID, - Constants::ANNOTATELOG_DISPLAY_NAME, - Constants::ANNOTATEAPP}, - - { VcsBase::DiffOutput, - Constants::DIFFLOG_ID, - Constants::DIFFLOG_DISPLAY_NAME, - Constants::DIFFAPP} +const VcsBaseEditorParameters fileLogParameters { + LogOutput, + Constants::FILELOG_ID, + Constants::FILELOG_DISPLAY_NAME, + Constants::LOGAPP }; -static const VcsBase::VcsBaseSubmitEditorParameters submitEditorParameters = { +const VcsBaseEditorParameters annotateLogParameters { + AnnotateOutput, + Constants::ANNOTATELOG_ID, + Constants::ANNOTATELOG_DISPLAY_NAME, + Constants::ANNOTATEAPP +}; + +const VcsBaseEditorParameters diffParameters { + DiffOutput, + Constants::DIFFLOG_ID, + Constants::DIFFLOG_DISPLAY_NAME, + Constants::DIFFAPP +}; + +const VcsBaseSubmitEditorParameters submitEditorParameters { Constants::COMMITMIMETYPE, Constants::COMMIT_ID, Constants::COMMIT_DISPLAY_NAME, - VcsBase::VcsBaseSubmitEditorParameters::DiffFiles + VcsBaseSubmitEditorParameters::DiffFiles }; +class FossilPluginPrivate final : public VcsBase::VcsBasePluginPrivate +{ + Q_DECLARE_TR_FUNCTIONS(Fossil::Internal::FossilPlugin) + +public: + FossilPluginPrivate(); + + // IVersionControl + QString displayName() const final; + Core::Id id() const final; + + bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const final; + + bool managesDirectory(const QString &directory, QString *topLevel) const final; + bool managesFile(const QString &workingDirectory, const QString &fileName) const final; + + bool isConfigured() const final; + bool supportsOperation(Operation operation) const final; + bool vcsOpen(const QString &fileName) final; + bool vcsAdd(const QString &fileName) final; + bool vcsDelete(const QString &filename) final; + bool vcsMove(const QString &from, const QString &to) final; + bool vcsCreateRepository(const QString &directory) final; + + bool vcsAnnotate(const QString &file, int line) final; + + Core::ShellCommand *createInitialCheckoutCommand(const QString &url, + const Utils::FilePath &baseDirectory, + const QString &localName, + const QStringList &extraArgs) final; + + void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override; + bool submitEditorAboutToClose() override; + + // File menu action slots + void addCurrentFile(); + void deleteCurrentFile(); + void annotateCurrentFile(); + void diffCurrentFile(); + void logCurrentFile(); + void revertCurrentFile(); + void statusCurrentFile(); + + // Directory menu action slots + void diffRepository(); + void logRepository(); + void revertAll(); + void statusMulti(); + + // Repository menu action slots + void pull(); + void push(); + void update(); + void configureRepository(); + void commit(); + void showCommitWidget(const QList &status); + void commitFromEditor() override; + void diffFromEditorSelected(const QStringList &files); + void createRepository(); + + // Methods + void createMenu(const Core::Context &context); + void createFileActions(const Core::Context &context); + void createDirectoryActions(const Core::Context &context); + void createRepositoryActions(const Core::Context &context); + + void describe(const QString &source, const QString &id) { m_client.view(source, id); }; + + // Variables + FossilSettings m_fossilSettings; + FossilClient m_client{&m_fossilSettings}; + + OptionsPage optionPage{[this] { configurationChanged(); }, &m_fossilSettings}; + + VcsSubmitEditorFactory submitEditorFactory { + submitEditorParameters, + [] { return new CommitEditor; }, + this + }; + + VcsEditorFactory fileLogFactory { + &fileLogParameters, + [] { return new FossilEditorWidget; }, + std::bind(&FossilPluginPrivate::describe, this, _1, _2) + }; + + VcsEditorFactory annotateLogFactory { + &annotateLogParameters, + [] { return new FossilEditorWidget; }, + std::bind(&FossilPluginPrivate::describe, this, _1, _2) + }; + + VcsEditorFactory diffFactory { + &diffParameters, + [] { return new FossilEditorWidget; }, + std::bind(&FossilPluginPrivate::describe, this, _1, _2) + }; + + Core::CommandLocator *m_commandLocator = nullptr; + Core::ActionContainer *m_fossilContainer = nullptr; + + QList m_repositoryActionList; + + // Menu Items (file actions) + Utils::ParameterAction *m_addAction = nullptr; + Utils::ParameterAction *m_deleteAction = nullptr; + Utils::ParameterAction *m_annotateFile = nullptr; + Utils::ParameterAction *m_diffFile = nullptr; + Utils::ParameterAction *m_logFile = nullptr; + Utils::ParameterAction *m_revertFile = nullptr; + Utils::ParameterAction *m_statusFile = nullptr; + + QAction *m_createRepositoryAction = nullptr; + + // Submit editor actions + QAction *m_menuAction = nullptr; + + QString m_submitRepository; + bool m_submitActionTriggered = false; + + // To be connected to the VcsTask's success signal to emit the repository/ + // files changed signals according to the variant's type: + // String -> repository, StringList -> files + void changed(const QVariant &); +}; + static FossilPluginPrivate *dd = nullptr; FossilPlugin::~FossilPlugin() @@ -147,28 +282,28 @@ void FossilPlugin::extensionsInitialized() dd->extensionsInitialized(); } +const FossilSettings &FossilPlugin::settings() +{ + return dd->m_fossilSettings; +} + +FossilClient *FossilPlugin::client() +{ + return &dd->m_client; +} + +void FossilPlugin::showCommitWidget(const QList &status) +{ + dd->showCommitWidget(status); +} + FossilPluginPrivate::FossilPluginPrivate() : VcsBase::VcsBasePluginPrivate(Core::Context(Constants::FOSSIL_CONTEXT)) { Core::Context context(Constants::FOSSIL_CONTEXT); - m_client = new FossilClient(&m_fossilSettings); - setTopicCache(new FossilTopicCache(m_client)); - connect(m_client, &VcsBase::VcsBaseClient::changed, this, &FossilPluginPrivate::changed); - - new OptionsPage([this] { configurationChanged(); }, &m_fossilSettings, this); - - const auto describeFunc = [this](const QString &source, const QString &id) { - m_client->view(source, id); - }; - - const int editorCount = sizeof(editorParameters) / sizeof(VcsBase::VcsBaseEditorParameters); - const auto widgetCreator = []() { return new FossilEditorWidget; }; - for (int i = 0; i < editorCount; i++) - new VcsBase::VcsEditorFactory(editorParameters + i, widgetCreator, describeFunc, this); - - new VcsBase::VcsSubmitEditorFactory(submitEditorParameters, - [] { return new CommitEditor; }, this); + setTopicCache(new FossilTopicCache(&m_client)); + connect(&m_client, &VcsBase::VcsBaseClient::changed, this, &FossilPluginPrivate::changed); m_commandLocator = new Core::CommandLocator("Fossil", "fossil", "fossil", this); @@ -183,17 +318,6 @@ FossilPluginPrivate::FossilPluginPrivate() + "/fossil.qch"}); } -FossilPluginPrivate *FossilPluginPrivate::instance() -{ - return dd; -} - -const FossilClient *FossilPluginPrivate::client() const -{ - return m_client; -} - - void FossilPluginPrivate::createMenu(const Core::Context &context) { // Create menu item for Fossil @@ -277,7 +401,7 @@ void FossilPluginPrivate::addCurrentFile() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasFile(), return); - m_client->synchronousAdd(state.currentFileTopLevel(), state.relativeCurrentFile()); + m_client.synchronousAdd(state.currentFileTopLevel(), state.relativeCurrentFile()); } void FossilPluginPrivate::deleteCurrentFile() @@ -290,31 +414,31 @@ void FossilPluginPrivate::annotateCurrentFile() const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasFile(), return); const int lineNumber = VcsBase::VcsBaseEditor::lineNumberOfCurrentEditor(state.currentFile()); - m_client->annotate(state.currentFileTopLevel(), state.relativeCurrentFile(), QString(), lineNumber); + m_client.annotate(state.currentFileTopLevel(), state.relativeCurrentFile(), QString(), lineNumber); } void FossilPluginPrivate::diffCurrentFile() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasFile(), return); - m_client->diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile())); + m_client.diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile())); } void FossilPluginPrivate::logCurrentFile() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasFile(), return); - FossilClient::SupportedFeatures features = m_client->supportedFeatures(); + FossilClient::SupportedFeatures features = m_client.supportedFeatures(); QStringList extraOptions; - extraOptions << "-n" << QString::number(m_client->settings().intValue(FossilSettings::logCountKey)); + extraOptions << "-n" << QString::number(m_client.settings().intValue(FossilSettings::logCountKey)); if (features.testFlag(FossilClient::TimelineWidthFeature)) - extraOptions << "-W" << QString::number(m_client->settings().intValue(FossilSettings::timelineWidthKey)); + extraOptions << "-W" << QString::number(m_client.settings().intValue(FossilSettings::timelineWidthKey)); // disable annotate context menu for older client versions, used to be supported for current revision only bool enableAnnotationContextMenu = features.testFlag(FossilClient::AnnotateRevisionFeature); - m_client->logCurrentFile(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()), + m_client.logCurrentFile(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()), extraOptions, enableAnnotationContextMenu); } @@ -328,7 +452,7 @@ void FossilPluginPrivate::revertCurrentFile() revertUi.setupUi(&dialog); if (dialog.exec() != QDialog::Accepted) return; - m_client->revertFile(state.currentFileTopLevel(), + m_client.revertFile(state.currentFileTopLevel(), state.relativeCurrentFile(), revertUi.revisionLineEdit->text()); } @@ -337,7 +461,7 @@ void FossilPluginPrivate::statusCurrentFile() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasFile(), return); - m_client->status(state.currentFileTopLevel(), state.relativeCurrentFile()); + m_client.status(state.currentFileTopLevel(), state.relativeCurrentFile()); } void FossilPluginPrivate::createDirectoryActions(const Core::Context &context) @@ -380,21 +504,21 @@ void FossilPluginPrivate::diffRepository() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return); - m_client->diff(state.topLevel()); + m_client.diff(state.topLevel()); } void FossilPluginPrivate::logRepository() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return); - FossilClient::SupportedFeatures features = m_client->supportedFeatures(); + FossilClient::SupportedFeatures features = m_client.supportedFeatures(); QStringList extraOptions; - extraOptions << "-n" << QString::number(m_client->settings().intValue(FossilSettings::logCountKey)); + extraOptions << "-n" << QString::number(m_client.settings().intValue(FossilSettings::logCountKey)); if (features.testFlag(FossilClient::TimelineWidthFeature)) - extraOptions << "-W" << QString::number(m_client->settings().intValue(FossilSettings::timelineWidthKey)); + extraOptions << "-W" << QString::number(m_client.settings().intValue(FossilSettings::timelineWidthKey)); - m_client->log(state.topLevel(), QStringList(), extraOptions); + m_client.log(state.topLevel(), QStringList(), extraOptions); } void FossilPluginPrivate::revertAll() @@ -407,14 +531,14 @@ void FossilPluginPrivate::revertAll() revertUi.setupUi(&dialog); if (dialog.exec() != QDialog::Accepted) return; - m_client->revertAll(state.topLevel(), revertUi.revisionLineEdit->text()); + m_client.revertAll(state.topLevel(), revertUi.revisionLineEdit->text()); } void FossilPluginPrivate::statusMulti() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return); - m_client->status(state.topLevel()); + m_client.status(state.topLevel()); } void FossilPluginPrivate::createRepositoryActions(const Core::Context &context) @@ -473,14 +597,14 @@ void FossilPluginPrivate::pull() QTC_ASSERT(state.hasTopLevel(), return); PullOrPushDialog dialog(PullOrPushDialog::PullMode, Core::ICore::dialogParent()); - dialog.setLocalBaseDirectory(m_client->settings().stringValue(FossilSettings::defaultRepoPathKey)); - dialog.setDefaultRemoteLocation(m_client->synchronousGetRepositoryURL(state.topLevel())); + dialog.setLocalBaseDirectory(m_client.settings().stringValue(FossilSettings::defaultRepoPathKey)); + dialog.setDefaultRemoteLocation(m_client.synchronousGetRepositoryURL(state.topLevel())); if (dialog.exec() != QDialog::Accepted) return; QString remoteLocation(dialog.remoteLocation()); if (remoteLocation.isEmpty()) - remoteLocation = m_client->synchronousGetRepositoryURL(state.topLevel()); + remoteLocation = m_client.synchronousGetRepositoryURL(state.topLevel()); if (remoteLocation.isEmpty()) { VcsBase::VcsOutputWindow::appendError(tr("Remote repository is not defined.")); @@ -492,7 +616,7 @@ void FossilPluginPrivate::pull() extraOptions << "--once"; if (dialog.isPrivateOptionEnabled()) extraOptions << "--private"; - m_client->synchronousPull(state.topLevel(), remoteLocation, extraOptions); + m_client.synchronousPull(state.topLevel(), remoteLocation, extraOptions); } void FossilPluginPrivate::push() @@ -501,14 +625,14 @@ void FossilPluginPrivate::push() QTC_ASSERT(state.hasTopLevel(), return); PullOrPushDialog dialog(PullOrPushDialog::PushMode, Core::ICore::dialogParent()); - dialog.setLocalBaseDirectory(m_client->settings().stringValue(FossilSettings::defaultRepoPathKey)); - dialog.setDefaultRemoteLocation(m_client->synchronousGetRepositoryURL(state.topLevel())); + dialog.setLocalBaseDirectory(m_client.settings().stringValue(FossilSettings::defaultRepoPathKey)); + dialog.setDefaultRemoteLocation(m_client.synchronousGetRepositoryURL(state.topLevel())); if (dialog.exec() != QDialog::Accepted) return; QString remoteLocation(dialog.remoteLocation()); if (remoteLocation.isEmpty()) - remoteLocation = m_client->synchronousGetRepositoryURL(state.topLevel()); + remoteLocation = m_client.synchronousGetRepositoryURL(state.topLevel()); if (remoteLocation.isEmpty()) { VcsBase::VcsOutputWindow::appendError(tr("Remote repository is not defined.")); @@ -520,7 +644,7 @@ void FossilPluginPrivate::push() extraOptions << "--once"; if (dialog.isPrivateOptionEnabled()) extraOptions << "--private"; - m_client->synchronousPush(state.topLevel(), remoteLocation, extraOptions); + m_client.synchronousPush(state.topLevel(), remoteLocation, extraOptions); } void FossilPluginPrivate::update() @@ -534,7 +658,7 @@ void FossilPluginPrivate::update() dialog.setWindowTitle(tr("Update")); if (dialog.exec() != QDialog::Accepted) return; - m_client->update(state.topLevel(), revertUi.revisionLineEdit->text()); + m_client.update(state.topLevel(), revertUi.revisionLineEdit->text()); } void FossilPluginPrivate::configureRepository() @@ -545,14 +669,14 @@ void FossilPluginPrivate::configureRepository() ConfigureDialog dialog; // retrieve current settings from the repository - RepositorySettings currentSettings = m_client->synchronousSettingsQuery(state.topLevel()); + RepositorySettings currentSettings = m_client.synchronousSettingsQuery(state.topLevel()); dialog.setSettings(currentSettings); if (dialog.exec() != QDialog::Accepted) return; const RepositorySettings newSettings = dialog.settings(); - m_client->synchronousConfigureRepository(state.topLevel(), newSettings, currentSettings); + m_client.synchronousConfigureRepository(state.topLevel(), newSettings, currentSettings); } void FossilPluginPrivate::commit() @@ -568,17 +692,17 @@ void FossilPluginPrivate::commit() m_submitRepository = state.topLevel(); - connect(m_client, &VcsBase::VcsBaseClient::parsedStatus, + connect(&m_client, &VcsBaseClient::parsedStatus, this, &FossilPluginPrivate::showCommitWidget); QStringList extraOptions; - m_client->emitParsedStatus(m_submitRepository, extraOptions); + m_client.emitParsedStatus(m_submitRepository, extraOptions); } void FossilPluginPrivate::showCommitWidget(const QList &status) { //Once we receive our data release the connection so it can be reused elsewhere - disconnect(m_client, &VcsBase::VcsBaseClient::parsedStatus, + disconnect(&m_client, &VcsBaseClient::parsedStatus, this, &FossilPluginPrivate::showCommitWidget); if (status.isEmpty()) { @@ -613,10 +737,10 @@ void FossilPluginPrivate::showCommitWidget(const QListdocument()->setPreferredDisplayName(msg); - const RevisionInfo currentRevision = m_client->synchronousRevisionQuery(m_submitRepository); - const BranchInfo currentBranch = m_client->synchronousCurrentBranch(m_submitRepository); - const QString currentUser = m_client->synchronousUserDefaultQuery(m_submitRepository); - QStringList tags = m_client->synchronousTagQuery(m_submitRepository, currentRevision.id); + const RevisionInfo currentRevision = m_client.synchronousRevisionQuery(m_submitRepository); + const BranchInfo currentBranch = m_client.synchronousCurrentBranch(m_submitRepository); + const QString currentUser = m_client.synchronousUserDefaultQuery(m_submitRepository); + QStringList tags = m_client.synchronousTagQuery(m_submitRepository, currentRevision.id); // Fossil includes branch name in tag list -- remove. tags.removeAll(currentBranch.name()); commitEditor->setFields(m_submitRepository, currentBranch, tags, currentUser, status); @@ -628,7 +752,7 @@ void FossilPluginPrivate::showCommitWidget(const QListdiff(m_submitRepository, files); + m_client.diff(m_submitRepository, files); } static inline bool ask(QWidget *parent, const QString &title, const QString &question, bool defaultValue = true) @@ -740,7 +864,7 @@ bool FossilPluginPrivate::submitEditorAboutToClose() // Whether local commit or not if (commitWidget->isPrivateOptionEnabled()) extraOptions += "--private"; - m_client->commit(m_submitRepository, files, editorDocument->filePath().toString(), extraOptions); + m_client.commit(m_submitRepository, files, editorDocument->filePath().toString(), extraOptions); } return true; } @@ -782,13 +906,13 @@ Core::Id FossilPluginPrivate::id() const bool FossilPluginPrivate::isVcsFileOrDirectory(const Utils::FilePath &filePath) const { - return m_client->isVcsFileOrDirectory(filePath); + return m_client.isVcsFileOrDirectory(filePath); } bool FossilPluginPrivate::managesDirectory(const QString &directory, QString *topLevel) const { QFileInfo dir(directory); - const QString topLevelFound = m_client->findTopLevelForFile(dir); + const QString topLevelFound = m_client.findTopLevelForFile(dir); if (topLevel) *topLevel = topLevelFound; return !topLevelFound.isEmpty(); @@ -796,12 +920,12 @@ bool FossilPluginPrivate::managesDirectory(const QString &directory, QString *to bool FossilPluginPrivate::managesFile(const QString &workingDirectory, const QString &fileName) const { - return m_client->managesFile(workingDirectory, fileName); + return m_client.managesFile(workingDirectory, fileName); } bool FossilPluginPrivate::isConfigured() const { - const Utils::FilePath binary = m_client->vcsBinary(); + const Utils::FilePath binary = m_client.vcsBinary(); if (binary.isEmpty()) return false; @@ -810,7 +934,7 @@ bool FossilPluginPrivate::isConfigured() const return false; // Local repositories default path must be set and exist - const QString repoPath = m_client->settings().stringValue(FossilSettings::defaultRepoPathKey); + const QString repoPath = m_client.settings().stringValue(FossilSettings::defaultRepoPathKey); if (repoPath.isEmpty()) return false; @@ -849,33 +973,33 @@ bool FossilPluginPrivate::vcsOpen(const QString &filename) bool FossilPluginPrivate::vcsAdd(const QString &filename) { const QFileInfo fi(filename); - return m_client->synchronousAdd(fi.absolutePath(), fi.fileName()); + return m_client.synchronousAdd(fi.absolutePath(), fi.fileName()); } bool FossilPluginPrivate::vcsDelete(const QString &filename) { const QFileInfo fi(filename); - return m_client->synchronousRemove(fi.absolutePath(), fi.fileName()); + return m_client.synchronousRemove(fi.absolutePath(), fi.fileName()); } bool FossilPluginPrivate::vcsMove(const QString &from, const QString &to) { const QFileInfo fromInfo(from); const QFileInfo toInfo(to); - return m_client->synchronousMove(fromInfo.absolutePath(), + return m_client.synchronousMove(fromInfo.absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath()); } bool FossilPluginPrivate::vcsCreateRepository(const QString &directory) { - return m_client->synchronousCreateRepository(directory); + return m_client.synchronousCreateRepository(directory); } bool FossilPluginPrivate::vcsAnnotate(const QString &file, int line) { const QFileInfo fi(file); - m_client->annotate(fi.absolutePath(), fi.fileName(), QString(), line); + m_client.annotate(fi.absolutePath(), fi.fileName(), QString(), line); return true; } @@ -928,7 +1052,7 @@ Core::ShellCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QStr checkoutDir.mkpath(checkoutPath); // Setup the wizard page command job - auto command = new VcsBase::VcsCommand(checkoutDir.path(), m_client->processEnvironment()); + auto command = new VcsBase::VcsCommand(checkoutDir.path(), m_client.processEnvironment()); if (!isLocalRepository && !cloneRepository.exists()) { @@ -960,11 +1084,11 @@ Core::ShellCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QStr // So here we want Fossil to save the remote details when specified. QStringList args; - args << m_client->vcsCommandString(FossilClient::CloneCommand) + args << m_client.vcsCommandString(FossilClient::CloneCommand) << extraOptions << sourceUrl << fossilFileNative; - command->addJob({m_client->vcsBinary(), args}, -1); + command->addJob({m_client.vcsBinary(), args}, -1); } // check out the cloned repository file into the working copy directory; @@ -973,20 +1097,20 @@ Core::ShellCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QStr QStringList args({"open", fossilFileNative}); if (!checkoutBranch.isEmpty()) args << checkoutBranch; - command->addJob({m_client->vcsBinary(), args}, -1); + command->addJob({m_client.vcsBinary(), args}, -1); // set user default to admin user if specified if (!isLocalRepository && !adminUser.isEmpty()) { const QStringList args({ "user", "default", adminUser, "--user", adminUser}); - command->addJob({m_client->vcsBinary(), args}, -1); + command->addJob({m_client.vcsBinary(), args}, -1); } // turn-off autosync if requested if (!isLocalRepository && disableAutosync) { const QStringList args({"settings", "autosync", "off"}); - command->addJob({m_client->vcsBinary(), args}, -1); + command->addJob({m_client.vcsBinary(), args}, -1); } return command; @@ -1047,7 +1171,7 @@ void Fossil::Internal::FossilPlugin::testDiffFileResolving_data() void Fossil::Internal::FossilPlugin::testDiffFileResolving() { - VcsBase::VcsBaseEditorWidget::testDiffFileResolving(editorParameters[2].id); + VcsBase::VcsBaseEditorWidget::testDiffFileResolving(diffParameters.id); } void Fossil::Internal::FossilPlugin::testLogResolving() @@ -1060,6 +1184,6 @@ void Fossil::Internal::FossilPlugin::testLogResolving() " EDITED src/core/scaler.cpp\n" " EDITED src/core/scaler.h\n" ); - VcsBase::VcsBaseEditorWidget::testLogResolving(editorParameters[0].id, data, "ac6d1129b8", "56d6917c3b"); + VcsBase::VcsBaseEditorWidget::testLogResolving(fileLogParameters.id, data, "ac6d1129b8", "56d6917c3b"); } #endif diff --git a/plugins/fossil/fossilplugin.h b/plugins/fossil/fossilplugin.h index 01aa3b8b749..6d647b0706f 100644 --- a/plugins/fossil/fossilplugin.h +++ b/plugins/fossil/fossilplugin.h @@ -31,130 +31,19 @@ #include #include -QT_BEGIN_NAMESPACE -class QAction; -QT_END_NAMESPACE - namespace Core { class ActionContainer; class CommandLocator; class Id; } // namespace Core -namespace Utils { class ParameterAction; } - namespace Fossil { namespace Internal { class OptionsPage; class FossilClient; -class FossilPluginPrivate; class FossilEditorWidget; -class FossilPluginPrivate final : public VcsBase::VcsBasePluginPrivate -{ - Q_OBJECT - -public: - FossilPluginPrivate(); - - static FossilPluginPrivate *instance(); - const FossilClient *client() const; - - // IVersionControl - QString displayName() const final; - Core::Id id() const final; - - bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const final; - - bool managesDirectory(const QString &directory, QString *topLevel) const final; - bool managesFile(const QString &workingDirectory, const QString &fileName) const final; - - bool isConfigured() const final; - bool supportsOperation(Operation operation) const final; - bool vcsOpen(const QString &fileName) final; - bool vcsAdd(const QString &fileName) final; - bool vcsDelete(const QString &filename) final; - bool vcsMove(const QString &from, const QString &to) final; - bool vcsCreateRepository(const QString &directory) final; - - bool vcsAnnotate(const QString &file, int line) final; - - Core::ShellCommand *createInitialCheckoutCommand(const QString &url, - const Utils::FilePath &baseDirectory, - const QString &localName, - const QStringList &extraArgs) final; - -protected: - void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override; - bool submitEditorAboutToClose() override; - -private: - // File menu action slots - void addCurrentFile(); - void deleteCurrentFile(); - void annotateCurrentFile(); - void diffCurrentFile(); - void logCurrentFile(); - void revertCurrentFile(); - void statusCurrentFile(); - - // Directory menu action slots - void diffRepository(); - void logRepository(); - void revertAll(); - void statusMulti(); - - // Repository menu action slots - void pull(); - void push(); - void update(); - void configureRepository(); - void commit(); - void showCommitWidget(const QList &status); - void commitFromEditor() override; - void diffFromEditorSelected(const QStringList &files); - void createRepository(); - - // Methods - void createMenu(const Core::Context &context); - void createFileActions(const Core::Context &context); - void createDirectoryActions(const Core::Context &context); - void createRepositoryActions(const Core::Context &context); - - // Variables - FossilSettings m_fossilSettings; - FossilClient *m_client = nullptr; - - Core::CommandLocator *m_commandLocator = nullptr; - Core::ActionContainer *m_fossilContainer = nullptr; - - QList m_repositoryActionList; - - // Menu Items (file actions) - Utils::ParameterAction *m_addAction = nullptr; - Utils::ParameterAction *m_deleteAction = nullptr; - Utils::ParameterAction *m_annotateFile = nullptr; - Utils::ParameterAction *m_diffFile = nullptr; - Utils::ParameterAction *m_logFile = nullptr; - Utils::ParameterAction *m_renameFile = nullptr; - Utils::ParameterAction *m_revertFile = nullptr; - Utils::ParameterAction *m_statusFile = nullptr; - - QAction *m_createRepositoryAction = nullptr; - - // Submit editor actions - QAction *m_menuAction = nullptr; - - QString m_submitRepository; - bool m_submitActionTriggered = false; - - // To be connected to the VcsTask's success signal to emit the repository/ - // files changed signals according to the variant's type: - // String -> repository, StringList -> files - void changed(const QVariant &); -}; - class FossilPlugin final : public ExtensionSystem::IPlugin { Q_OBJECT @@ -165,6 +54,12 @@ class FossilPlugin final : public ExtensionSystem::IPlugin bool initialize(const QStringList &arguments, QString *errorMessage) final; void extensionsInitialized() final; +public: + static const FossilSettings &settings(); + static FossilClient *client(); + + static void showCommitWidget(const QList &status); + #ifdef WITH_TESTS private slots: void testDiffFileResolving_data(); diff --git a/plugins/fossil/optionspage.cpp b/plugins/fossil/optionspage.cpp index e9d23081630..ad42130e66a 100644 --- a/plugins/fossil/optionspage.cpp +++ b/plugins/fossil/optionspage.cpp @@ -91,8 +91,7 @@ OptionsPageWidget::OptionsPageWidget(const std::function &onApply, Fossi m_ui.disableAutosyncCheckBox->setChecked(m_settings->boolValue(FossilSettings::disableAutosyncKey)); } -OptionsPage::OptionsPage(const std::function &onApply, FossilSettings *settings, QObject *parent) : - Core::IOptionsPage(parent) +OptionsPage::OptionsPage(const std::function &onApply, FossilSettings *settings) { setId(Constants::VCS_ID_FOSSIL); setDisplayName(OptionsPageWidget::tr("Fossil")); diff --git a/plugins/fossil/optionspage.h b/plugins/fossil/optionspage.h index a00ccae16d9..411b005df4b 100644 --- a/plugins/fossil/optionspage.h +++ b/plugins/fossil/optionspage.h @@ -27,9 +27,6 @@ #include -namespace Core { class IVersionControl; } -namespace VcsBase { class VcsBaseClientSettings; } - namespace Fossil { namespace Internal { @@ -37,10 +34,8 @@ class FossilSettings; class OptionsPage : public Core::IOptionsPage { - Q_OBJECT - public: - OptionsPage(const std::function &onApply, FossilSettings *settings, QObject *parent); + OptionsPage(const std::function &onApply, FossilSettings *settings); }; } // namespace Internal From 57e8de1e0b84f1f837773ca7e6feff2a4457886c Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Fri, 31 Jan 2020 14:48:28 +0200 Subject: [PATCH 040/133] Adapt to 4.12 Change-Id: Ie49d91582dac4b130c8fcd7db2ce19249ed3f057 Reviewed-by: hjk --- plugins/fossil/fossilclient.cpp | 27 ++++++++++++++------------- plugins/fossil/fossilplugin.cpp | 4 ++-- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 092cd566a7c..16385c56360 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -150,11 +150,12 @@ public: // So we kludge this by coding it as a meta-option (pipe-separated), // then parse it out in arguments. // All-choice is a blank argument with no additional parameters - QList lineageFilterChoices; - lineageFilterChoices << ComboBoxItem(tr("Ancestors"), "ancestors") - << ComboBoxItem(tr("Descendants"), "descendants") - << ComboBoxItem(tr("Unfiltered"), ""); - mapSetting(addComboBox(QStringList("|LINEAGE|%1|current"), lineageFilterChoices), + const QList lineageFilterChoices = { + ChoiceItem(tr("Ancestors"), "ancestors"), + ChoiceItem(tr("Descendants"), "descendants"), + ChoiceItem(tr("Unfiltered"), "") + }; + mapSetting(addChoices(tr("Lineage"), QStringList("|LINEAGE|%1|current"), lineageFilterChoices), settings.stringPointer(FossilSettings::timelineLineageFilterKey)); } @@ -173,20 +174,20 @@ public: VcsBase::VcsBaseClientSettings &settings = m_client->settings(); // option: -t - const QList itemTypeChoices = { - ComboBoxItem(tr("All Items"), "all"), - ComboBoxItem(tr("File Commits"), "ci"), - ComboBoxItem(tr("Technical Notes"), "e"), - ComboBoxItem(tr("Tags"), "g"), - ComboBoxItem(tr("Tickets"), "t"), - ComboBoxItem(tr("Wiki Commits"), "w") + const QList itemTypeChoices = { + ChoiceItem(tr("All Items"), "all"), + ChoiceItem(tr("File Commits"), "ci"), + ChoiceItem(tr("Technical Notes"), "e"), + ChoiceItem(tr("Tags"), "g"), + ChoiceItem(tr("Tickets"), "t"), + ChoiceItem(tr("Wiki Commits"), "w") }; // here we setup the ComboBox to map to the "-t ", which will produce // the enquoted option-values (e.g "-t all"). // Fossil expects separate arguments for option and value ( i.e. "-t" "all") // so we need to handle the splitting explicitly in arguments(). - mapSetting(addComboBox(QStringList("-t %1"), itemTypeChoices), + mapSetting(addChoices(tr("Item Types"), QStringList("-t %1"), itemTypeChoices), settings.stringPointer(FossilSettings::timelineItemTypeKey)); } diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index e811443daf9..88d93ca898b 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -1171,7 +1171,7 @@ void Fossil::Internal::FossilPlugin::testDiffFileResolving_data() void Fossil::Internal::FossilPlugin::testDiffFileResolving() { - VcsBase::VcsBaseEditorWidget::testDiffFileResolving(diffParameters.id); + VcsBase::VcsBaseEditorWidget::testDiffFileResolving(dd->diffFactory); } void Fossil::Internal::FossilPlugin::testLogResolving() @@ -1184,6 +1184,6 @@ void Fossil::Internal::FossilPlugin::testLogResolving() " EDITED src/core/scaler.cpp\n" " EDITED src/core/scaler.h\n" ); - VcsBase::VcsBaseEditorWidget::testLogResolving(fileLogParameters.id, data, "ac6d1129b8", "56d6917c3b"); + VcsBase::VcsBaseEditorWidget::testLogResolving(dd->fileLogFactory, data, "ac6d1129b8", "56d6917c3b"); } #endif From 2ccf5c1154c3f24ad0d82d7f7b30d3b594302287 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 19 Feb 2020 23:30:43 +0200 Subject: [PATCH 041/133] Adapt to upstream changes Change-Id: Icc1f048523381e949a7eb824e373af6d4c3ceba3 Reviewed-by: hjk --- plugins/fossil/fossileditor.cpp | 40 ++++----------------------------- plugins/fossil/fossileditor.h | 1 - 2 files changed, 4 insertions(+), 37 deletions(-) diff --git a/plugins/fossil/fossileditor.cpp b/plugins/fossil/fossileditor.cpp index 92fd9355be4..7035f90ec8c 100644 --- a/plugins/fossil/fossileditor.cpp +++ b/plugins/fossil/fossileditor.cpp @@ -49,19 +49,13 @@ class FossilEditorWidgetPrivate { public: FossilEditorWidgetPrivate() : - m_exactChangesetId(Constants::CHANGESET_ID_EXACT), - m_firstChangesetId(QString("\n") + Constants::CHANGESET_ID + " "), - m_nextChangesetId(m_firstChangesetId) + m_exactChangesetId(Constants::CHANGESET_ID_EXACT) { QTC_ASSERT(m_exactChangesetId.isValid(), return); - QTC_ASSERT(m_firstChangesetId.isValid(), return); - QTC_ASSERT(m_nextChangesetId.isValid(), return); } const QRegularExpression m_exactChangesetId; - const QRegularExpression m_firstChangesetId; - const QRegularExpression m_nextChangesetId; }; FossilEditorWidget::FossilEditorWidget() : @@ -70,13 +64,14 @@ FossilEditorWidget::FossilEditorWidget() : setAnnotateRevisionTextFormat(tr("&Annotate %1")); setAnnotatePreviousRevisionTextFormat(tr("Annotate &Parent Revision %1")); - const QRegExp exactDiffFileIdPattern(Constants::DIFFFILE_ID_EXACT); + const QRegularExpression exactDiffFileIdPattern(Constants::DIFFFILE_ID_EXACT); QTC_ASSERT(exactDiffFileIdPattern.isValid(), return); setDiffFilePattern(exactDiffFileIdPattern); - const QRegExp logChangePattern("^.*\\[([0-9a-f]{5,40})\\]"); + const QRegularExpression logChangePattern("^.*\\[([0-9a-f]{5,40})\\]"); QTC_ASSERT(logChangePattern.isValid(), return); setLogEntryPattern(logChangePattern); + setAnnotationEntryPattern(QString("^") + Constants::CHANGESET_ID + " "); } FossilEditorWidget::~FossilEditorWidget() @@ -84,33 +79,6 @@ FossilEditorWidget::~FossilEditorWidget() delete d; } -QSet FossilEditorWidget::annotationChanges() const -{ - - const QString txt = toPlainText(); - if (txt.isEmpty()) - return QSet(); - - // extract changeset id at the beginning of each annotated line: - // ...: - - QSet changes; - - QRegularExpressionMatch firstChangesetIdMatch = d->m_firstChangesetId.match(txt); - if (firstChangesetIdMatch.hasMatch()) { - QString changeId = firstChangesetIdMatch.captured(1); - changes.insert(changeId); - - QRegularExpressionMatchIterator i = d->m_nextChangesetId.globalMatch(txt); - while (i.hasNext()) { - const QRegularExpressionMatch nextChangesetIdMatch = i.next(); - changeId = nextChangesetIdMatch.captured(1); - changes.insert(changeId); - } - } - return changes; -} - QString FossilEditorWidget::changeUnderCursor(const QTextCursor &cursorIn) const { QTextCursor cursor = cursorIn; diff --git a/plugins/fossil/fossileditor.h b/plugins/fossil/fossileditor.h index db43d411da4..c9612f1a61a 100644 --- a/plugins/fossil/fossileditor.h +++ b/plugins/fossil/fossileditor.h @@ -41,7 +41,6 @@ public: ~FossilEditorWidget() final; private: - QSet annotationChanges() const final; QString changeUnderCursor(const QTextCursor &cursor) const final; QString decorateVersion(const QString &revision) const final; QStringList annotationPreviousVersions(const QString &revision) const final; From b6908dee096c62ff4f84e87bfaf89b5841fae63a Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Fri, 21 Feb 2020 11:39:04 +0200 Subject: [PATCH 042/133] Adapt to 4.12 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ibef89fafaa5a0ae89d2653219217c617cd918839 Reviewed-by: André Hartmann --- plugins/fossil/fossileditor.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/plugins/fossil/fossileditor.cpp b/plugins/fossil/fossileditor.cpp index 7035f90ec8c..826c705b169 100644 --- a/plugins/fossil/fossileditor.cpp +++ b/plugins/fossil/fossileditor.cpp @@ -63,14 +63,8 @@ FossilEditorWidget::FossilEditorWidget() : { setAnnotateRevisionTextFormat(tr("&Annotate %1")); setAnnotatePreviousRevisionTextFormat(tr("Annotate &Parent Revision %1")); - - const QRegularExpression exactDiffFileIdPattern(Constants::DIFFFILE_ID_EXACT); - QTC_ASSERT(exactDiffFileIdPattern.isValid(), return); - setDiffFilePattern(exactDiffFileIdPattern); - - const QRegularExpression logChangePattern("^.*\\[([0-9a-f]{5,40})\\]"); - QTC_ASSERT(logChangePattern.isValid(), return); - setLogEntryPattern(logChangePattern); + setDiffFilePattern(Constants::DIFFFILE_ID_EXACT); + setLogEntryPattern("^.*\\[([0-9a-f]{5,40})\\]"); setAnnotationEntryPattern(QString("^") + Constants::CHANGESET_ID + " "); } From 9a64faff10162200c31babbccb3a1d9d6acd082d Mon Sep 17 00:00:00 2001 From: Artur Shepilko Date: Mon, 15 Jun 2020 17:56:47 -0500 Subject: [PATCH 043/133] Import wizard: Fix the auto pre-fill of the 'Local clone' name Change-Id: I5460c2a02b5be7e69600cb424ed168f969e2ca05 Reviewed-by: Orgad Shaneh --- plugins/fossil/wizard/projects/vcs/wizard.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/fossil/wizard/projects/vcs/wizard.json b/plugins/fossil/wizard/projects/vcs/wizard.json index fba22bb2e7e..56e08b63774 100644 --- a/plugins/fossil/wizard/projects/vcs/wizard.json +++ b/plugins/fossil/wizard/projects/vcs/wizard.json @@ -15,8 +15,8 @@ { "key": "vcsName", "value": "%{JS: Vcs.displayName('%{vcsId}')}" }, { "key": "isCloneRepo", "value": "%{JS: '%{RepoType}' === 'cloneRepo' }" }, { "key": "isLocalRepo", "value": "%{JS: '%{RepoType}' === 'localRepo' }" }, - { "key": "SR", "value": "%{JS: '%{Repo}'.replace(/\\.(fossil|fsl)$/, '') }"}, - { "key": "defaultDir", "value": "%{JS: %{isCloneRepo} ? '%{SR}'.substr('%{SR}'.lastIndexOf('/') + 1).replace(/\\./, '-') : %{isLocalRepo} ? Util.baseName('%{LocalRepo}') : '' }"}, + { "key": "SR", "value": "%{JS: '%{Repo}'.substr('%{Repo}'.indexOf(':') + 1).replace(/[^/@]+@/,'').replace(/:[0-9]+$/,'').replace(/[.](fossil|fsl)$/, '') }"}, + { "key": "defaultDir", "value": "%{JS: %{isCloneRepo} ? '%{SR}'.substr('%{SR}'.lastIndexOf('/') + 1).replace(/[.:\"]+/g, '-') : %{isLocalRepo} ? Util.baseName('%{LocalRepo}') : '' }"}, { "key": "defaultFossilName", "value": "%{JS: %{isCloneRepo} ? '%{defaultDir}' : %{isLocalRepo} ? Util.completeBaseName('%{LocalRepo}') : '' }" }, { "key": "defaultLocalRepoPath", "value": "%{JS: Fossil.defaultLocalRepoPath() }" }, { "key": "defaultSslIdentityFile", "value": "%{JS: Fossil.defaultSslIdentityFile() }" }, From 30b04ca9190f139498f59b7e75eea19933ceec4f Mon Sep 17 00:00:00 2001 From: Artur Shepilko Date: Mon, 15 Jun 2020 19:22:59 -0500 Subject: [PATCH 044/133] Push/pull: Fix the handling of the Default URL On a successful push/pull operation, Fossil allows user to save the used remote URL, such that the next time it would be used by default. With Fossil plugin, the user is allowed to choose the saved Default location, also it's pre-filled in Remote URL field. A choice is offered to save the newly entered Remote URL, otherwise the entered URL is used only once without saving. To use the Default URL, Fossil push/pull command should be called without specifying any URL explicitly. Otherwise, Fossil client displays a prompt asking whether to save it, even when it matches the currently stored one. Change-Id: I3f517be4b60bef5bf1f5bca19345078ef6d6dda2 Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 24 ++++++---- plugins/fossil/fossilplugin.cpp | 81 ++++++++++++++++----------------- 2 files changed, 55 insertions(+), 50 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 16385c56360..a2817d0047a 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -711,11 +711,15 @@ bool FossilClient::synchronousMove(const QString &workingDir, bool FossilClient::synchronousPull(const QString &workingDir, const QString &srcLocation, const QStringList &extraOptions) { - const QString remoteLocation = (!srcLocation.isEmpty() ? srcLocation : synchronousGetRepositoryURL(workingDir)); - if (remoteLocation.isEmpty()) - return false; + QStringList args(vcsCommandString(PullCommand)); + if (srcLocation.isEmpty()) { + const QString defaultURL(synchronousGetRepositoryURL(workingDir)); + if (defaultURL.isEmpty()) + return false; + } else { + args << srcLocation; + } - QStringList args({vcsCommandString(PullCommand), remoteLocation}); args << extraOptions; // Disable UNIX terminals to suppress SSH prompting const unsigned flags = @@ -731,11 +735,15 @@ bool FossilClient::synchronousPull(const QString &workingDir, const QString &src bool FossilClient::synchronousPush(const QString &workingDir, const QString &dstLocation, const QStringList &extraOptions) { - const QString remoteLocation = (!dstLocation.isEmpty() ? dstLocation : synchronousGetRepositoryURL(workingDir)); - if (remoteLocation.isEmpty()) - return false; + QStringList args(vcsCommandString(PushCommand)); + if (dstLocation.isEmpty()) { + const QString defaultURL(synchronousGetRepositoryURL(workingDir)); + if (defaultURL.isEmpty()) + return false; + } else { + args << dstLocation; + } - QStringList args({vcsCommandString(PushCommand), remoteLocation}); args << extraOptions; // Disable UNIX terminals to suppress SSH prompting const unsigned flags = diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 88d93ca898b..a83d547f713 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -139,6 +139,11 @@ class FossilPluginPrivate final : public VcsBase::VcsBasePluginPrivate Q_DECLARE_TR_FUNCTIONS(Fossil::Internal::FossilPlugin) public: + enum SyncMode { + SyncPull, + SyncPush + }; + FossilPluginPrivate(); // IVersionControl @@ -184,8 +189,8 @@ public: void statusMulti(); // Repository menu action slots - void pull(); - void push(); + void pull() { pullOrPush(SyncPull); } + void push() { pullOrPush(SyncPush); } void update(); void configureRepository(); void commit(); @@ -201,6 +206,7 @@ public: void createRepositoryActions(const Core::Context &context); void describe(const QString &source, const QString &id) { m_client.view(source, id); }; + bool pullOrPush(SyncMode mode); // Variables FossilSettings m_fossilSettings; @@ -591,60 +597,51 @@ void FossilPluginPrivate::createRepositoryActions(const Core::Context &context) m_fossilContainer->addAction(command); } -void FossilPluginPrivate::pull() +bool FossilPluginPrivate::pullOrPush(FossilPluginPrivate::SyncMode mode) { - const VcsBase::VcsBasePluginState state = currentState(); - QTC_ASSERT(state.hasTopLevel(), return); + PullOrPushDialog::Mode pullOrPushMode; + switch (mode) { + case SyncPull: + pullOrPushMode = PullOrPushDialog::PullMode; + break; + case SyncPush: + pullOrPushMode = PullOrPushDialog::PushMode; + break; + default: + return false; + } - PullOrPushDialog dialog(PullOrPushDialog::PullMode, Core::ICore::dialogParent()); + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasTopLevel(), return false); + + PullOrPushDialog dialog(pullOrPushMode, Core::ICore::dialogParent()); dialog.setLocalBaseDirectory(m_client.settings().stringValue(FossilSettings::defaultRepoPathKey)); - dialog.setDefaultRemoteLocation(m_client.synchronousGetRepositoryURL(state.topLevel())); + const QString defaultURL(m_client.synchronousGetRepositoryURL(state.topLevel())); + dialog.setDefaultRemoteLocation(defaultURL); if (dialog.exec() != QDialog::Accepted) - return; + return true; QString remoteLocation(dialog.remoteLocation()); - if (remoteLocation.isEmpty()) - remoteLocation = m_client.synchronousGetRepositoryURL(state.topLevel()); - - if (remoteLocation.isEmpty()) { + if (remoteLocation.isEmpty() && defaultURL.isEmpty()) { VcsBase::VcsOutputWindow::appendError(tr("Remote repository is not defined.")); - return; + return false; + } else if (remoteLocation == defaultURL) { + remoteLocation.clear(); } QStringList extraOptions; - if (!dialog.isRememberOptionEnabled()) + if (!remoteLocation.isEmpty() && !dialog.isRememberOptionEnabled()) extraOptions << "--once"; if (dialog.isPrivateOptionEnabled()) extraOptions << "--private"; - m_client.synchronousPull(state.topLevel(), remoteLocation, extraOptions); -} - -void FossilPluginPrivate::push() -{ - const VcsBase::VcsBasePluginState state = currentState(); - QTC_ASSERT(state.hasTopLevel(), return); - - PullOrPushDialog dialog(PullOrPushDialog::PushMode, Core::ICore::dialogParent()); - dialog.setLocalBaseDirectory(m_client.settings().stringValue(FossilSettings::defaultRepoPathKey)); - dialog.setDefaultRemoteLocation(m_client.synchronousGetRepositoryURL(state.topLevel())); - if (dialog.exec() != QDialog::Accepted) - return; - - QString remoteLocation(dialog.remoteLocation()); - if (remoteLocation.isEmpty()) - remoteLocation = m_client.synchronousGetRepositoryURL(state.topLevel()); - - if (remoteLocation.isEmpty()) { - VcsBase::VcsOutputWindow::appendError(tr("Remote repository is not defined.")); - return; + switch (mode) { + case SyncPull: + return m_client.synchronousPull(state.topLevel(), remoteLocation, extraOptions); + case SyncPush: + return m_client.synchronousPush(state.topLevel(), remoteLocation, extraOptions); + default: + return false; } - - QStringList extraOptions; - if (!dialog.isRememberOptionEnabled()) - extraOptions << "--once"; - if (dialog.isPrivateOptionEnabled()) - extraOptions << "--private"; - m_client.synchronousPush(state.topLevel(), remoteLocation, extraOptions); } void FossilPluginPrivate::update() From 3d7697667d431a678ebddc96e8fc0ae78755ef2d Mon Sep 17 00:00:00 2001 From: Artur Shepilko Date: Wed, 17 Jun 2020 11:22:31 -0500 Subject: [PATCH 045/133] Adapt to Fossil client version 2.12 Fossil 2.12 changes the output of 'info' command replacing the label that attributes the check-out's hash-id from 'uuid' to 'hash' [1]. [1]: https://fossil-scm.org/fossil/info/8ad5e4690854a81 "src/info.c" Change-Id: I1277d784c377ee37434abc017db748d16353b31e Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 14 +++++++++----- plugins/fossil/fossilclient.h | 2 ++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index a2817d0047a..ead861da5e5 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -392,9 +392,12 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect const QRegularExpression idRx("([0-9a-f]{5,40})"); QTC_ASSERT(idRx.isValid(), return RevisionInfo()); + const QString hashToken = + (supportedFeatures().testFlag(InfoHashFeature) ? "hash: " : "uuid: "); + for (const QString &l : output.split('\n', QString::SkipEmptyParts)) { if (l.startsWith("checkout: ", Qt::CaseInsensitive) - || l.startsWith("uuid: ", Qt::CaseInsensitive)) { + || l.startsWith(hashToken, Qt::CaseInsensitive)) { const QRegularExpressionMatch idMatch = idRx.match(l); QTC_ASSERT(idMatch.hasMatch(), return RevisionInfo()); revisionId = idMatch.captured(1); @@ -407,8 +410,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect const QRegularExpressionMatch idMatch = idRx.match(l); if (idMatch.hasMatch()) mergeParentIds.append(idMatch.captured(1)); - } else if (getCommentMsg - && l.startsWith("comment: ", Qt::CaseInsensitive)) { + } else if (getCommentMsg && l.startsWith("comment: ", Qt::CaseInsensitive)) { const QStringList commentLineParts = parseRevisionCommentLine(l); commentMsg = commentLineParts.value(0); committer = commentLineParts.value(1); @@ -891,8 +893,10 @@ FossilClient::SupportedFeatures FossilClient::supportedFeatures() const const unsigned int version = binaryVersion(); - if (version < 0x20400) { - features &= ~AnnotateRevisionFeature; + if (version < 0x21200) { + features &= ~InfoHashFeature; + if (version < 0x20400) + features &= ~AnnotateRevisionFeature; if (version < 0x13000) features &= ~TimelinePathFeature; if (version < 0x12900) diff --git a/plugins/fossil/fossilclient.h b/plugins/fossil/fossilclient.h index 7c9fba07785..20f32142e07 100644 --- a/plugins/fossil/fossilclient.h +++ b/plugins/fossil/fossilclient.h @@ -49,12 +49,14 @@ public: DiffIgnoreWhiteSpaceFeature = 0x8, TimelinePathFeature = 0x10, AnnotateRevisionFeature = 0x20, + InfoHashFeature = 0x40, AllSupportedFeatures = // | all defined features AnnotateBlameFeature | TimelineWidthFeature | DiffIgnoreWhiteSpaceFeature | TimelinePathFeature | AnnotateRevisionFeature + | InfoHashFeature }; Q_DECLARE_FLAGS(SupportedFeatures, SupportedFeature) From 53fc320b7264e19a5ae12ede2c120acaa151240b Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 18 Jun 2020 00:11:00 +0300 Subject: [PATCH 046/133] Adapt to upstream changes Change-Id: I964746d7c34cdf6a23cb027cbf6987b21a6b079f Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilplugin.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index a83d547f713..ac68ec18547 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -163,7 +163,8 @@ public: bool vcsMove(const QString &from, const QString &to) final; bool vcsCreateRepository(const QString &directory) final; - bool vcsAnnotate(const QString &file, int line) final; + void vcsAnnotate(const QString &file, int line) final; + void vcsDescribe(const QString &source, const QString &id) final { m_client.view(source, id); } Core::ShellCommand *createInitialCheckoutCommand(const QString &url, const Utils::FilePath &baseDirectory, @@ -205,7 +206,6 @@ public: void createDirectoryActions(const Core::Context &context); void createRepositoryActions(const Core::Context &context); - void describe(const QString &source, const QString &id) { m_client.view(source, id); }; bool pullOrPush(SyncMode mode); // Variables @@ -223,19 +223,19 @@ public: VcsEditorFactory fileLogFactory { &fileLogParameters, [] { return new FossilEditorWidget; }, - std::bind(&FossilPluginPrivate::describe, this, _1, _2) + std::bind(&FossilPluginPrivate::vcsDescribe, this, _1, _2) }; VcsEditorFactory annotateLogFactory { &annotateLogParameters, [] { return new FossilEditorWidget; }, - std::bind(&FossilPluginPrivate::describe, this, _1, _2) + std::bind(&FossilPluginPrivate::vcsDescribe, this, _1, _2) }; VcsEditorFactory diffFactory { &diffParameters, [] { return new FossilEditorWidget; }, - std::bind(&FossilPluginPrivate::describe, this, _1, _2) + std::bind(&FossilPluginPrivate::vcsDescribe, this, _1, _2) }; Core::CommandLocator *m_commandLocator = nullptr; @@ -993,11 +993,10 @@ bool FossilPluginPrivate::vcsCreateRepository(const QString &directory) return m_client.synchronousCreateRepository(directory); } -bool FossilPluginPrivate::vcsAnnotate(const QString &file, int line) +void FossilPluginPrivate::vcsAnnotate(const QString &file, int line) { const QFileInfo fi(file); m_client.annotate(fi.absolutePath(), fi.fileName(), QString(), line); - return true; } Core::ShellCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QString &sourceUrl, From 6ab75271a8e7d07bd3456493d4749bf7094bd3be Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 22 Jun 2020 16:23:20 +0200 Subject: [PATCH 047/133] Adapt to upstream change Id moved from Core to Utils. Remove unused and now wrong forward declaration. Change-Id: I6742a6df3e4d6e1babbb774259d815e50c78a9e1 Reviewed-by: hjk --- plugins/fossil/fossilplugin.h | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/fossil/fossilplugin.h b/plugins/fossil/fossilplugin.h index 6d647b0706f..e8257eb854c 100644 --- a/plugins/fossil/fossilplugin.h +++ b/plugins/fossil/fossilplugin.h @@ -34,7 +34,6 @@ namespace Core { class ActionContainer; class CommandLocator; -class Id; } // namespace Core namespace Fossil { From cef9a471e64cb9bac4d88923ca4a96c84f0f92ca Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 7 Jul 2020 11:47:13 +0200 Subject: [PATCH 048/133] Fix build after upstream change Use Utils::Id. The upstream files no longer automatically include the Core::Id wrapper. Change-Id: I7b4d6ef865df44b47e07248bb653a913ba68c494 Reviewed-by: hjk --- plugins/fossil/fossilclient.cpp | 12 ++++++------ plugins/fossil/fossilclient.h | 2 +- plugins/fossil/fossilplugin.cpp | 6 +++--- plugins/fossil/wizard/fossiljsextension.cpp | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index ead861da5e5..f52a06fd755 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -772,7 +772,7 @@ VcsBase::VcsBaseEditorWidget *FossilClient::annotate( // annotate shows line numbers QString vcsCmdString = vcsCommandString(AnnotateCommand); - const Core::Id kind = vcsEditorKind(AnnotateCommand); + const Id kind = vcsEditorKind(AnnotateCommand); const QString id = VcsBase::VcsBaseEditor::getTitleId(workingDir, QStringList(file), revision); const QString title = vcsEditorTitle(vcsCmdString, id); const QString source = VcsBase::VcsBaseEditor::getSource(workingDir, file); @@ -924,7 +924,7 @@ void FossilClient::view(const QString &source, const QString &id, const QStringL << "-v" << extraOptions; - const Core::Id kind = vcsEditorKind(DiffCommand); + const Id kind = vcsEditorKind(DiffCommand); const QString title = vcsEditorTitle(vcsCommandString(DiffCommand), id); VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, @@ -995,7 +995,7 @@ void FossilClient::log(const QString &workingDir, const QStringList &files, } const QString vcsCmdString = vcsCommandString(LogCommand); - const Core::Id kind = vcsEditorKind(LogCommand); + const Id kind = vcsEditorKind(LogCommand); const QString id = VcsBase::VcsBaseEditor::getTitleId(workingDir, files); const QString title = vcsEditorTitle(vcsCmdString, id); const QString source = VcsBase::VcsBaseEditor::getSource(workingDir, files); @@ -1047,7 +1047,7 @@ void FossilClient::logCurrentFile(const QString &workingDir, const QStringList & } const QString vcsCmdString = "finfo"; - const Core::Id kind = vcsEditorKind(LogCommand); + const Id kind = vcsEditorKind(LogCommand); const QString id = VcsBase::VcsBaseEditor::getTitleId(workingDir, files); const QString title = vcsEditorTitle(vcsCmdString, id); const QString source = VcsBase::VcsBaseEditor::getSource(workingDir, files); @@ -1157,7 +1157,7 @@ QString FossilClient::vcsCommandString(VcsCommandTag cmd) const } } -Core::Id FossilClient::vcsEditorKind(VcsCommandTag cmd) const +Id FossilClient::vcsEditorKind(VcsCommandTag cmd) const { switch (cmd) { case AnnotateCommand: @@ -1167,7 +1167,7 @@ Core::Id FossilClient::vcsEditorKind(VcsCommandTag cmd) const case LogCommand: return Constants::FILELOG_ID; default: - return Core::Id(); + return Id(); } } diff --git a/plugins/fossil/fossilclient.h b/plugins/fossil/fossilclient.h index 20f32142e07..8cc64ae1911 100644 --- a/plugins/fossil/fossilclient.h +++ b/plugins/fossil/fossilclient.h @@ -122,7 +122,7 @@ private: QString sanitizeFossilOutput(const QString &output) const; QString vcsCommandString(VcsCommandTag cmd) const final; - Core::Id vcsEditorKind(VcsCommandTag cmd) const final; + Utils::Id vcsEditorKind(VcsCommandTag cmd) const final; QStringList revisionSpec(const QString &revision) const final; StatusItem parseStatusLine(const QString &line) const final; VcsBase::VcsBaseEditorConfig *createAnnotateEditor(VcsBase::VcsBaseEditorWidget *editor); diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index ac68ec18547..a1fc2302397 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -148,7 +148,7 @@ public: // IVersionControl QString displayName() const final; - Core::Id id() const final; + Id id() const final; bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const final; @@ -896,9 +896,9 @@ QString FossilPluginPrivate::displayName() const return tr("Fossil"); } -Core::Id FossilPluginPrivate::id() const +Id FossilPluginPrivate::id() const { - return Core::Id(Constants::VCS_ID_FOSSIL); + return Id(Constants::VCS_ID_FOSSIL); } bool FossilPluginPrivate::isVcsFileOrDirectory(const Utils::FilePath &filePath) const diff --git a/plugins/fossil/wizard/fossiljsextension.cpp b/plugins/fossil/wizard/fossiljsextension.cpp index 0908278437f..a0281f803d4 100644 --- a/plugins/fossil/wizard/fossiljsextension.cpp +++ b/plugins/fossil/wizard/fossiljsextension.cpp @@ -47,7 +47,7 @@ public: { } - Core::Id m_vscId; + Utils::Id m_vscId; VcsBase::VcsBaseClientSettings *m_settings; }; From a0f4ce71e81dcf40e6c4c04f0fd87749ae71fd42 Mon Sep 17 00:00:00 2001 From: Artur Shepilko Date: Thu, 16 Jul 2020 14:23:14 -0500 Subject: [PATCH 049/133] Work around MSVC error initializing QString from const char * This deals with the error while compiling with MSVC 2017: fossilclient.cpp(398): error C2440: 'initializing': cannot convert from 'const char *' to 'QString' fossilclient.cpp(398): note: No constructor could take the source type, or constructor overload resolution was ambiguous No problem building that with gcc. Change-Id: Iddb9754cd5010505b182ca9b81e390a7c3b8fdda Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index ead861da5e5..87fd407c6f3 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -393,7 +393,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect QTC_ASSERT(idRx.isValid(), return RevisionInfo()); const QString hashToken = - (supportedFeatures().testFlag(InfoHashFeature) ? "hash: " : "uuid: "); + QString::fromUtf8(supportedFeatures().testFlag(InfoHashFeature) ? "hash: " : "uuid: "); for (const QString &l : output.split('\n', QString::SkipEmptyParts)) { if (l.startsWith("checkout: ", Qt::CaseInsensitive) From 1e3721c8742171ba0a34dfe36636d24fe69fbd5b Mon Sep 17 00:00:00 2001 From: Artur Shepilko Date: Sat, 18 Jul 2020 11:52:03 -0500 Subject: [PATCH 050/133] Use Utils::SkipEmptyParts instead of the deprecated one in QString - Qt 5.14 introduced Qt::Keep/SkipEmptyParts and deprecated these in QString namespace. - Qt Creator defined Utils::SkipEmptyParts conditional on the Qt version, so we use that for flexibility. - Remove any explicit references to QString::KeepEmptyParts, as it's a default value. Change-Id: I72c65e4901ebc4c5422d4835e63fe23fb6ef28ff Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 11 ++++++----- plugins/fossil/fossilcommitwidget.cpp | 3 ++- plugins/fossil/fossilplugin.cpp | 3 ++- plugins/fossil/wizard/fossiljsextension.cpp | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 045cdad0892..b95a48e2a36 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -282,7 +283,7 @@ QList FossilClient::branchListFromOutput(const QString &output, cons // Branch list format: // " branch-name" // "* current-branch" - return Utils::transform(output.split('\n', QString::SkipEmptyParts), [=](const QString& l) { + return Utils::transform(output.split('\n', Utils::SkipEmptyParts), [=](const QString& l) { const QString &name = l.mid(2); QTC_ASSERT(!name.isEmpty(), return BranchInfo()); const BranchInfo::BranchFlags flags = (l.startsWith("* ") ? defaultFlags | BranchInfo::Current : defaultFlags); @@ -395,7 +396,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect const QString hashToken = QString::fromUtf8(supportedFeatures().testFlag(InfoHashFeature) ? "hash: " : "uuid: "); - for (const QString &l : output.split('\n', QString::SkipEmptyParts)) { + for (const QString &l : output.split('\n', Utils::SkipEmptyParts)) { if (l.startsWith("checkout: ", Qt::CaseInsensitive) || l.startsWith(hashToken, Qt::CaseInsensitive)) { const QRegularExpressionMatch idMatch = idRx.match(l); @@ -446,7 +447,7 @@ QStringList FossilClient::synchronousTagQuery(const QString &workingDirectory, c const QString output = sanitizeFossilOutput(response.stdOut()); - return output.split('\n', QString::SkipEmptyParts); + return output.split('\n', Utils::SkipEmptyParts); } RepositorySettings FossilClient::synchronousSettingsQuery(const QString &workingDirectory) @@ -468,12 +469,12 @@ RepositorySettings FossilClient::synchronousSettingsQuery(const QString &working const QString output = sanitizeFossilOutput(response.stdOut()); - for (const QString &line : output.split('\n', QString::SkipEmptyParts)) { + for (const QString &line : output.split('\n', Utils::SkipEmptyParts)) { // parse settings line: // <(local|global)> // Fossil properties are case-insensitive; force them to lower-case. // Values may be in mixed-case; force lower-case for fixed values. - const QStringList fields = line.split(' ', QString::SkipEmptyParts); + const QStringList fields = line.split(' ', Utils::SkipEmptyParts); const QString property = fields.at(0).toLower(); const QString value = (fields.size() >= 3 ? fields.at(2) : QString()); diff --git a/plugins/fossil/fossilcommitwidget.cpp b/plugins/fossil/fossilcommitwidget.cpp index 73baf9e4c41..d1994dba789 100644 --- a/plugins/fossil/fossilcommitwidget.cpp +++ b/plugins/fossil/fossilcommitwidget.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -122,7 +123,7 @@ QStringList FossilCommitWidget::tags() const return QStringList(); tagsText.replace(',', ' '); - const QStringList tags = tagsText.split(' ', QString::SkipEmptyParts); + const QStringList tags = tagsText.split(' ', Utils::SkipEmptyParts); return tags; } diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index a1fc2302397..898c7197aa1 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -57,6 +57,7 @@ #include #include +#include #include #include @@ -834,7 +835,7 @@ bool FossilPluginPrivate::submitEditorAboutToClose() //rewrite entries of the form 'file => newfile' to 'newfile' because //this would mess the commit command for (QStringList::iterator iFile = files.begin(); iFile != files.end(); ++iFile) { - const QStringList parts = iFile->split(" => ", QString::SkipEmptyParts); + const QStringList parts = iFile->split(" => ", Utils::SkipEmptyParts); if (!parts.isEmpty()) *iFile = parts.last(); } diff --git a/plugins/fossil/wizard/fossiljsextension.cpp b/plugins/fossil/wizard/fossiljsextension.cpp index a0281f803d4..c8fdf18c651 100644 --- a/plugins/fossil/wizard/fossiljsextension.cpp +++ b/plugins/fossil/wizard/fossiljsextension.cpp @@ -59,7 +59,7 @@ void FossilJsExtension::parseArgOptions(const QStringList &args, QMap 1 ? opt[1] : QString()); } } From eedbcde445c4bd006480297fd6f99e592e297e01 Mon Sep 17 00:00:00 2001 From: Artur Shepilko Date: Sat, 18 Jul 2020 11:52:03 -0500 Subject: [PATCH 051/133] Use Utils::SkipEmptyParts instead of the deprecated one in QString - Qt 5.14 introduced Qt::Keep/SkipEmptyParts and deprecated these in QString namespace. - Qt Creator defined Utils::SkipEmptyParts conditional on the Qt version, so we use that for flexibility. - Remove any explicit references to QString::KeepEmptyParts, as it's a default value. Change-Id: I72c65e4901ebc4c5422d4835e63fe23fb6ef28ff Reviewed-by: Orgad Shaneh (cherry picked from commit 1e3721c8742171ba0a34dfe36636d24fe69fbd5b) --- plugins/fossil/fossilclient.cpp | 11 ++++++----- plugins/fossil/fossilcommitwidget.cpp | 3 ++- plugins/fossil/fossilplugin.cpp | 3 ++- plugins/fossil/wizard/fossiljsextension.cpp | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index f52a06fd755..2a01aa2f60f 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -282,7 +283,7 @@ QList FossilClient::branchListFromOutput(const QString &output, cons // Branch list format: // " branch-name" // "* current-branch" - return Utils::transform(output.split('\n', QString::SkipEmptyParts), [=](const QString& l) { + return Utils::transform(output.split('\n', Utils::SkipEmptyParts), [=](const QString& l) { const QString &name = l.mid(2); QTC_ASSERT(!name.isEmpty(), return BranchInfo()); const BranchInfo::BranchFlags flags = (l.startsWith("* ") ? defaultFlags | BranchInfo::Current : defaultFlags); @@ -395,7 +396,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect const QString hashToken = (supportedFeatures().testFlag(InfoHashFeature) ? "hash: " : "uuid: "); - for (const QString &l : output.split('\n', QString::SkipEmptyParts)) { + for (const QString &l : output.split('\n', Utils::SkipEmptyParts)) { if (l.startsWith("checkout: ", Qt::CaseInsensitive) || l.startsWith(hashToken, Qt::CaseInsensitive)) { const QRegularExpressionMatch idMatch = idRx.match(l); @@ -446,7 +447,7 @@ QStringList FossilClient::synchronousTagQuery(const QString &workingDirectory, c const QString output = sanitizeFossilOutput(response.stdOut()); - return output.split('\n', QString::SkipEmptyParts); + return output.split('\n', Utils::SkipEmptyParts); } RepositorySettings FossilClient::synchronousSettingsQuery(const QString &workingDirectory) @@ -468,12 +469,12 @@ RepositorySettings FossilClient::synchronousSettingsQuery(const QString &working const QString output = sanitizeFossilOutput(response.stdOut()); - for (const QString &line : output.split('\n', QString::SkipEmptyParts)) { + for (const QString &line : output.split('\n', Utils::SkipEmptyParts)) { // parse settings line: // <(local|global)> // Fossil properties are case-insensitive; force them to lower-case. // Values may be in mixed-case; force lower-case for fixed values. - const QStringList fields = line.split(' ', QString::SkipEmptyParts); + const QStringList fields = line.split(' ', Utils::SkipEmptyParts); const QString property = fields.at(0).toLower(); const QString value = (fields.size() >= 3 ? fields.at(2) : QString()); diff --git a/plugins/fossil/fossilcommitwidget.cpp b/plugins/fossil/fossilcommitwidget.cpp index 73baf9e4c41..d1994dba789 100644 --- a/plugins/fossil/fossilcommitwidget.cpp +++ b/plugins/fossil/fossilcommitwidget.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -122,7 +123,7 @@ QStringList FossilCommitWidget::tags() const return QStringList(); tagsText.replace(',', ' '); - const QStringList tags = tagsText.split(' ', QString::SkipEmptyParts); + const QStringList tags = tagsText.split(' ', Utils::SkipEmptyParts); return tags; } diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index a1fc2302397..898c7197aa1 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -57,6 +57,7 @@ #include #include +#include #include #include @@ -834,7 +835,7 @@ bool FossilPluginPrivate::submitEditorAboutToClose() //rewrite entries of the form 'file => newfile' to 'newfile' because //this would mess the commit command for (QStringList::iterator iFile = files.begin(); iFile != files.end(); ++iFile) { - const QStringList parts = iFile->split(" => ", QString::SkipEmptyParts); + const QStringList parts = iFile->split(" => ", Utils::SkipEmptyParts); if (!parts.isEmpty()) *iFile = parts.last(); } diff --git a/plugins/fossil/wizard/fossiljsextension.cpp b/plugins/fossil/wizard/fossiljsextension.cpp index a0281f803d4..c8fdf18c651 100644 --- a/plugins/fossil/wizard/fossiljsextension.cpp +++ b/plugins/fossil/wizard/fossiljsextension.cpp @@ -59,7 +59,7 @@ void FossilJsExtension::parseArgOptions(const QStringList &args, QMap 1 ? opt[1] : QString()); } } From 69f3f359d7304db432c137784d3f17a8fb1d37ec Mon Sep 17 00:00:00 2001 From: Artur Shepilko Date: Thu, 16 Jul 2020 14:23:14 -0500 Subject: [PATCH 052/133] Work around MSVC error initializing QString from const char * This deals with the error while compiling with MSVC 2017: fossilclient.cpp(398): error C2440: 'initializing': cannot convert from 'const char *' to 'QString' fossilclient.cpp(398): note: No constructor could take the source type, or constructor overload resolution was ambiguous No problem building that with gcc. Change-Id: Iddb9754cd5010505b182ca9b81e390a7c3b8fdda Reviewed-by: Orgad Shaneh (cherry picked from commit a0f4ce71e81dcf40e6c4c04f0fd87749ae71fd42) --- plugins/fossil/fossilclient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 2a01aa2f60f..b95a48e2a36 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -394,7 +394,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect QTC_ASSERT(idRx.isValid(), return RevisionInfo()); const QString hashToken = - (supportedFeatures().testFlag(InfoHashFeature) ? "hash: " : "uuid: "); + QString::fromUtf8(supportedFeatures().testFlag(InfoHashFeature) ? "hash: " : "uuid: "); for (const QString &l : output.split('\n', Utils::SkipEmptyParts)) { if (l.startsWith("checkout: ", Qt::CaseInsensitive) From a3b0e885c4be19b99d0d7203cc09a31d6a964cd5 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 15 Sep 2020 11:44:14 +0200 Subject: [PATCH 053/133] Add github action Change-Id: I967902da99a09ce760fb38a6ac834c734170a1be Reviewed-by: Cristian Adam Reviewed-by: Alessandro Portale --- .github/workflows/README.md | 41 ++++ .github/workflows/build_qmake.yml | 332 ++++++++++++++++++++++++++++++ 2 files changed, 373 insertions(+) create mode 100644 .github/workflows/README.md create mode 100644 .github/workflows/build_qmake.yml diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 00000000000..8481ed15ae9 --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,41 @@ +# GitHub Actions & Workflows + +The `build_qmake.yml` in this directory adds a [GitHub action][1] and workflow that builds +your plugin anytime you push commits to GitHub on Windows, Linux and macOS. + +The build artifacts can be downloaded from GitHub and be installed into an existing Qt Creator +installation. + +When you push a tag, the workflow also creates a new release on GitHub. + +## Keeping it up to date + +Near the top of the file you find a section starting with `env:`. + +The value for `QT_VERSION` specifies the Qt version to use for building the plugin. + +The value for `QT_CREATOR_VERSION` specifies the Qt Creator version to use for building the plugin. + +The value for `QT_CREATOR_SNAPSHOT` can either be `NO` or `latest` or the build ID of a specific +snapshot build for the Qt Creator version that you specified. + +You need to keep these values updated for different versions of your plugin, and take care +that the Qt version and Qt Creator version you specify are compatible. + +## What it does + +The build job consists of several steps: + +* Install required packages on the build host +* Download, unpack and install the binary for the Qt version +* Download and unpack the binary for the Qt Creator version +* Build the plugin and upload the plugin libraries to GitHub +* If a tag is pushed, create a release on GitHub for the tag, including zipped plugin libraries + for download + +## Limitations + +If your plugin requires additional resources besides the plugin library, you need to adapt the +script accordingly. + +[1]: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-github-actions diff --git a/.github/workflows/build_qmake.yml b/.github/workflows/build_qmake.yml new file mode 100644 index 00000000000..c1df79894ca --- /dev/null +++ b/.github/workflows/build_qmake.yml @@ -0,0 +1,332 @@ +name: QMake Build Matrix + +on: [push] + +env: + QT_VERSION: 5.15.0 + QT_CREATOR_VERSION: 4.13.0 + QT_CREATOR_SNAPSHOT: NO + PLUGIN_PRO: fossil.pro + PLUGIN_NAME: Fossil + +jobs: + build: + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + strategy: + matrix: + config: + - { + name: "Windows Latest x64", artifact: "Windows-x64.zip", + os: windows-latest, + environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat" + } + - { + name: "Windows Latest x86", artifact: "Windows-x86.zip", + os: windows-latest, + environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars32.bat" + } + - { + name: "Linux Latest x64", artifact: "Linux-x64.zip", + os: ubuntu-latest + } + - { + name: "macOS Latest x64", artifact: "macOS-x64.zip", + os: macos-latest + } + + steps: + - uses: actions/checkout@v1 + + - name: Installing system libs + shell: cmake -P {0} + run: | + if ("${{ runner.os }}" STREQUAL "Linux") + execute_process( + COMMAND sudo apt install libgl1-mesa-dev + ) + endif() + if ("${{ runner.os }}" STREQUAL "Windows") + # get JOM + file(DOWNLOAD "https://download.qt.io/official_releases/jom/jom.zip" ./jom.zip SHOW_PROGRESS) + file(MAKE_DIRECTORY ./jom) + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../jom.zip WORKING_DIRECTORY ./jom) + endif() + + - name: Download Qt + id: qt + shell: cmake -P {0} + run: | + set(qt_version $ENV{QT_VERSION}) + + string(REPLACE "." "" qt_version_dotless "${qt_version}") + if ("${{ runner.os }}" STREQUAL "Windows") + set(url_os "windows_x86") + if ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat") + set(qt_package_name "qt.qt5.${qt_version_dotless}.win64_msvc2019_64") + set(qt_dir_prefix "${qt_version}/msvc2019_64") + elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat") + set(qt_package_name "qt.qt5.${qt_version_dotless}.win32_msvc2019") + set(qt_dir_prefix "${qt_version}/msvc2019") + else() + endif() + elseif ("${{ runner.os }}" STREQUAL "Linux") + set(url_os "linux_x64") + set(qt_package_name "qt.qt5.${qt_version_dotless}.gcc_64") + set(qt_dir_prefix "${qt_version}/gcc_64") + elseif ("${{ runner.os }}" STREQUAL "macOS") + set(url_os "mac_x64") + set(qt_package_name "qt.qt5.${qt_version_dotless}.clang_64") + set(qt_dir_prefix "${qt_version}/clang_64") + endif() + + set(qt_base_url "https://download.qt.io/online/qtsdkrepository/${url_os}/desktop/qt5_${qt_version_dotless}") + file(DOWNLOAD "${qt_base_url}/Updates.xml" ./Updates.xml SHOW_PROGRESS) + + file(READ ./Updates.xml updates_xml) + string(REGEX MATCH "${qt_package_name}.*([0-9+-.]+).*qtbase([a-zA-Z0-9_-]+).7z" + updates_xml_output "${updates_xml}") + set(package_version ${CMAKE_MATCH_1}) + set(package_suffix ${CMAKE_MATCH_2}) + string(REPLACE "-debug-symbols" "" package_suffix "${package_suffix}") + + # Workaround for CMake's greedy regex + if ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat") + string(REPLACE "X86_64" "X86" package_suffix "${package_suffix}") + endif() + + file(MAKE_DIRECTORY qt5) + + # Save the path for other steps + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt5/${qt_dir_prefix}" qt_dir) + message("::set-output name=qt_dir::${qt_dir}") + + function(downloadAndExtract url archive) + message("Downloading ${url}") + file(DOWNLOAD "${url}" ./${archive} SHOW_PROGRESS) + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../${archive} WORKING_DIRECTORY qt5) + endfunction() + + foreach(package qtbase qtdeclarative qttools qtsvg) + downloadAndExtract( + "${qt_base_url}/${qt_package_name}/${package_version}${package}${package_suffix}.7z" + ${package}.7z + ) + endforeach() + + # uic depends on libicu56.so + if ("${{ runner.os }}" STREQUAL "Linux") + downloadAndExtract( + "${qt_base_url}/${qt_package_name}/${package_version}icu-linux-Rhel7.2-x64.7z" + icu.7z + ) + endif() + + file(READ "qt5/${qt_dir_prefix}/mkspecs/qconfig.pri" qtconfig) + string(REPLACE "Enterprise" "OpenSource" qtconfig "${qtconfig}") + string(REPLACE "licheck.exe" "" qtconfig "${qtconfig}") + string(REPLACE "licheck64" "" qtconfig "${qtconfig}") + string(REPLACE "licheck_mac" "" qtconfig "${qtconfig}") + file(WRITE "qt5/${qt_dir_prefix}/mkspecs/qconfig.pri" "${qtconfig}") + + - name: Download Qt Creator + id: qt_creator + shell: cmake -P {0} + run: | + string(REGEX MATCH "([0-9]+.[0-9]+).[0-9]+" outvar "$ENV{QT_CREATOR_VERSION}") + + set(qtc_base_url "https://download.qt.io/official_releases/qtcreator/${CMAKE_MATCH_1}/$ENV{QT_CREATOR_VERSION}/installer_source") + set(qtc_snapshot "$ENV{QT_CREATOR_SNAPSHOT}") + if (qtc_snapshot) + set(qtc_base_url "https://download.qt.io/snapshots/qtcreator/${CMAKE_MATCH_1}/$ENV{QT_CREATOR_VERSION}/installer_source/${qtc_snapshot}") + endif() + + if ("${{ runner.os }}" STREQUAL "Windows") + set(qtc_output_directory "target/lib/qtcreator/plugins") + set(qtc_binary_name "$ENV{PLUGIN_NAME}4.dll") + if ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat") + set(qtc_platform "windows_x64") + elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat") + set(qtc_platform "windows_x86") + endif() + elseif ("${{ runner.os }}" STREQUAL "Linux") + set(qtc_output_directory "target/lib/qtcreator/plugins") + set(qtc_binary_name "lib$ENV{PLUGIN_NAME}.so") + set(qtc_platform "linux_x64") + elseif ("${{ runner.os }}" STREQUAL "macOS") + set(qtc_output_directory "target/PlugIns") + set(qtc_binary_name "lib$ENV{PLUGIN_NAME}.dylib") + set(qtc_platform "mac_x64") + endif() + + # Save the path for other steps + message("::set-output name=qtc_binary_name::${qtc_binary_name}") + message("::set-output name=qtc_output_directory::${qtc_output_directory}") + + file(MAKE_DIRECTORY qtcreator) + + foreach(package qtcreator qtcreator_dev) + file(DOWNLOAD + "${qtc_base_url}/${qtc_platform}/${package}.7z" ./${package}.7z SHOW_PROGRESS) + execute_process(COMMAND + ${CMAKE_COMMAND} -E tar xvf ../${package}.7z WORKING_DIRECTORY qtcreator) + endforeach() + + - name: Configure + shell: cmake -P {0} + run: | + if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") + execute_process( + COMMAND "${{ matrix.config.environment_script }}" && set + OUTPUT_FILE environment_script_output.txt + ) + file(STRINGS environment_script_output.txt output_lines) + foreach(line IN LISTS output_lines) + if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$") + set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}") + + # Set for other steps + message("::set-env name=${CMAKE_MATCH_1}::${CMAKE_MATCH_2}") + endif() + endforeach() + endif() + + if ("${{ runner.os }}" STREQUAL "macOS") + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qtcreator/Qt Creator.app" qtcreator_build) + else() + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qtcreator" qtcreator_build) + endif() + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qtcreator" qtcreator_source) + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/target" target_path) + + execute_process( + COMMAND ${{ steps.qt.outputs.qt_dir }}/bin/qmake + $ENV{PLUGIN_PRO} + CONFIG+=release + IDE_SOURCE_TREE="${qtcreator_source}" + IDE_BUILD_TREE="${qtcreator_build}" + IDE_OUTPUT_PATH="${target_path}" + RESULT_VARIABLE result + ) + if (NOT result EQUAL 0) + message(FATAL_ERROR "Bad exit status") + endif() + + - name: Build + shell: cmake -P {0} + run: | + if ("${{ runner.os }}" STREQUAL "Windows") + set(ENV{PATH} "${{ steps.qt.outputs.qt_dir }}/bin/;$ENV{PATH}") + else() + set(ENV{PATH} "${{ steps.qt.outputs.qt_dir }}/bin/:$ENV{PATH}") + set(ENV{LD_LIBRARY_PATH} "qtcreator/lib/Qt/lib:$ENV{LD_LIBRARY_PATH}") + endif() + + include(ProcessorCount) + ProcessorCount(N) + + set(make_program make -j ${N}) + if ("${{ runner.os }}" STREQUAL "Windows") + set(make_program "jom/jom") + endif() + + execute_process( + COMMAND ${make_program} + RESULT_VARIABLE result + ) + if (NOT result EQUAL 0) + message(FATAL_ERROR "Bad exit status") + endif() + + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/$ENV{PLUGIN_NAME}-$ENV{QT_CREATOR_VERSION}-${{ matrix.config.artifact }}" artifact) + + execute_process(COMMAND + ${CMAKE_COMMAND} -E tar cvf ${artifact} --format=zip "${{ steps.qt_creator.outputs.qtc_binary_name }}" + WORKING_DIRECTORY "${{ steps.qt_creator.outputs.qtc_output_directory }}" + ) + + - uses: actions/upload-artifact@v1 + id: upload_artifact + with: + path: ./${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} + name: ${{ env.PLUGIN_NAME}}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} + + release: + if: contains(github.ref, 'tags/v') + runs-on: ubuntu-latest + needs: build + + steps: + - name: Create Release + id: create_release + uses: actions/create-release@v1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Store Release url + run: | + echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url + + - uses: actions/upload-artifact@v1 + with: + path: ./upload_url + name: upload_url + + publish: + if: contains(github.ref, 'tags/v') + + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + strategy: + matrix: + config: + - { + name: "Windows Latest x64", artifact: "Windows-x64.zip", + os: ubuntu-latest + } + - { + name: "Windows Latest x86", artifact: "Windows-x86.zip", + os: ubuntu-latest + } + - { + name: "Linux Latest x64", artifact: "Linux-x64.zip", + os: ubuntu-latest + } + - { + name: "macOS Latest x64", artifact: "macOS-x64.zip", + os: macos-latest + } + needs: release + + steps: + - name: Download artifact + uses: actions/download-artifact@v1 + with: + name: ${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} + path: ./ + + - name: Download URL + uses: actions/download-artifact@v1 + with: + name: upload_url + path: ./ + - id: set_upload_url + run: | + upload_url=`cat ./upload_url` + echo ::set-output name=upload_url::$upload_url + + - name: Upload to Release + id: upload_to_release + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.set_upload_url.outputs.upload_url }} + asset_path: ./${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} + asset_name: ${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} + asset_content_type: application/zip From 3fb58390ab786e3047f224933870a9a3dd60f95a Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 21 Sep 2020 15:55:51 +0200 Subject: [PATCH 054/133] Use C++17 like upstream Qt Creator Change-Id: Iba5013a8bf50f18037dc0bf0853b1a21017f1da7 Reviewed-by: Cristian Adam --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e5a9a5b903..601a78ef350 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,6 @@ project(Fossil) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) add_subdirectory(plugins/fossil) From 9a1423bf05a5ecd560055ef32aa981e7c2d813c6 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 21 Sep 2020 15:56:04 +0200 Subject: [PATCH 055/133] Do not include Core::Id It moved to Utils. Change-Id: I8bfbda0857e79577d02d4a9bad518f46769a8c07 Reviewed-by: hjk --- plugins/fossil/fossilclient.cpp | 3 +-- plugins/fossil/fossilplugin.cpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index b95a48e2a36..1fe14574d28 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -27,8 +27,6 @@ #include "fossileditor.h" #include "constants.h" -#include - #include #include #include @@ -38,6 +36,7 @@ #include #include #include +#include #include #include #include diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 898c7197aa1..691b50fe9ae 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include @@ -55,6 +54,7 @@ #include #include +#include #include #include #include From ba97b2db1645d4c45cd937ab9919b7b1c34b7db9 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 20 Oct 2020 15:42:37 +0200 Subject: [PATCH 056/133] Update GitHub workflow Provision cmake & ninja, use CMake for building and include various fixes from Qt Creator's main workflow. Build against 4.14 beta1 snapshots. Change-Id: Ic5d0df3ac4c4998fe417f74c984f868323168e5f Reviewed-by: Cristian Adam --- .github/workflows/README.md | 2 +- .../{build_qmake.yml => build_cmake.yml} | 240 ++++++++---------- 2 files changed, 112 insertions(+), 130 deletions(-) rename .github/workflows/{build_qmake.yml => build_cmake.yml} (52%) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 8481ed15ae9..107410c6ec3 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -1,6 +1,6 @@ # GitHub Actions & Workflows -The `build_qmake.yml` in this directory adds a [GitHub action][1] and workflow that builds +The `build_cmake.yml` in this directory adds a [GitHub action][1] and workflow that builds your plugin anytime you push commits to GitHub on Windows, Linux and macOS. The build artifacts can be downloaded from GitHub and be installed into an existing Qt Creator diff --git a/.github/workflows/build_qmake.yml b/.github/workflows/build_cmake.yml similarity index 52% rename from .github/workflows/build_qmake.yml rename to .github/workflows/build_cmake.yml index c1df79894ca..74d993419f0 100644 --- a/.github/workflows/build_qmake.yml +++ b/.github/workflows/build_cmake.yml @@ -3,11 +3,12 @@ name: QMake Build Matrix on: [push] env: - QT_VERSION: 5.15.0 - QT_CREATOR_VERSION: 4.13.0 - QT_CREATOR_SNAPSHOT: NO - PLUGIN_PRO: fossil.pro PLUGIN_NAME: Fossil + QT_VERSION: 5.15.1 + QT_CREATOR_VERSION: 4.14.0-beta1 + QT_CREATOR_SNAPSHOT: latest + CMAKE_VERSION: 3.18.3 + NINJA_VERSION: 1.10.1 jobs: build: @@ -17,83 +18,114 @@ jobs: matrix: config: - { - name: "Windows Latest x64", artifact: "Windows-x64.zip", + name: "Windows Latest MSVC", artifact: "Windows-x64", os: windows-latest, - environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat" + cc: "cl", cxx: "cl", + environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", } - { - name: "Windows Latest x86", artifact: "Windows-x86.zip", - os: windows-latest, - environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars32.bat" + name: "Ubuntu Latest GCC", artifact: "Linux-x64", + os: ubuntu-latest, + cc: "gcc", cxx: "g++" } - { - name: "Linux Latest x64", artifact: "Linux-x64.zip", - os: ubuntu-latest - } - - { - name: "macOS Latest x64", artifact: "macOS-x64.zip", - os: macos-latest + name: "macOS Latest Clang", artifact: "macOS-x64", + os: macos-latest, + cc: "clang", cxx: "clang++" } steps: - uses: actions/checkout@v1 - - name: Installing system libs + - name: Download Ninja and CMake + shell: cmake -P {0} + run: | + set(cmake_version "$ENV{CMAKE_VERSION}") + set(ninja_version "$ENV{NINJA_VERSION}") + + if ("${{ runner.os }}" STREQUAL "Windows") + set(ninja_suffix "win.zip") + set(cmake_suffix "win64-x64.zip") + set(cmake_dir "cmake-${cmake_version}-win64-x64/bin") + elseif ("${{ runner.os }}" STREQUAL "Linux") + set(ninja_suffix "linux.zip") + set(cmake_suffix "Linux-x86_64.tar.gz") + set(cmake_dir "cmake-${cmake_version}-Linux-x86_64/bin") + elseif ("${{ runner.os }}" STREQUAL "macOS") + set(ninja_suffix "mac.zip") + set(cmake_suffix "Darwin-x86_64.tar.gz") + set(cmake_dir "cmake-${cmake_version}-Darwin-x86_64/CMake.app/Contents/bin") + endif() + + set(ninja_url "https://github.com/ninja-build/ninja/releases/download/v${ninja_version}/ninja-${ninja_suffix}") + file(DOWNLOAD "${ninja_url}" ./ninja.zip SHOW_PROGRESS) + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ninja.zip) + + set(cmake_url "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/cmake-${cmake_version}-${cmake_suffix}") + file(DOWNLOAD "${cmake_url}" ./cmake.zip SHOW_PROGRESS) + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./cmake.zip) + + # Add to PATH environment variable + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/${cmake_dir}" cmake_dir) + set(path_separator ":") + if ("${{ runner.os }}" STREQUAL "Windows") + set(path_separator ";") + endif() + file(APPEND "$ENV{GITHUB_PATH}" "$ENV{GITHUB_WORKSPACE}${path_separator}${cmake_dir}") + + if (NOT "${{ runner.os }}" STREQUAL "Windows") + execute_process( + COMMAND chmod +x ninja + COMMAND chmod +x ${cmake_dir}/cmake + ) + endif() + + - name: Install system libs shell: cmake -P {0} run: | if ("${{ runner.os }}" STREQUAL "Linux") execute_process( - COMMAND sudo apt install libgl1-mesa-dev + COMMAND sudo apt update ) - endif() - if ("${{ runner.os }}" STREQUAL "Windows") - # get JOM - file(DOWNLOAD "https://download.qt.io/official_releases/jom/jom.zip" ./jom.zip SHOW_PROGRESS) - file(MAKE_DIRECTORY ./jom) - execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../jom.zip WORKING_DIRECTORY ./jom) + execute_process( + COMMAND sudo apt install libgl1-mesa-dev + RESULT_VARIABLE result + ) + if (NOT result EQUAL 0) + message(FATAL_ERROR "Failed to install dependencies") + endif() endif() - name: Download Qt id: qt shell: cmake -P {0} run: | - set(qt_version $ENV{QT_VERSION}) + set(qt_version "$ENV{QT_VERSION}") string(REPLACE "." "" qt_version_dotless "${qt_version}") if ("${{ runner.os }}" STREQUAL "Windows") set(url_os "windows_x86") - if ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat") - set(qt_package_name "qt.qt5.${qt_version_dotless}.win64_msvc2019_64") - set(qt_dir_prefix "${qt_version}/msvc2019_64") - elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat") - set(qt_package_name "qt.qt5.${qt_version_dotless}.win32_msvc2019") - set(qt_dir_prefix "${qt_version}/msvc2019") - else() - endif() + set(qt_package_arch_suffix "win64_msvc2019_64") + set(qt_dir_prefix "${qt_version}/msvc2019_64") + set(qt_package_suffix "-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64") elseif ("${{ runner.os }}" STREQUAL "Linux") set(url_os "linux_x64") - set(qt_package_name "qt.qt5.${qt_version_dotless}.gcc_64") + set(qt_package_arch_suffix "gcc_64") set(qt_dir_prefix "${qt_version}/gcc_64") + set(qt_package_suffix "-Linux-RHEL_7_6-GCC-Linux-RHEL_7_6-X86_64") elseif ("${{ runner.os }}" STREQUAL "macOS") set(url_os "mac_x64") - set(qt_package_name "qt.qt5.${qt_version_dotless}.clang_64") + set(qt_package_arch_suffix "clang_64") set(qt_dir_prefix "${qt_version}/clang_64") + set(qt_package_suffix "-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64") endif() set(qt_base_url "https://download.qt.io/online/qtsdkrepository/${url_os}/desktop/qt5_${qt_version_dotless}") file(DOWNLOAD "${qt_base_url}/Updates.xml" ./Updates.xml SHOW_PROGRESS) file(READ ./Updates.xml updates_xml) - string(REGEX MATCH "${qt_package_name}.*([0-9+-.]+).*qtbase([a-zA-Z0-9_-]+).7z" - updates_xml_output "${updates_xml}") - set(package_version ${CMAKE_MATCH_1}) - set(package_suffix ${CMAKE_MATCH_2}) - string(REPLACE "-debug-symbols" "" package_suffix "${package_suffix}") - - # Workaround for CMake's greedy regex - if ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat") - string(REPLACE "X86_64" "X86" package_suffix "${package_suffix}") - endif() + string(REGEX MATCH "qt.qt5.*([0-9+-.]+)" updates_xml_output "${updates_xml}") + set(qt_package_version ${CMAKE_MATCH_1}) file(MAKE_DIRECTORY qt5) @@ -101,15 +133,16 @@ jobs: file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt5/${qt_dir_prefix}" qt_dir) message("::set-output name=qt_dir::${qt_dir}") + message("Downloading Qt to ${qt_dir}") function(downloadAndExtract url archive) message("Downloading ${url}") file(DOWNLOAD "${url}" ./${archive} SHOW_PROGRESS) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../${archive} WORKING_DIRECTORY qt5) endfunction() - foreach(package qtbase qtdeclarative qttools qtsvg) + foreach(package qtbase qtdeclarative) downloadAndExtract( - "${qt_base_url}/${qt_package_name}/${package_version}${package}${package_suffix}.7z" + "${qt_base_url}/qt.qt5.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z" ${package}.7z ) endforeach() @@ -117,18 +150,11 @@ jobs: # uic depends on libicu56.so if ("${{ runner.os }}" STREQUAL "Linux") downloadAndExtract( - "${qt_base_url}/${qt_package_name}/${package_version}icu-linux-Rhel7.2-x64.7z" + "${qt_base_url}/qt.qt5.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}icu-linux-Rhel7.2-x64.7z" icu.7z ) endif() - file(READ "qt5/${qt_dir_prefix}/mkspecs/qconfig.pri" qtconfig) - string(REPLACE "Enterprise" "OpenSource" qtconfig "${qtconfig}") - string(REPLACE "licheck.exe" "" qtconfig "${qtconfig}") - string(REPLACE "licheck64" "" qtconfig "${qtconfig}") - string(REPLACE "licheck_mac" "" qtconfig "${qtconfig}") - file(WRITE "qt5/${qt_dir_prefix}/mkspecs/qconfig.pri" "${qtconfig}") - - name: Download Qt Creator id: qt_creator shell: cmake -P {0} @@ -142,29 +168,21 @@ jobs: endif() if ("${{ runner.os }}" STREQUAL "Windows") - set(qtc_output_directory "target/lib/qtcreator/plugins") - set(qtc_binary_name "$ENV{PLUGIN_NAME}4.dll") - if ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat") - set(qtc_platform "windows_x64") - elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat") - set(qtc_platform "windows_x86") - endif() + set(qtc_platform "windows_x64") elseif ("${{ runner.os }}" STREQUAL "Linux") - set(qtc_output_directory "target/lib/qtcreator/plugins") - set(qtc_binary_name "lib$ENV{PLUGIN_NAME}.so") set(qtc_platform "linux_x64") elseif ("${{ runner.os }}" STREQUAL "macOS") - set(qtc_output_directory "target/PlugIns") - set(qtc_binary_name "lib$ENV{PLUGIN_NAME}.dylib") set(qtc_platform "mac_x64") endif() + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qtcreator" qtc_dir) # Save the path for other steps - message("::set-output name=qtc_binary_name::${qtc_binary_name}") - message("::set-output name=qtc_output_directory::${qtc_output_directory}") + message("::set-output name=qtc_dir::${qtc_dir}") file(MAKE_DIRECTORY qtcreator) + message("Downloading Qt Creator from ${qtc_base_url}/${qtc_platform}") + foreach(package qtcreator qtcreator_dev) file(DOWNLOAD "${qtc_base_url}/${qtc_platform}/${package}.7z" ./${package}.7z SHOW_PROGRESS) @@ -172,9 +190,13 @@ jobs: ${CMAKE_COMMAND} -E tar xvf ../${package}.7z WORKING_DIRECTORY qtcreator) endforeach() - - name: Configure + - name: Build shell: cmake -P {0} run: | + set(ENV{CC} ${{ matrix.config.cc }}) + set(ENV{CXX} ${{ matrix.config.cxx }}) + set(ENV{MACOSX_DEPLOYMENT_TARGET} "10.13") + if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") execute_process( COMMAND "${{ matrix.config.environment_script }}" && set @@ -184,72 +206,36 @@ jobs: foreach(line IN LISTS output_lines) if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$") set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}") - - # Set for other steps - message("::set-env name=${CMAKE_MATCH_1}::${CMAKE_MATCH_2}") endif() endforeach() endif() - if ("${{ runner.os }}" STREQUAL "macOS") - file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qtcreator/Qt Creator.app" qtcreator_build) - else() - file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qtcreator" qtcreator_build) - endif() - file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qtcreator" qtcreator_source) - file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/target" target_path) + set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") execute_process( - COMMAND ${{ steps.qt.outputs.qt_dir }}/bin/qmake - $ENV{PLUGIN_PRO} - CONFIG+=release - IDE_SOURCE_TREE="${qtcreator_source}" - IDE_BUILD_TREE="${qtcreator_build}" - IDE_OUTPUT_PATH="${target_path}" + COMMAND python + -u + ${{ steps.qt_creator.outputs.qtc_dir }}/scripts/build_plugin.py + --name "$ENV{PLUGIN_NAME}-$ENV{QT_CREATOR_VERSION}-${{ matrix.config.artifact }}" + --src . + --build build + --qt-path "${{ steps.qt.outputs.qt_dir }}" + --qtc-path "${{ steps.qt_creator.outputs.qtc_dir }}" + --output-path "$ENV{GITHUB_WORKSPACE}" RESULT_VARIABLE result ) if (NOT result EQUAL 0) - message(FATAL_ERROR "Bad exit status") + string(REGEX MATCH "FAILED:.*$" error_message "${output}") + string(REPLACE "\n" "%0A" error_message "${error_message}") + message("::error::${error_message}") + message(FATAL_ERROR "Build failed") endif() - - name: Build - shell: cmake -P {0} - run: | - if ("${{ runner.os }}" STREQUAL "Windows") - set(ENV{PATH} "${{ steps.qt.outputs.qt_dir }}/bin/;$ENV{PATH}") - else() - set(ENV{PATH} "${{ steps.qt.outputs.qt_dir }}/bin/:$ENV{PATH}") - set(ENV{LD_LIBRARY_PATH} "qtcreator/lib/Qt/lib:$ENV{LD_LIBRARY_PATH}") - endif() - - include(ProcessorCount) - ProcessorCount(N) - - set(make_program make -j ${N}) - if ("${{ runner.os }}" STREQUAL "Windows") - set(make_program "jom/jom") - endif() - - execute_process( - COMMAND ${make_program} - RESULT_VARIABLE result - ) - if (NOT result EQUAL 0) - message(FATAL_ERROR "Bad exit status") - endif() - - file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/$ENV{PLUGIN_NAME}-$ENV{QT_CREATOR_VERSION}-${{ matrix.config.artifact }}" artifact) - - execute_process(COMMAND - ${CMAKE_COMMAND} -E tar cvf ${artifact} --format=zip "${{ steps.qt_creator.outputs.qtc_binary_name }}" - WORKING_DIRECTORY "${{ steps.qt_creator.outputs.qtc_output_directory }}" - ) - - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@v2 id: upload_artifact with: - path: ./${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} - name: ${{ env.PLUGIN_NAME}}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} + path: ./${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }}.7z + name: ${{ env.PLUGIN_NAME}}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }}.7z release: if: contains(github.ref, 'tags/v') @@ -286,19 +272,15 @@ jobs: matrix: config: - { - name: "Windows Latest x64", artifact: "Windows-x64.zip", + name: "Windows Latest x64", artifact: "Windows-x64.7z", os: ubuntu-latest } - { - name: "Windows Latest x86", artifact: "Windows-x86.zip", + name: "Linux Latest x64", artifact: "Linux-x64.7z", os: ubuntu-latest } - { - name: "Linux Latest x64", artifact: "Linux-x64.zip", - os: ubuntu-latest - } - - { - name: "macOS Latest x64", artifact: "macOS-x64.zip", + name: "macOS Latest x64", artifact: "macOS-x64.7z", os: macos-latest } needs: release @@ -329,4 +311,4 @@ jobs: upload_url: ${{ steps.set_upload_url.outputs.upload_url }} asset_path: ./${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} asset_name: ${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }} - asset_content_type: application/zip + asset_content_type: application/x-7z-compressed From b5732298335e74d8d84b4768de863c5f7d218415 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 20 Oct 2020 12:23:06 +0200 Subject: [PATCH 057/133] Fix compilation with upstream changes Change-Id: Ic0b6731339b84005c8d13ffa09793c5786ab1038 Reviewed-by: Cristian Adam --- plugins/fossil/CMakeLists.txt | 7 ++++++- plugins/fossil/fossilplugin.cpp | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/fossil/CMakeLists.txt b/plugins/fossil/CMakeLists.txt index af91d14c6e3..6bcd629025c 100644 --- a/plugins/fossil/CMakeLists.txt +++ b/plugins/fossil/CMakeLists.txt @@ -1,5 +1,10 @@ +if (WITH_TESTS) + set(QT_TEST_COMPONENT Test) + set(IMPLICIT_DEPENDS Qt5::Test) +endif() + find_package(QtCreator COMPONENTS Core TextEditor ProjectExplorer VcsBase REQUIRED) -find_package(Qt5 COMPONENTS Widgets REQUIRED) +find_package(Qt5 COMPONENTS Widgets ${QT_TEST_COMPONENT} REQUIRED) add_qtc_plugin(Fossil PLUGIN_DEPENDS diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 691b50fe9ae..09e43575dbb 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -802,7 +802,7 @@ void FossilPluginPrivate::commitFromEditor() // Close the submit editor m_submitActionTriggered = true; QTC_ASSERT(submitEditor(), return); - Core::EditorManager::closeDocument(submitEditor()->document()); + Core::EditorManager::closeDocuments({submitEditor()->document()}); } bool FossilPluginPrivate::submitEditorAboutToClose() From 8f226483cabfc098077d348e2fe38fc2280ceb2f Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 16 Nov 2020 10:59:38 +0100 Subject: [PATCH 058/133] CMake Build: Increase cmake minimum version to 3.10 This fixes problems with PCH and AUTOMOC with policy CMP0071 Change-Id: Id8f5e9c550267131853fe6851106cd106be20865 Reviewed-by: Cristian Adam --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 601a78ef350..ef4c245a87b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.9) +cmake_minimum_required(VERSION 3.10) project(Fossil) From f55fc3c3bc73444c0986d520457055368ba7a32f Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 4 Jan 2021 08:21:53 +0100 Subject: [PATCH 059/133] Update github workflow for latest Qt Creator release Change-Id: I90a2b170ceaf5028d4d8a3bad7d12daa454e6d1c Reviewed-by: Eike Ziller --- .github/workflows/build_cmake.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 74d993419f0..61fe894a3f4 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -4,9 +4,9 @@ on: [push] env: PLUGIN_NAME: Fossil - QT_VERSION: 5.15.1 - QT_CREATOR_VERSION: 4.14.0-beta1 - QT_CREATOR_SNAPSHOT: latest + QT_VERSION: 5.15.2 + QT_CREATOR_VERSION: 4.14.0 + QT_CREATOR_SNAPSHOT: NO CMAKE_VERSION: 3.18.3 NINJA_VERSION: 1.10.1 From c973fae866382d47a70034641de28afb91bad4cc Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 8 Feb 2021 12:46:07 +0100 Subject: [PATCH 060/133] Update github workflow to 4.15.0-beta1 snapshots Change-Id: I1d5afcf21f2053aab15ae58ec08dd10a9e19a40c Reviewed-by: Eike Ziller --- .github/workflows/build_cmake.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 61fe894a3f4..7d8099590db 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -5,8 +5,8 @@ on: [push] env: PLUGIN_NAME: Fossil QT_VERSION: 5.15.2 - QT_CREATOR_VERSION: 4.14.0 - QT_CREATOR_SNAPSHOT: NO + QT_CREATOR_VERSION: 4.15.0-beta1 + QT_CREATOR_SNAPSHOT: latest CMAKE_VERSION: 3.18.3 NINJA_VERSION: 1.10.1 From ea431eede1e5deada06e1cc89ef92775de7bc01e Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 19 Mar 2021 16:07:25 +0100 Subject: [PATCH 061/133] Fossil: Aspectify settings Change-Id: I090cf3c63cd705220abb09e5d58eef89e9b55147 Reviewed-by: Orgad Shaneh --- plugins/fossil/CMakeLists.txt | 1 - plugins/fossil/fossil.pro | 3 - plugins/fossil/fossil.qbs | 1 - plugins/fossil/fossilclient.cpp | 57 ++--- plugins/fossil/fossilclient.h | 2 + plugins/fossil/fossilcommitwidget.cpp | 3 +- plugins/fossil/fossilplugin.cpp | 17 +- plugins/fossil/fossilplugin.h | 7 - plugins/fossil/fossilsettings.cpp | 192 +++++++++++++--- plugins/fossil/fossilsettings.h | 31 ++- plugins/fossil/optionspage.cpp | 103 --------- plugins/fossil/optionspage.h | 42 ---- plugins/fossil/optionspage.ui | 229 -------------------- plugins/fossil/wizard/fossiljsextension.cpp | 12 +- 14 files changed, 227 insertions(+), 473 deletions(-) delete mode 100644 plugins/fossil/optionspage.cpp delete mode 100644 plugins/fossil/optionspage.h delete mode 100644 plugins/fossil/optionspage.ui diff --git a/plugins/fossil/CMakeLists.txt b/plugins/fossil/CMakeLists.txt index 6bcd629025c..ad94bb90ab5 100644 --- a/plugins/fossil/CMakeLists.txt +++ b/plugins/fossil/CMakeLists.txt @@ -23,7 +23,6 @@ add_qtc_plugin(Fossil fossileditor.cpp fossileditor.h fossilplugin.cpp fossilplugin.h fossilsettings.cpp fossilsettings.h - optionspage.cpp optionspage.h optionspage.ui pullorpushdialog.cpp pullorpushdialog.h pullorpushdialog.ui revertdialog.ui revisioninfo.cpp revisioninfo.h diff --git a/plugins/fossil/fossil.pro b/plugins/fossil/fossil.pro index bdec45dfa07..c423ad164b2 100644 --- a/plugins/fossil/fossil.pro +++ b/plugins/fossil/fossil.pro @@ -8,7 +8,6 @@ include($$IDE_SOURCE_TREE/src/qtcreatorplugin.pri) SOURCES += \ fossilclient.cpp \ fossilplugin.cpp \ - optionspage.cpp \ fossilsettings.cpp \ commiteditor.cpp \ fossilcommitwidget.cpp \ @@ -23,7 +22,6 @@ HEADERS += \ fossilclient.h \ constants.h \ fossilplugin.h \ - optionspage.h \ fossilsettings.h \ commiteditor.h \ fossilcommitwidget.h \ @@ -35,7 +33,6 @@ HEADERS += \ revisioninfo.h \ wizard/fossiljsextension.h FORMS += \ - optionspage.ui \ revertdialog.ui \ fossilcommitpanel.ui \ pullorpushdialog.ui \ diff --git a/plugins/fossil/fossil.qbs b/plugins/fossil/fossil.qbs index 69730c93cf2..e89b69171e3 100644 --- a/plugins/fossil/fossil.qbs +++ b/plugins/fossil/fossil.qbs @@ -15,7 +15,6 @@ QtcPlugin { "constants.h", "fossilclient.cpp", "fossilclient.h", "fossilplugin.cpp", "fossilplugin.h", - "optionspage.cpp", "optionspage.h", "optionspage.ui", "fossilsettings.cpp", "fossilsettings.h", "commiteditor.cpp", "commiteditor.h", "fossilcommitwidget.cpp", "fossilcommitwidget.h", diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 1fe14574d28..398eb9fb6fd 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -36,9 +36,7 @@ #include #include #include -#include #include -#include #include #include @@ -67,15 +65,14 @@ public: { QTC_ASSERT(client, return); - VcsBase::VcsBaseClientSettings &settings = client->settings(); FossilClient::SupportedFeatures features = client->supportedFeatures(); addReloadButton(); if (features.testFlag(FossilClient::DiffIgnoreWhiteSpaceFeature)) { mapSetting(addToggleButton("-w", tr("Ignore All Whitespace")), - settings.boolPointer(FossilSettings::diffIgnoreAllWhiteSpaceKey)); + &client->settings().diffIgnoreAllWhiteSpace); mapSetting(addToggleButton("--strip-trailing-cr", tr("Strip Trailing CR")), - settings.boolPointer(FossilSettings::diffStripTrailingCRKey)); + &client->settings().diffStripTrailingCR); } } }; @@ -91,20 +88,20 @@ public: { QTC_ASSERT(client, return); - VcsBase::VcsBaseClientSettings &settings = client->settings(); + FossilSettings &settings = client->settings(); FossilClient::SupportedFeatures features = client->supportedFeatures(); if (features.testFlag(FossilClient::AnnotateBlameFeature)) { mapSetting(addToggleButton("|BLAME|", tr("Show Committers")), - settings.boolPointer(FossilSettings::annotateShowCommittersKey)); + &settings.annotateShowCommitters); } // Force listVersions setting to false by default. // This way the annotated line number would not get offset by the version list. - settings.setValue(FossilSettings::annotateListVersionsKey, false); + settings.annotateListVersions.setValue(false); mapSetting(addToggleButton("--log", tr("List Versions")), - settings.boolPointer(FossilSettings::annotateListVersionsKey)); + &settings.annotateListVersions); } }; @@ -141,7 +138,7 @@ public: void addLineageComboBox() { - VcsBase::VcsBaseClientSettings &settings = m_client->settings(); + FossilSettings &settings = m_client->settings(); // ancestors/descendants filter // This is a positional argument not an option. @@ -156,22 +153,22 @@ public: ChoiceItem(tr("Unfiltered"), "") }; mapSetting(addChoices(tr("Lineage"), QStringList("|LINEAGE|%1|current"), lineageFilterChoices), - settings.stringPointer(FossilSettings::timelineLineageFilterKey)); + &settings.timelineLineageFilter); } void addVerboseToggleButton() { - VcsBase::VcsBaseClientSettings &settings = m_client->settings(); + FossilSettings &settings = m_client->settings(); // show files mapSetting(addToggleButton("-showfiles", tr("Verbose"), tr("Show files changed in each revision")), - settings.boolPointer(FossilSettings::timelineVerboseKey)); + &settings.timelineVerbose); } void addItemTypeComboBox() { - VcsBase::VcsBaseClientSettings &settings = m_client->settings(); + FossilSettings &settings = m_client->settings(); // option: -t const QList itemTypeChoices = { @@ -188,7 +185,7 @@ public: // Fossil expects separate arguments for option and value ( i.e. "-t" "all") // so we need to handle the splitting explicitly in arguments(). mapSetting(addChoices(tr("Item Types"), QStringList("-t %1"), itemTypeChoices), - settings.stringPointer(FossilSettings::timelineItemTypeKey)); + &settings.timelineItemType); } QStringList arguments() const final @@ -244,16 +241,22 @@ QString FossilClient::makeVersionString(unsigned version) .arg(versionPart(version)); } -FossilClient::FossilClient(FossilSettings *settings) : VcsBase::VcsBaseClient(settings) +FossilClient::FossilClient(FossilSettings *settings) + : VcsBase::VcsBaseClient(settings), m_settings(settings) { setDiffConfigCreator([this](QToolBar *toolBar) { return new FossilDiffConfig(this, toolBar); }); } +FossilSettings &FossilClient::settings() const +{ + return *m_settings; +} + unsigned int FossilClient::synchronousBinaryVersion() const { - if (settings().binaryPath().isEmpty()) + if (settings().binaryPath.value().isEmpty()) return 0; QStringList args("version"); @@ -282,7 +285,7 @@ QList FossilClient::branchListFromOutput(const QString &output, cons // Branch list format: // " branch-name" // "* current-branch" - return Utils::transform(output.split('\n', Utils::SkipEmptyParts), [=](const QString& l) { + return Utils::transform(output.split('\n', Qt::SkipEmptyParts), [=](const QString &l) { const QString &name = l.mid(2); QTC_ASSERT(!name.isEmpty(), return BranchInfo()); const BranchInfo::BranchFlags flags = (l.startsWith("* ") ? defaultFlags | BranchInfo::Current : defaultFlags); @@ -395,9 +398,9 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect const QString hashToken = QString::fromUtf8(supportedFeatures().testFlag(InfoHashFeature) ? "hash: " : "uuid: "); - for (const QString &l : output.split('\n', Utils::SkipEmptyParts)) { + for (const QString &l : output.split('\n', Qt::SkipEmptyParts)) { if (l.startsWith("checkout: ", Qt::CaseInsensitive) - || l.startsWith(hashToken, Qt::CaseInsensitive)) { + || l.startsWith("uuid: ", Qt::CaseInsensitive)) { const QRegularExpressionMatch idMatch = idRx.match(l); QTC_ASSERT(idMatch.hasMatch(), return RevisionInfo()); revisionId = idMatch.captured(1); @@ -446,7 +449,7 @@ QStringList FossilClient::synchronousTagQuery(const QString &workingDirectory, c const QString output = sanitizeFossilOutput(response.stdOut()); - return output.split('\n', Utils::SkipEmptyParts); + return output.split('\n', Qt::SkipEmptyParts); } RepositorySettings FossilClient::synchronousSettingsQuery(const QString &workingDirectory) @@ -458,7 +461,7 @@ RepositorySettings FossilClient::synchronousSettingsQuery(const QString &working repoSettings.user = synchronousUserDefaultQuery(workingDirectory); if (repoSettings.user.isEmpty()) - repoSettings.user = settings().stringValue(FossilSettings::userNameKey); + repoSettings.user = settings().userName.value(); const QStringList args("settings"); @@ -468,12 +471,12 @@ RepositorySettings FossilClient::synchronousSettingsQuery(const QString &working const QString output = sanitizeFossilOutput(response.stdOut()); - for (const QString &line : output.split('\n', Utils::SkipEmptyParts)) { + for (const QString &line : output.split('\n', Qt::SkipEmptyParts)) { // parse settings line: // <(local|global)> // Fossil properties are case-insensitive; force them to lower-case. // Values may be in mixed-case; force lower-case for fixed values. - const QStringList fields = line.split(' ', Utils::SkipEmptyParts); + const QStringList fields = line.split(' ', Qt::SkipEmptyParts); const QString property = fields.at(0).toLower(); const QString value = (fields.size() >= 3 ? fields.at(2) : QString()); @@ -636,8 +639,8 @@ bool FossilClient::synchronousCreateRepository(const QString &workingDirectory, // use the configured default user for admin const QString repoName = QDir(workingDirectory).dirName().simplified(); - const QString repoPath = settings().stringValue(FossilSettings::defaultRepoPathKey); - const QString adminUser = settings().stringValue(FossilSettings::userNameKey); + const QString repoPath = settings().defaultRepoPath.value(); + const QString adminUser = settings().userName.value(); if (repoName.isEmpty() || repoPath.isEmpty()) return false; @@ -855,7 +858,7 @@ unsigned int FossilClient::binaryVersion() const static unsigned int cachedBinaryVersion = 0; static QString cachedBinaryPath; - const QString currentBinaryPath = settings().binaryPath().toString(); + const QString currentBinaryPath = settings().binaryPath.value(); if (currentBinaryPath.isEmpty()) return 0; diff --git a/plugins/fossil/fossilclient.h b/plugins/fossil/fossilclient.h index 8cc64ae1911..75618932fa5 100644 --- a/plugins/fossil/fossilclient.h +++ b/plugins/fossil/fossilclient.h @@ -64,6 +64,7 @@ public: static QString makeVersionString(unsigned version); explicit FossilClient(FossilSettings *settings); + FossilSettings &settings() const; unsigned int synchronousBinaryVersion() const; BranchInfo synchronousCurrentBranch(const QString &workingDirectory); @@ -130,6 +131,7 @@ private: VcsBase::VcsBaseEditorConfig *createLogEditor(VcsBase::VcsBaseEditorWidget *editor); friend class FossilPluginPrivate; + FossilSettings *m_settings = nullptr; }; Q_DECLARE_OPERATORS_FOR_FLAGS(FossilClient::SupportedFeatures) diff --git a/plugins/fossil/fossilcommitwidget.cpp b/plugins/fossil/fossilcommitwidget.cpp index d1994dba789..d53ac59c102 100644 --- a/plugins/fossil/fossilcommitwidget.cpp +++ b/plugins/fossil/fossilcommitwidget.cpp @@ -32,7 +32,6 @@ #include #include -#include #include #include @@ -123,7 +122,7 @@ QStringList FossilCommitWidget::tags() const return QStringList(); tagsText.replace(',', ' '); - const QStringList tags = tagsText.split(' ', Utils::SkipEmptyParts); + const QStringList tags = tagsText.split(' ', Qt::SkipEmptyParts); return tags; } diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 09e43575dbb..46df19e9bf1 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -26,7 +26,6 @@ #include "fossilplugin.h" #include "constants.h" #include "fossilclient.h" -#include "optionspage.h" #include "fossilcommitwidget.h" #include "fossileditor.h" #include "pullorpushdialog.h" @@ -54,10 +53,8 @@ #include #include -#include #include #include -#include #include #include @@ -437,10 +434,10 @@ void FossilPluginPrivate::logCurrentFile() QTC_ASSERT(state.hasFile(), return); FossilClient::SupportedFeatures features = m_client.supportedFeatures(); QStringList extraOptions; - extraOptions << "-n" << QString::number(m_client.settings().intValue(FossilSettings::logCountKey)); + extraOptions << "-n" << QString::number(m_client.settings().logCount.value()); if (features.testFlag(FossilClient::TimelineWidthFeature)) - extraOptions << "-W" << QString::number(m_client.settings().intValue(FossilSettings::timelineWidthKey)); + extraOptions << "-W" << QString::number(m_client.settings().timelineWidth.value()); // disable annotate context menu for older client versions, used to be supported for current revision only bool enableAnnotationContextMenu = features.testFlag(FossilClient::AnnotateRevisionFeature); @@ -520,10 +517,10 @@ void FossilPluginPrivate::logRepository() QTC_ASSERT(state.hasTopLevel(), return); FossilClient::SupportedFeatures features = m_client.supportedFeatures(); QStringList extraOptions; - extraOptions << "-n" << QString::number(m_client.settings().intValue(FossilSettings::logCountKey)); + extraOptions << "-n" << QString::number(m_client.settings().logCount.value()); if (features.testFlag(FossilClient::TimelineWidthFeature)) - extraOptions << "-W" << QString::number(m_client.settings().intValue(FossilSettings::timelineWidthKey)); + extraOptions << "-W" << QString::number(m_client.settings().timelineWidth.value()); m_client.log(state.topLevel(), QStringList(), extraOptions); } @@ -616,7 +613,7 @@ bool FossilPluginPrivate::pullOrPush(FossilPluginPrivate::SyncMode mode) QTC_ASSERT(state.hasTopLevel(), return false); PullOrPushDialog dialog(pullOrPushMode, Core::ICore::dialogParent()); - dialog.setLocalBaseDirectory(m_client.settings().stringValue(FossilSettings::defaultRepoPathKey)); + dialog.setLocalBaseDirectory(m_client.settings().defaultRepoPath.value()); const QString defaultURL(m_client.synchronousGetRepositoryURL(state.topLevel())); dialog.setDefaultRemoteLocation(defaultURL); if (dialog.exec() != QDialog::Accepted) @@ -835,7 +832,7 @@ bool FossilPluginPrivate::submitEditorAboutToClose() //rewrite entries of the form 'file => newfile' to 'newfile' because //this would mess the commit command for (QStringList::iterator iFile = files.begin(); iFile != files.end(); ++iFile) { - const QStringList parts = iFile->split(" => ", Utils::SkipEmptyParts); + const QStringList parts = iFile->split(" => ", Qt::SkipEmptyParts); if (!parts.isEmpty()) *iFile = parts.last(); } @@ -932,7 +929,7 @@ bool FossilPluginPrivate::isConfigured() const return false; // Local repositories default path must be set and exist - const QString repoPath = m_client.settings().stringValue(FossilSettings::defaultRepoPathKey); + const QString repoPath = m_client.settings().defaultRepoPath.value(); if (repoPath.isEmpty()) return false; diff --git a/plugins/fossil/fossilplugin.h b/plugins/fossil/fossilplugin.h index e8257eb854c..436f2372b9a 100644 --- a/plugins/fossil/fossilplugin.h +++ b/plugins/fossil/fossilplugin.h @@ -31,17 +31,10 @@ #include #include -namespace Core { -class ActionContainer; -class CommandLocator; -} // namespace Core - namespace Fossil { namespace Internal { -class OptionsPage; class FossilClient; -class FossilEditorWidget; class FossilPlugin final : public ExtensionSystem::IPlugin { diff --git a/plugins/fossil/fossilsettings.cpp b/plugins/fossil/fossilsettings.cpp index 8866d065afe..fc5d63b9d94 100644 --- a/plugins/fossil/fossilsettings.cpp +++ b/plugins/fossil/fossilsettings.cpp @@ -24,47 +24,179 @@ ****************************************************************************/ #include "fossilsettings.h" -#include "constants.h" -#include +#include "constants.h" +#include "fossilclient.h" + +#include + +#include +#include + +#include + +using namespace Utils; namespace Fossil { namespace Internal { -const QString FossilSettings::defaultRepoPathKey("defaultRepoPath"); -const QString FossilSettings::sslIdentityFileKey("sslIdentityFile"); -const QString FossilSettings::diffIgnoreAllWhiteSpaceKey("diffIgnoreAllWhiteSpace"); -const QString FossilSettings::diffStripTrailingCRKey("diffStripTrailingCR"); -const QString FossilSettings::annotateShowCommittersKey("annotateShowCommitters"); -const QString FossilSettings::annotateListVersionsKey("annotateListVersions"); -const QString FossilSettings::timelineWidthKey("timelineWidth"); -const QString FossilSettings::timelineLineageFilterKey("timelineLineageFilter"); -const QString FossilSettings::timelineVerboseKey("timelineVerbose"); -const QString FossilSettings::timelineItemTypeKey("timelineItemType"); -const QString FossilSettings::disableAutosyncKey("disableAutosync"); - FossilSettings::FossilSettings() { setSettingsGroup(Constants::FOSSIL); - // Override default binary path - declareKey(binaryPathKey, Constants::FOSSILDEFAULT); - declareKey(defaultRepoPathKey, ""); - declareKey(sslIdentityFileKey, ""); - declareKey(diffIgnoreAllWhiteSpaceKey, false); - declareKey(diffStripTrailingCRKey, false); - declareKey(annotateShowCommittersKey, false); - declareKey(annotateListVersionsKey, false); - declareKey(timelineWidthKey, 0); - declareKey(timelineLineageFilterKey, ""); - declareKey(timelineVerboseKey, false); - declareKey(timelineItemTypeKey, "all"); - declareKey(disableAutosyncKey, true); -} + setAutoApply(false); + + registerAspect(&binaryPath); + binaryPath.setDisplayStyle(StringAspect::PathChooserDisplay); + binaryPath.setExpectedKind(PathChooser::ExistingCommand); + binaryPath.setDefaultValue(Constants::FOSSILDEFAULT); + binaryPath.setDisplayName(tr("Fossil Command")); + binaryPath.setHistoryCompleter("Fossil.Command.History"); + binaryPath.setLabelText(tr("Command:")); + + registerAspect(&defaultRepoPath); + defaultRepoPath.setSettingsKey("defaultRepoPath"); + defaultRepoPath.setDisplayStyle(StringAspect::PathChooserDisplay); + defaultRepoPath.setExpectedKind(PathChooser::Directory); + defaultRepoPath.setDisplayName(tr("Fossil Repositories")); + defaultRepoPath.setLabelText(tr("Default path:")); + defaultRepoPath.setToolTip(tr("Directory to store local repositories by default.")); + + registerAspect(&userName); + userName.setDisplayStyle(StringAspect::LineEditDisplay); + userName.setLabelText(tr("Default user:")); + userName.setToolTip(tr("Existing user to become an author of changes made to the repository.")); + + registerAspect(&sslIdentityFile); + sslIdentityFile.setSettingsKey("sslIdentityFile"); + sslIdentityFile.setDisplayStyle(StringAspect::PathChooserDisplay); + sslIdentityFile.setExpectedKind(PathChooser::File); + sslIdentityFile.setDisplayName(tr("SSL/TLS Identity Key")); + sslIdentityFile.setLabelText(tr("SSL/TLS identity:")); + sslIdentityFile.setToolTip(tr("SSL/TLS client identity key to use if requested by the server.")); + + registerAspect(&diffIgnoreAllWhiteSpace); + diffIgnoreAllWhiteSpace.setSettingsKey("diffIgnoreAllWhiteSpace"); + + registerAspect(&diffStripTrailingCR); + diffStripTrailingCR.setSettingsKey("diffStripTrailingCR"); + + registerAspect(&annotateShowCommitters); + annotateShowCommitters.setSettingsKey("annotateShowCommitters"); + + registerAspect(&annotateListVersions); + annotateListVersions.setSettingsKey("annotateListVersions"); + + registerAspect(&timelineWidth); + timelineWidth.setSettingsKey("timelineWidth"); + timelineWidth.setLabelText(tr("Log width:")); + timelineWidth.setToolTip(tr("The width of log entry line (>20). " + "Choose 0 to see a single line per entry.")); + + registerAspect(&timelineLineageFilter); + timelineLineageFilter.setSettingsKey("timelineLineageFilter"); + + registerAspect(&timelineVerbose); + timelineVerbose.setSettingsKey("timelineVerbose"); + + registerAspect(&timelineItemType); + timelineItemType.setDefaultValue("all"); + timelineItemType.setSettingsKey("timelineItemType"); + + registerAspect(&disableAutosync); + disableAutosync.setSettingsKey("disableAutosync"); + disableAutosync.setDefaultValue(true); + disableAutosync.setLabelText(tr("Disable auto-sync")); + disableAutosync.setToolTip(tr("Disable automatic pull prior to commit or update and " + "automatic push after commit or tag or branch creation.")); + + registerAspect(&timeout); + timeout.setLabelText(tr("Timeout:")); + timeout.setSuffix(tr("s")); + + registerAspect(&logCount); + logCount.setLabelText(tr("Log count:")); + logCount.setToolTip(tr("The number of recent commit log entries to show. " + "Choose 0 to see all entries.")); +}; RepositorySettings::RepositorySettings() : autosync(AutosyncOn) { } -} // namespace Internal -} // namespace Fossil +// OptionsPage + +class OptionsPageWidget final : public Core::IOptionsPageWidget +{ + Q_DECLARE_TR_FUNCTIONS(Fossil::Internal::OptionsPageWidget) + +public: + OptionsPageWidget(const std::function &onApply, FossilSettings *settings); + void apply() final; + +private: + const std::function m_onApply; + FossilSettings *m_settings; +}; + +void OptionsPageWidget::apply() +{ + if (!m_settings->isDirty()) + return; + + m_settings->apply(); + m_onApply(); +} + +OptionsPageWidget::OptionsPageWidget(const std::function &onApply, FossilSettings *settings) : + m_onApply(onApply), + m_settings(settings) +{ + FossilSettings &s = *m_settings; + + using namespace Layouting; + const Break nl; + + Column { + Group { + Title(tr("Configuration")), + Row { s.binaryPath } + }, + + Group { + Title(tr("Local Repositories")), + Row { s.defaultRepoPath } + }, + Group { + Title(tr("User")), + Form { + s.userName, nl, + s.sslIdentityFile + } + }, + + Group { + Title(tr("Miscellaneous")), + Row { + s.logCount, + s.timelineWidth, + s.timeout, + Stretch() + }, + s.disableAutosync + }, + Stretch() + + }.attachTo(this); +} + +OptionsPage::OptionsPage(const std::function &onApply, FossilSettings *settings) +{ + setId(Constants::VCS_ID_FOSSIL); + setDisplayName(OptionsPageWidget::tr("Fossil")); + setWidgetCreator([onApply, settings]() { return new OptionsPageWidget(onApply, settings); }); + setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY); +} + +} // Internal +} // Fossil diff --git a/plugins/fossil/fossilsettings.h b/plugins/fossil/fossilsettings.h index 8314eb3cf58..e686c8fc389 100644 --- a/plugins/fossil/fossilsettings.h +++ b/plugins/fossil/fossilsettings.h @@ -25,25 +25,26 @@ #pragma once +#include #include namespace Fossil { namespace Internal { -class FossilSettings : public VcsBase::VcsBaseClientSettings +class FossilSettings : public VcsBase::VcsBaseSettings { public: - static const QString defaultRepoPathKey; - static const QString sslIdentityFileKey; - static const QString diffIgnoreAllWhiteSpaceKey; - static const QString diffStripTrailingCRKey; - static const QString annotateShowCommittersKey; - static const QString annotateListVersionsKey; - static const QString timelineWidthKey; - static const QString timelineLineageFilterKey; - static const QString timelineVerboseKey; - static const QString timelineItemTypeKey; - static const QString disableAutosyncKey; + Utils::StringAspect defaultRepoPath; + Utils::StringAspect sslIdentityFile; + Utils::BoolAspect diffIgnoreAllWhiteSpace; + Utils::BoolAspect diffStripTrailingCR; + Utils::BoolAspect annotateShowCommitters; + Utils::BoolAspect annotateListVersions; + Utils::IntegerAspect timelineWidth; + Utils::StringAspect timelineLineageFilter; + Utils::BoolAspect timelineVerbose; + Utils::StringAspect timelineItemType; + Utils::BoolAspect disableAutosync; FossilSettings(); }; @@ -66,5 +67,11 @@ inline bool operator== (const RepositorySettings &lh, const RepositorySettings & && lh.sslIdentityFile == rh.sslIdentityFile); } +class OptionsPage : public Core::IOptionsPage +{ +public: + OptionsPage(const std::function &onApply, FossilSettings *settings); +}; + } // namespace Internal } // namespace Fossil diff --git a/plugins/fossil/optionspage.cpp b/plugins/fossil/optionspage.cpp deleted file mode 100644 index ad42130e66a..00000000000 --- a/plugins/fossil/optionspage.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (c) 2018 Artur Shepilko -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "optionspage.h" -#include "constants.h" -#include "fossilclient.h" -#include "fossilsettings.h" -#include "fossilplugin.h" -#include "ui_optionspage.h" - -#include -#include -#include - -namespace Fossil { -namespace Internal { - -class OptionsPageWidget final : public Core::IOptionsPageWidget -{ - Q_DECLARE_TR_FUNCTIONS(Fossil::Internal::OptionsPageWidget) - -public: - OptionsPageWidget(const std::function &onApply, FossilSettings *settings); - void apply() final; - -private: - Ui::OptionsPage m_ui; - const std::function m_onApply; - FossilSettings *m_settings; -}; - -void OptionsPageWidget::apply() -{ - FossilSettings s = *m_settings; - s.setValue(FossilSettings::binaryPathKey, m_ui.commandChooser->rawPath()); - s.setValue(FossilSettings::defaultRepoPathKey, m_ui.defaultRepoPathChooser->path()); - s.setValue(FossilSettings::userNameKey, m_ui.defaultUsernameLineEdit->text().trimmed()); - s.setValue(FossilSettings::sslIdentityFileKey, m_ui.sslIdentityFilePathChooser->path()); - s.setValue(FossilSettings::logCountKey, m_ui.logEntriesCount->value()); - s.setValue(FossilSettings::timelineWidthKey, m_ui.logEntriesWidth->value()); - s.setValue(FossilSettings::timeoutKey, m_ui.timeout->value()); - s.setValue(FossilSettings::disableAutosyncKey, m_ui.disableAutosyncCheckBox->isChecked()); - if (*m_settings == s) - return; - - *m_settings = s; - m_onApply(); -} - -OptionsPageWidget::OptionsPageWidget(const std::function &onApply, FossilSettings *settings) : - m_onApply(onApply), - m_settings(settings) -{ - m_ui.setupUi(this); - m_ui.commandChooser->setExpectedKind(Utils::PathChooser::ExistingCommand); - m_ui.commandChooser->setPromptDialogTitle(tr("Fossil Command")); - m_ui.commandChooser->setHistoryCompleter("Fossil.Command.History"); - m_ui.commandChooser->setPath(m_settings->stringValue(FossilSettings::binaryPathKey)); - m_ui.defaultRepoPathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory); - m_ui.defaultRepoPathChooser->setPromptDialogTitle(tr("Fossil Repositories")); - m_ui.defaultRepoPathChooser->setPath(m_settings->stringValue(FossilSettings::defaultRepoPathKey)); - m_ui.sslIdentityFilePathChooser->setExpectedKind(Utils::PathChooser::File); - m_ui.sslIdentityFilePathChooser->setPromptDialogTitle(tr("SSL/TLS Identity Key")); - m_ui.sslIdentityFilePathChooser->setPath(m_settings->stringValue(FossilSettings::sslIdentityFileKey)); - m_ui.defaultUsernameLineEdit->setText(m_settings->stringValue(FossilSettings::userNameKey)); - m_ui.logEntriesCount->setValue(m_settings->intValue(FossilSettings::logCountKey)); - m_ui.logEntriesWidth->setValue(m_settings->intValue(FossilSettings::timelineWidthKey)); - m_ui.timeout->setValue(m_settings->intValue(FossilSettings::timeoutKey)); - m_ui.disableAutosyncCheckBox->setChecked(m_settings->boolValue(FossilSettings::disableAutosyncKey)); -} - -OptionsPage::OptionsPage(const std::function &onApply, FossilSettings *settings) -{ - setId(Constants::VCS_ID_FOSSIL); - setDisplayName(OptionsPageWidget::tr("Fossil")); - setWidgetCreator([onApply, settings]() { return new OptionsPageWidget(onApply, settings); }); - setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY); -} - -} // Internal -} // Fossil diff --git a/plugins/fossil/optionspage.h b/plugins/fossil/optionspage.h deleted file mode 100644 index 411b005df4b..00000000000 --- a/plugins/fossil/optionspage.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (c) 2018 Artur Shepilko -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include - -namespace Fossil { -namespace Internal { - -class FossilSettings; - -class OptionsPage : public Core::IOptionsPage -{ -public: - OptionsPage(const std::function &onApply, FossilSettings *settings); -}; - -} // namespace Internal -} // namespace Fossil diff --git a/plugins/fossil/optionspage.ui b/plugins/fossil/optionspage.ui deleted file mode 100644 index e14e845cb51..00000000000 --- a/plugins/fossil/optionspage.ui +++ /dev/null @@ -1,229 +0,0 @@ - - - Fossil::Internal::OptionsPage - - - - 0 - 0 - 649 - 336 - - - - - - - - - - Configuration - - - - QFormLayout::ExpandingFieldsGrow - - - - - Command: - - - - - - - - - - - - - Local Repositories - - - - - - Directory to store local repositories by default. - - - Default path: - - - - - - - Directory to store local repositories by default. - - - - - - - - - - User - - - - QFormLayout::ExpandingFieldsGrow - - - - - Default user: - - - - - - - Existing user to become an author of changes made to the repository. - - - - - - - SSL/TLS identity: - - - - - - - SSL/TLS client identity key to use if requested by the server. - - - - - - - - - - Miscellaneous - - - - - - Log count: - - - - - - - The number of recent commit log entries to show. Choose 0 to see all entries. - - - 1000 - - - 300 - - - - - - - Log width: - - - - - - - The width of log entry line (>20). Choose 0 to see a single line per entry. - - - 300 - - - 0 - - - - - - - Timeout: - - - - - - - s - - - 360 - - - 30 - - - - - - - Qt::Horizontal - - - - 213 - 20 - - - - - - - - Disable automatic pull prior to commit or update and automatic push after commit or tag or branch creation. - - - Disable auto-sync - - - false - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Utils::PathChooser - QWidget -

utils/pathchooser.h
- 1 - - editingFinished() - browsingFinished() - - - - - - diff --git a/plugins/fossil/wizard/fossiljsextension.cpp b/plugins/fossil/wizard/fossiljsextension.cpp index c8fdf18c651..701c55d9224 100644 --- a/plugins/fossil/wizard/fossiljsextension.cpp +++ b/plugins/fossil/wizard/fossiljsextension.cpp @@ -48,7 +48,7 @@ public: } Utils::Id m_vscId; - VcsBase::VcsBaseClientSettings *m_settings; + FossilSettings *m_settings; }; @@ -59,7 +59,7 @@ void FossilJsExtension::parseArgOptions(const QStringList &args, QMap 1 ? opt[1] : QString()); } } @@ -90,7 +90,7 @@ QString FossilJsExtension::defaultAdminUser() const if (!isConfigured()) return QString(); - return d->m_settings->stringValue(FossilSettings::userNameKey); + return d->m_settings->userName.value(); } QString FossilJsExtension::defaultSslIdentityFile() const @@ -98,7 +98,7 @@ QString FossilJsExtension::defaultSslIdentityFile() const if (!isConfigured()) return QString(); - return d->m_settings->stringValue(FossilSettings::sslIdentityFileKey); + return d->m_settings->sslIdentityFile.value(); } QString FossilJsExtension::defaultLocalRepoPath() const @@ -106,7 +106,7 @@ QString FossilJsExtension::defaultLocalRepoPath() const if (!isConfigured()) return QString(); - return d->m_settings->stringValue(FossilSettings::defaultRepoPathKey); + return d->m_settings->defaultRepoPath.value(); } bool FossilJsExtension::defaultDisableAutosync() const @@ -114,7 +114,7 @@ bool FossilJsExtension::defaultDisableAutosync() const if (!isConfigured()) return false; - return d->m_settings->boolValue(FossilSettings::disableAutosyncKey); + return d->m_settings->disableAutosync.value(); } } // namespace Internal From 7fd9cde17ac6d1c6f140c55b491b2fca00e2dd78 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 29 Mar 2021 07:19:17 +0200 Subject: [PATCH 062/133] Fossil: Revert some unintentional hunk Amends 36f3cf69. Change-Id: I4a8ea5f2353fb2feb88087af86fec6d0f7919974 Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 398eb9fb6fd..01c49d443ad 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -400,7 +400,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect for (const QString &l : output.split('\n', Qt::SkipEmptyParts)) { if (l.startsWith("checkout: ", Qt::CaseInsensitive) - || l.startsWith("uuid: ", Qt::CaseInsensitive)) { + || l.startsWith(hashToken, Qt::CaseInsensitive)) { const QRegularExpressionMatch idMatch = idRx.match(l); QTC_ASSERT(idMatch.hasMatch(), return RevisionInfo()); revisionId = idMatch.captured(1); From 718a9b0d4ce65998fb44247e86a771de5976297e Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 10 May 2021 12:01:27 +0200 Subject: [PATCH 063/133] Fossil: Adapt to upstream SynchronousProcess changes Change-Id: Idb6a2063efab8dd4b1c024bac748369105fbd0c2 Reviewed-by: Christian Stenger --- plugins/fossil/fossileditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/fossil/fossileditor.cpp b/plugins/fossil/fossileditor.cpp index 826c705b169..7df989bfb2a 100644 --- a/plugins/fossil/fossileditor.cpp +++ b/plugins/fossil/fossileditor.cpp @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include From 5a134b4577e55f8589326126e34f5ec805f7e25d Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 11 May 2021 12:49:55 +0200 Subject: [PATCH 064/133] Fossil: Drop unneeded QRegExp include Change-Id: I64347f1df5a85aa06372eb196e22948bba1d9e2c Reviewed-by: Christian Kandeler --- plugins/fossil/fossileditor.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/fossil/fossileditor.cpp b/plugins/fossil/fossileditor.cpp index 7df989bfb2a..cab8dbf68c0 100644 --- a/plugins/fossil/fossileditor.cpp +++ b/plugins/fossil/fossileditor.cpp @@ -35,7 +35,6 @@ #include #include -#include #include #include #include From 395af1b83ecd79f35e7188e0b8e82d4eb0a1f23d Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 14 May 2021 11:03:21 +0200 Subject: [PATCH 065/133] Fossil: Adapt to Make SynchronousProcess results more directly accessible Change-Id: Ifd5f79ba50e38fdec9e3f5c412210a95d53e8a96 Reviewed-by: Christian Stenger --- plugins/fossil/fossilclient.cpp | 123 ++++++++++++++++++-------------- 1 file changed, 68 insertions(+), 55 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 01c49d443ad..afdfcea09d6 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -261,11 +261,12 @@ unsigned int FossilClient::synchronousBinaryVersion() const QStringList args("version"); - const SynchronousProcessResponse response = vcsFullySynchronousExec(QString(), args); - if (response.result != SynchronousProcessResponse::Finished) + SynchronousProcess proc; + vcsFullySynchronousExec(proc, QString(), args); + if (proc.result() != QtcProcess::Finished) return 0; - QString output = response.stdOut(); + QString output = proc.stdOut(); output = output.trimmed(); // fossil version: @@ -299,22 +300,24 @@ BranchInfo FossilClient::synchronousCurrentBranch(const QString &workingDirector return BranchInfo(); // First try to get the current branch from the list of open branches - const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, {"branch", "list"}); - if (response.result != SynchronousProcessResponse::Finished) + SynchronousProcess proc; + vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list"}); + if (proc.result() != QtcProcess::Finished) return BranchInfo(); - const QString output = sanitizeFossilOutput(response.stdOut()); + const QString output = sanitizeFossilOutput(proc.stdOut()); BranchInfo currentBranch = Utils::findOrDefault(branchListFromOutput(output), [](const BranchInfo &b) { return b.isCurrent(); }); if (!currentBranch.isCurrent()) { // If not available from open branches, request it from the list of closed branches. - const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, {"branch", "list", "--closed"}); - if (response.result != SynchronousProcessResponse::Finished) + SynchronousProcess proc; + vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list", "--closed"}); + if (proc.result() != QtcProcess::Finished) return BranchInfo(); - const QString output = sanitizeFossilOutput(response.stdOut()); + const QString output = sanitizeFossilOutput(proc.stdOut()); currentBranch = Utils::findOrDefault(branchListFromOutput(output, BranchInfo::Closed), [](const BranchInfo &b) { return b.isCurrent(); }); @@ -332,19 +335,20 @@ QList FossilClient::synchronousBranchQuery(const QString &workingDir return QList(); // First get list of open branches - SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, {"branch", "list"}); - if (response.result != SynchronousProcessResponse::Finished) + SynchronousProcess proc; + vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list"}); + if (proc.result() != QtcProcess::Finished) return QList(); - QString output = sanitizeFossilOutput(response.stdOut()); + QString output = sanitizeFossilOutput(proc.stdOut()); QList branches = branchListFromOutput(output); // Append a list of closed branches. - response = vcsFullySynchronousExec(workingDirectory, {"branch", "list", "--closed"}); - if (response.result != SynchronousProcessResponse::Finished) + vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list", "--closed"}); + if (proc.result() != QtcProcess::Finished) return QList(); - output = sanitizeFossilOutput(response.stdOut()); + output = sanitizeFossilOutput(proc.stdOut()); branches.append(branchListFromOutput(output, BranchInfo::Closed)); std::sort(branches.begin(), branches.end(), @@ -379,12 +383,12 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect if (!id.isEmpty()) args << id; - const SynchronousProcessResponse response = vcsFullySynchronousExec( - workingDirectory, args, ShellCommand::SuppressCommandLogging); - if (response.result != SynchronousProcessResponse::Finished) + SynchronousProcess proc; + vcsFullySynchronousExec(proc, workingDirectory, args, ShellCommand::SuppressCommandLogging); + if (proc.result() != QtcProcess::Finished) return RevisionInfo(); - const QString output = sanitizeFossilOutput(response.stdOut()); + const QString output = sanitizeFossilOutput(proc.stdOut()); QString revisionId; QString parentId; @@ -443,11 +447,12 @@ QStringList FossilClient::synchronousTagQuery(const QString &workingDirectory, c if (!id.isEmpty()) args << id; - const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); - if (response.result != SynchronousProcessResponse::Finished) + SynchronousProcess proc; + vcsFullySynchronousExec(proc, workingDirectory, args); + if (proc.result() != QtcProcess::Finished) return QStringList(); - const QString output = sanitizeFossilOutput(response.stdOut()); + const QString output = sanitizeFossilOutput(proc.stdOut()); return output.split('\n', Qt::SkipEmptyParts); } @@ -465,11 +470,12 @@ RepositorySettings FossilClient::synchronousSettingsQuery(const QString &working const QStringList args("settings"); - const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); - if (response.result != SynchronousProcessResponse::Finished) + SynchronousProcess proc; + vcsFullySynchronousExec(proc, workingDirectory, args); + if (proc.result() != QtcProcess::Finished) return RepositorySettings(); - const QString output = sanitizeFossilOutput(response.stdOut()); + const QString output = sanitizeFossilOutput(proc.stdOut()); for (const QString &line : output.split('\n', Qt::SkipEmptyParts)) { // parse settings line: @@ -519,8 +525,9 @@ bool FossilClient::synchronousSetSetting(const QString &workingDirectory, if (isGlobal) args << "--global"; - const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); - return (response.result == SynchronousProcessResponse::Finished); + SynchronousProcess proc; + vcsFullySynchronousExec(proc, workingDirectory, args); + return (proc.result() == QtcProcess::Finished); } @@ -575,11 +582,12 @@ QString FossilClient::synchronousUserDefaultQuery(const QString &workingDirector const QStringList args({"user", "default"}); - const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); - if (response.result != SynchronousProcessResponse::Finished) + SynchronousProcess proc; + vcsFullySynchronousExec(proc, workingDirectory, args); + if (proc.result() != QtcProcess::Finished) return QString(); - QString output = sanitizeFossilOutput(response.stdOut()); + QString output = sanitizeFossilOutput(proc.stdOut()); return output.trimmed(); } @@ -591,8 +599,9 @@ bool FossilClient::synchronousSetUserDefault(const QString &workingDirectory, co // set repository-default user const QStringList args({"user", "default", userName, "--user", userName}); - const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); - return (response.result == SynchronousProcessResponse::Finished); + SynchronousProcess proc; + vcsFullySynchronousExec(proc, workingDirectory, args); + return (proc.result() == QtcProcess::Finished); } QString FossilClient::synchronousGetRepositoryURL(const QString &workingDirectory) @@ -602,11 +611,12 @@ QString FossilClient::synchronousGetRepositoryURL(const QString &workingDirector const QStringList args("remote-url"); - const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); - if (response.result != SynchronousProcessResponse::Finished) + SynchronousProcess proc; + vcsFullySynchronousExec(proc, workingDirectory, args); + if (proc.result() != QtcProcess::Finished) return QString(); - QString output = sanitizeFossilOutput(response.stdOut()); + QString output = sanitizeFossilOutput(proc.stdOut()); output = output.trimmed(); // Fossil returns "off" when no remote-url is set. @@ -655,40 +665,39 @@ bool FossilClient::synchronousCreateRepository(const QString &workingDirectory, if (!adminUser.isEmpty()) args << "--admin-user" << adminUser; args << extraOptions << repoFilePath.toUserOutput(); - SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); - if (response.result != SynchronousProcessResponse::Finished) + SynchronousProcess proc; + vcsFullySynchronousExec(proc, workingDirectory, args); + if (proc.result() != QtcProcess::Finished) return false; - QString output = sanitizeFossilOutput(response.stdOut()); + QString output = sanitizeFossilOutput(proc.stdOut()); outputWindow->append(output); // check out the created repository file into the working directory args.clear(); - response.clear(); output.clear(); args << "open" << repoFilePath.toUserOutput(); - response = vcsFullySynchronousExec(workingDirectory, args); - if (response.result != SynchronousProcessResponse::Finished) + vcsFullySynchronousExec(proc, workingDirectory, args); + if (proc.result() != QtcProcess::Finished) return false; - output = sanitizeFossilOutput(response.stdOut()); + output = sanitizeFossilOutput(proc.stdOut()); outputWindow->append(output); // set user default to admin if specified if (!adminUser.isEmpty()) { args.clear(); - response.clear(); output.clear(); args << "user" << "default" << adminUser << "--user" << adminUser; - response = vcsFullySynchronousExec(workingDirectory, args); - if (response.result != SynchronousProcessResponse::Finished) + vcsFullySynchronousExec(proc, workingDirectory, args); + if (proc.result() != QtcProcess::Finished) return false; - QString output = sanitizeFossilOutput(response.stdOut()); + QString output = sanitizeFossilOutput(proc.stdOut()); outputWindow->append(output); } @@ -710,8 +719,9 @@ bool FossilClient::synchronousMove(const QString &workingDir, QStringList args(vcsCommandString(MoveCommand)); args << extraOptions << from << to; - const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDir, args); - return (response.result == SynchronousProcessResponse::Finished); + SynchronousProcess proc; + vcsFullySynchronousExec(proc, workingDir, args); + return (proc.result() == QtcProcess::Finished); } bool FossilClient::synchronousPull(const QString &workingDir, const QString &srcLocation, const QStringList &extraOptions) @@ -731,8 +741,9 @@ bool FossilClient::synchronousPull(const QString &workingDir, const QString &src VcsBase::VcsCommand::SshPasswordPrompt | VcsBase::VcsCommand::ShowStdOut | VcsBase::VcsCommand::ShowSuccessMessage; - const SynchronousProcessResponse resp = vcsSynchronousExec(workingDir, args, flags); - const bool success = (resp.result == SynchronousProcessResponse::Finished); + SynchronousProcess proc; + vcsSynchronousExec(proc, workingDir, args, flags); + const bool success = (proc.result() == QtcProcess::Finished); if (success) emit changed(QVariant(workingDir)); return success; @@ -755,8 +766,9 @@ bool FossilClient::synchronousPush(const QString &workingDir, const QString &dst VcsBase::VcsCommand::SshPasswordPrompt | VcsBase::VcsCommand::ShowStdOut | VcsBase::VcsCommand::ShowSuccessMessage; - const SynchronousProcessResponse resp = vcsSynchronousExec(workingDir, args, flags); - return (resp.result == SynchronousProcessResponse::Finished); + SynchronousProcess proc; + vcsSynchronousExec(proc, workingDir, args, flags); + return (proc.result() == QtcProcess::Finished); } void FossilClient::commit(const QString &repositoryRoot, const QStringList &files, @@ -846,10 +858,11 @@ QString FossilClient::findTopLevelForFile(const QFileInfo &file) const bool FossilClient::managesFile(const QString &workingDirectory, const QString &fileName) const { const QStringList args({"finfo", fileName}); - const SynchronousProcessResponse response = vcsFullySynchronousExec(workingDirectory, args); - if (response.result != SynchronousProcessResponse::Finished) + SynchronousProcess proc; + vcsFullySynchronousExec(proc, workingDirectory, args); + if (proc.result() != QtcProcess::Finished) return false; - QString output = sanitizeFossilOutput(response.stdOut()); + QString output = sanitizeFossilOutput(proc.stdOut()); return !output.startsWith("no history for file", Qt::CaseInsensitive); } From c7797cfa5bc7587ca53f686c83e82fc5805ed5f5 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 21 May 2021 06:49:49 +0200 Subject: [PATCH 066/133] Adapt to upstream changes Change-Id: Ib6b36e98229e0f14d07a10ac35f66ff1e7f6379a Reviewed-by: David Schulz --- plugins/fossil/fossilplugin.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 46df19e9bf1..bc6dc8be946 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -714,7 +714,8 @@ void FossilPluginPrivate::showCommitWidget(const QList Date: Thu, 29 Jul 2021 11:12:22 +0200 Subject: [PATCH 067/133] Adapt to IVersionControl FilePath changes Change-Id: I26e95992b69d8b38f107234fd47e04f02eae8436 Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilplugin.cpp | 78 +++++++++++++++++---------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index bc6dc8be946..1877bd257d2 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -89,14 +89,14 @@ public: { } protected: - QString trackFile(const QString &repository) final + FilePath trackFile(const FilePath &repository) final { - return repository + "/" + Constants::FOSSILREPO; + return repository.pathAppended(Constants::FOSSILREPO); } - QString refreshTopic(const QString &repository) final + QString refreshTopic(const FilePath &repository) final { - return m_client->synchronousTopic(repository); + return m_client->synchronousTopic(repository.toString()); } private: @@ -148,24 +148,24 @@ public: QString displayName() const final; Id id() const final; - bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const final; + bool isVcsFileOrDirectory(const FilePath &filePath) const final; - bool managesDirectory(const QString &directory, QString *topLevel) const final; - bool managesFile(const QString &workingDirectory, const QString &fileName) const final; + bool managesDirectory(const FilePath &directory, FilePath *topLevel) const final; + bool managesFile(const FilePath &workingDirectory, const QString &fileName) const final; bool isConfigured() const final; bool supportsOperation(Operation operation) const final; - bool vcsOpen(const QString &fileName) final; - bool vcsAdd(const QString &fileName) final; - bool vcsDelete(const QString &filename) final; - bool vcsMove(const QString &from, const QString &to) final; - bool vcsCreateRepository(const QString &directory) final; + bool vcsOpen(const FilePath &fileName) final; + bool vcsAdd(const FilePath &fileName) final; + bool vcsDelete(const FilePath &filename) final; + bool vcsMove(const FilePath &from, const FilePath &to) final; + bool vcsCreateRepository(const FilePath &directory) final; - void vcsAnnotate(const QString &file, int line) final; - void vcsDescribe(const QString &source, const QString &id) final { m_client.view(source, id); } + void vcsAnnotate(const FilePath &file, int line) final; + void vcsDescribe(const FilePath &source, const QString &id) final; Core::ShellCommand *createInitialCheckoutCommand(const QString &url, - const Utils::FilePath &baseDirectory, + const FilePath &baseDirectory, const QString &localName, const QStringList &extraArgs) final; @@ -782,7 +782,7 @@ void FossilPluginPrivate::createRepository() return; } while (true); // Create - const bool rc = vcsCreateRepository(directory); + const bool rc = vcsCreateRepository(FilePath::fromString(directory)); const QString nativeDir = QDir::toNativeSeparators(directory); if (rc) { QMessageBox::information(mw, tr("Repository Created"), @@ -900,23 +900,23 @@ Id FossilPluginPrivate::id() const return Id(Constants::VCS_ID_FOSSIL); } -bool FossilPluginPrivate::isVcsFileOrDirectory(const Utils::FilePath &filePath) const +bool FossilPluginPrivate::isVcsFileOrDirectory(const FilePath &filePath) const { return m_client.isVcsFileOrDirectory(filePath); } -bool FossilPluginPrivate::managesDirectory(const QString &directory, QString *topLevel) const +bool FossilPluginPrivate::managesDirectory(const FilePath &directory, FilePath *topLevel) const { - QFileInfo dir(directory); + QFileInfo dir(directory.toString()); const QString topLevelFound = m_client.findTopLevelForFile(dir); if (topLevel) - *topLevel = topLevelFound; + *topLevel = FilePath::fromString(topLevelFound); return !topLevelFound.isEmpty(); } -bool FossilPluginPrivate::managesFile(const QString &workingDirectory, const QString &fileName) const +bool FossilPluginPrivate::managesFile(const FilePath &workingDirectory, const QString &fileName) const { - return m_client.managesFile(workingDirectory, fileName); + return m_client.managesFile(workingDirectory.toString(), fileName); } bool FossilPluginPrivate::isConfigured() const @@ -960,48 +960,50 @@ bool FossilPluginPrivate::supportsOperation(Operation operation) const return supported; } -bool FossilPluginPrivate::vcsOpen(const QString &filename) +bool FossilPluginPrivate::vcsOpen(const FilePath &filePath) { - Q_UNUSED(filename) + Q_UNUSED(filePath) return true; } -bool FossilPluginPrivate::vcsAdd(const QString &filename) +bool FossilPluginPrivate::vcsAdd(const FilePath &filePath) { - const QFileInfo fi(filename); + const QFileInfo fi = filePath.toFileInfo(); return m_client.synchronousAdd(fi.absolutePath(), fi.fileName()); } -bool FossilPluginPrivate::vcsDelete(const QString &filename) +bool FossilPluginPrivate::vcsDelete(const FilePath &filePath) { - const QFileInfo fi(filename); + const QFileInfo fi = filePath.toFileInfo(); return m_client.synchronousRemove(fi.absolutePath(), fi.fileName()); } -bool FossilPluginPrivate::vcsMove(const QString &from, const QString &to) +bool FossilPluginPrivate::vcsMove(const FilePath &from, const FilePath &to) { - const QFileInfo fromInfo(from); - const QFileInfo toInfo(to); + const QFileInfo fromInfo = from.toFileInfo(); + const QFileInfo toInfo = to.toFileInfo(); return m_client.synchronousMove(fromInfo.absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath()); } -bool FossilPluginPrivate::vcsCreateRepository(const QString &directory) +bool FossilPluginPrivate::vcsCreateRepository(const FilePath &directory) { - return m_client.synchronousCreateRepository(directory); + return m_client.synchronousCreateRepository(directory.toString()); } -void FossilPluginPrivate::vcsAnnotate(const QString &file, int line) +void FossilPluginPrivate::vcsAnnotate(const FilePath &filePath, int line) { - const QFileInfo fi(file); + const QFileInfo fi = filePath.toFileInfo(); m_client.annotate(fi.absolutePath(), fi.fileName(), QString(), line); } +void FossilPluginPrivate::vcsDescribe(const FilePath &source, const QString &id) { m_client.view(source.toString(), id); } + Core::ShellCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QString &sourceUrl, - const Utils::FilePath &baseDirectory, - const QString &localName, - const QStringList &extraArgs) + const FilePath &baseDirectory, + const QString &localName, + const QStringList &extraArgs) { QMap options; FossilJsExtension::parseArgOptions(extraArgs, options); From 439d8cc52a65bf5fb45022c689dd8700dbf5e6f8 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 30 Jul 2021 09:13:55 +0200 Subject: [PATCH 068/133] Adapt to upstream findTopLevelForFile change Change-Id: I699d524c7b9317ac74f3f2ca3027271923ab982b Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 7 ++----- plugins/fossil/fossilclient.h | 2 +- plugins/fossil/fossilplugin.cpp | 7 +++---- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index afdfcea09d6..b9bda2f8b41 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -847,12 +847,9 @@ bool FossilClient::isVcsFileOrDirectory(const FilePath &filePath) const HostOsInfo::fileNameCaseSensitivity()); } -QString FossilClient::findTopLevelForFile(const QFileInfo &file) const +FilePath FossilClient::findTopLevelForFile(const FilePath &file) const { - const QString repositoryCheckFile = Constants::FOSSILREPO; - return file.isDir() ? - VcsBase::findRepositoryForDirectory(file.absoluteFilePath(), repositoryCheckFile) : - VcsBase::findRepositoryForDirectory(file.absolutePath(), repositoryCheckFile); + return VcsBase::findRepositoryForFile(file, Constants::FOSSILREPO); } bool FossilClient::managesFile(const QString &workingDirectory, const QString &fileName) const diff --git a/plugins/fossil/fossilclient.h b/plugins/fossil/fossilclient.h index 75618932fa5..99b7e3ad738 100644 --- a/plugins/fossil/fossilclient.h +++ b/plugins/fossil/fossilclient.h @@ -109,7 +109,7 @@ public: void revertAll(const QString &workingDir, const QString &revision = QString(), const QStringList &extraOptions = QStringList()) final; bool isVcsFileOrDirectory(const Utils::FilePath &filePath) const; - QString findTopLevelForFile(const QFileInfo &file) const final; + Utils::FilePath findTopLevelForFile(const Utils::FilePath &file) const final; bool managesFile(const QString &workingDirectory, const QString &fileName) const; unsigned int binaryVersion() const; QString binaryVersionString() const; diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 1877bd257d2..14e10aa5da9 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -165,7 +165,7 @@ public: void vcsDescribe(const FilePath &source, const QString &id) final; Core::ShellCommand *createInitialCheckoutCommand(const QString &url, - const FilePath &baseDirectory, + const Utils::FilePath &baseDirectory, const QString &localName, const QStringList &extraArgs) final; @@ -907,10 +907,9 @@ bool FossilPluginPrivate::isVcsFileOrDirectory(const FilePath &filePath) const bool FossilPluginPrivate::managesDirectory(const FilePath &directory, FilePath *topLevel) const { - QFileInfo dir(directory.toString()); - const QString topLevelFound = m_client.findTopLevelForFile(dir); + const FilePath topLevelFound = m_client.findTopLevelForFile(directory); if (topLevel) - *topLevel = FilePath::fromString(topLevelFound); + *topLevel = topLevelFound; return !topLevelFound.isEmpty(); } From 34c39db79dbed008b76535d6bba3a4e3df90bd1f Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 4 Aug 2021 14:18:12 +0200 Subject: [PATCH 069/133] GitHub: Update Qt Creator, cmake & ninja, adapt build_plugin.py location Change-Id: I7b53d18f1ac5192f641b890dc9788fc0e0e2c9a9 Reviewed-by: Cristian Adam --- .github/workflows/build_cmake.yml | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 7d8099590db..77d5d8e1285 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -5,10 +5,10 @@ on: [push] env: PLUGIN_NAME: Fossil QT_VERSION: 5.15.2 - QT_CREATOR_VERSION: 4.15.0-beta1 + QT_CREATOR_VERSION: 5.0.0-rc1 QT_CREATOR_SNAPSHOT: latest - CMAKE_VERSION: 3.18.3 - NINJA_VERSION: 1.10.1 + CMAKE_VERSION: 3.21.1 + NINJA_VERSION: 1.10.2 jobs: build: @@ -45,16 +45,16 @@ jobs: if ("${{ runner.os }}" STREQUAL "Windows") set(ninja_suffix "win.zip") - set(cmake_suffix "win64-x64.zip") - set(cmake_dir "cmake-${cmake_version}-win64-x64/bin") + set(cmake_suffix "windows-x86_64.zip") + set(cmake_dir "cmake-${cmake_version}-windows-x86_64/bin") elseif ("${{ runner.os }}" STREQUAL "Linux") set(ninja_suffix "linux.zip") - set(cmake_suffix "Linux-x86_64.tar.gz") - set(cmake_dir "cmake-${cmake_version}-Linux-x86_64/bin") + set(cmake_suffix "linux-x86_64.tar.gz") + set(cmake_dir "cmake-${cmake_version}-linux-x86_64/bin") elseif ("${{ runner.os }}" STREQUAL "macOS") set(ninja_suffix "mac.zip") - set(cmake_suffix "Darwin-x86_64.tar.gz") - set(cmake_dir "cmake-${cmake_version}-Darwin-x86_64/CMake.app/Contents/bin") + set(cmake_suffix "macos-universal.tar.gz") + set(cmake_dir "cmake-${cmake_version}-macos-universal/CMake.app/Contents/bin") endif() set(ninja_url "https://github.com/ninja-build/ninja/releases/download/v${ninja_version}/ninja-${ninja_suffix}") @@ -212,10 +212,18 @@ jobs: set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") + set(build_plugin_py "scripts/build_plugin.py") + foreach(dir "share/qtcreator/scripts" "Qt Creator.app/Contents/Resources/scripts" "Contents/Resources/scripts") + if(EXISTS "${{ steps.qt_creator.outputs.qtc_dir }}/${dir}/build_plugin.py") + set(build_plugin_py "${dir}/build_plugin.py") + break() + endif() + endforeach() + execute_process( COMMAND python -u - ${{ steps.qt_creator.outputs.qtc_dir }}/scripts/build_plugin.py + ${{ steps.qt_creator.outputs.qtc_dir }}/${build_plugin_py} --name "$ENV{PLUGIN_NAME}-$ENV{QT_CREATOR_VERSION}-${{ matrix.config.artifact }}" --src . --build build From b5d598956d8e2dfccd03244494b9934b2491e64f Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 4 Aug 2021 09:06:22 +0200 Subject: [PATCH 070/133] Adapt to upstream changes * FilePathification * SynchronousProcess -> QtcProcess Change-Id: I973ff68585788c8742652f69a7c057e28aafbaf4 Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 92 ++++++++++++++++----------------- plugins/fossil/fossilclient.h | 45 ++++++++-------- plugins/fossil/fossileditor.cpp | 6 +-- plugins/fossil/fossileditor.h | 2 +- plugins/fossil/fossilplugin.cpp | 50 ++++++++---------- 5 files changed, 94 insertions(+), 101 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index b9bda2f8b41..2a6dd2b2b0a 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -261,8 +261,8 @@ unsigned int FossilClient::synchronousBinaryVersion() const QStringList args("version"); - SynchronousProcess proc; - vcsFullySynchronousExec(proc, QString(), args); + QtcProcess proc; + vcsFullySynchronousExec(proc, FilePath(), args); if (proc.result() != QtcProcess::Finished) return 0; @@ -294,13 +294,13 @@ QList FossilClient::branchListFromOutput(const QString &output, cons }); } -BranchInfo FossilClient::synchronousCurrentBranch(const QString &workingDirectory) +BranchInfo FossilClient::synchronousCurrentBranch(const FilePath &workingDirectory) { if (workingDirectory.isEmpty()) return BranchInfo(); // First try to get the current branch from the list of open branches - SynchronousProcess proc; + QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list"}); if (proc.result() != QtcProcess::Finished) return BranchInfo(); @@ -312,7 +312,7 @@ BranchInfo FossilClient::synchronousCurrentBranch(const QString &workingDirector if (!currentBranch.isCurrent()) { // If not available from open branches, request it from the list of closed branches. - SynchronousProcess proc; + QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list", "--closed"}); if (proc.result() != QtcProcess::Finished) return BranchInfo(); @@ -326,7 +326,7 @@ BranchInfo FossilClient::synchronousCurrentBranch(const QString &workingDirector return currentBranch; } -QList FossilClient::synchronousBranchQuery(const QString &workingDirectory) +QList FossilClient::synchronousBranchQuery(const FilePath &workingDirectory) { // Return a list of all branches, including the closed ones. // Sort the list by branch name. @@ -335,7 +335,7 @@ QList FossilClient::synchronousBranchQuery(const QString &workingDir return QList(); // First get list of open branches - SynchronousProcess proc; + QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list"}); if (proc.result() != QtcProcess::Finished) return QList(); @@ -371,7 +371,8 @@ QStringList FossilClient::parseRevisionCommentLine(const QString &commentLine) return QStringList({match.captured(1), match.captured(2)}); } -RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirectory, const QString &id, +RevisionInfo FossilClient::synchronousRevisionQuery(const FilePath &workingDirectory, + const QString &id, bool getCommentMsg) const { // Query details of the given revision/check-out id, @@ -383,7 +384,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect if (!id.isEmpty()) args << id; - SynchronousProcess proc; + QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args, ShellCommand::SuppressCommandLogging); if (proc.result() != QtcProcess::Finished) return RevisionInfo(); @@ -433,7 +434,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect return RevisionInfo(revisionId, parentId, mergeParentIds, commentMsg, committer); } -QStringList FossilClient::synchronousTagQuery(const QString &workingDirectory, const QString &id) +QStringList FossilClient::synchronousTagQuery(const FilePath &workingDirectory, const QString &id) { // Return a list of tags for the given revision. // If no revision specified, all defined tags are listed. @@ -447,7 +448,7 @@ QStringList FossilClient::synchronousTagQuery(const QString &workingDirectory, c if (!id.isEmpty()) args << id; - SynchronousProcess proc; + QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); if (proc.result() != QtcProcess::Finished) return QStringList(); @@ -457,7 +458,7 @@ QStringList FossilClient::synchronousTagQuery(const QString &workingDirectory, c return output.split('\n', Qt::SkipEmptyParts); } -RepositorySettings FossilClient::synchronousSettingsQuery(const QString &workingDirectory) +RepositorySettings FossilClient::synchronousSettingsQuery(const FilePath &workingDirectory) { if (workingDirectory.isEmpty()) return RepositorySettings(); @@ -470,7 +471,7 @@ RepositorySettings FossilClient::synchronousSettingsQuery(const QString &working const QStringList args("settings"); - SynchronousProcess proc; + QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); if (proc.result() != QtcProcess::Finished) return RepositorySettings(); @@ -507,7 +508,7 @@ RepositorySettings FossilClient::synchronousSettingsQuery(const QString &working return repoSettings; } -bool FossilClient::synchronousSetSetting(const QString &workingDirectory, +bool FossilClient::synchronousSetSetting(const FilePath &workingDirectory, const QString &property, const QString &value, bool isGlobal) { // set a repository property to the given value @@ -525,13 +526,13 @@ bool FossilClient::synchronousSetSetting(const QString &workingDirectory, if (isGlobal) args << "--global"; - SynchronousProcess proc; + QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); return (proc.result() == QtcProcess::Finished); } -bool FossilClient::synchronousConfigureRepository(const QString &workingDirectory, const RepositorySettings &newSettings, +bool FossilClient::synchronousConfigureRepository(const FilePath &workingDirectory, const RepositorySettings &newSettings, const RepositorySettings ¤tSettings) { if (workingDirectory.isEmpty()) @@ -575,14 +576,14 @@ bool FossilClient::synchronousConfigureRepository(const QString &workingDirector return true; } -QString FossilClient::synchronousUserDefaultQuery(const QString &workingDirectory) +QString FossilClient::synchronousUserDefaultQuery(const FilePath &workingDirectory) { if (workingDirectory.isEmpty()) return QString(); const QStringList args({"user", "default"}); - SynchronousProcess proc; + QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); if (proc.result() != QtcProcess::Finished) return QString(); @@ -592,26 +593,26 @@ QString FossilClient::synchronousUserDefaultQuery(const QString &workingDirector return output.trimmed(); } -bool FossilClient::synchronousSetUserDefault(const QString &workingDirectory, const QString &userName) +bool FossilClient::synchronousSetUserDefault(const FilePath &workingDirectory, const QString &userName) { if (workingDirectory.isEmpty() || userName.isEmpty()) return false; // set repository-default user const QStringList args({"user", "default", userName, "--user", userName}); - SynchronousProcess proc; + QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); return (proc.result() == QtcProcess::Finished); } -QString FossilClient::synchronousGetRepositoryURL(const QString &workingDirectory) +QString FossilClient::synchronousGetRepositoryURL(const FilePath &workingDirectory) { if (workingDirectory.isEmpty()) return QString(); const QStringList args("remote-url"); - SynchronousProcess proc; + QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); if (proc.result() != QtcProcess::Finished) return QString(); @@ -626,7 +627,7 @@ QString FossilClient::synchronousGetRepositoryURL(const QString &workingDirector return output; } -QString FossilClient::synchronousTopic(const QString &workingDirectory) +QString FossilClient::synchronousTopic(const FilePath &workingDirectory) { if (workingDirectory.isEmpty()) return QString(); @@ -640,7 +641,7 @@ QString FossilClient::synchronousTopic(const QString &workingDirectory) return branchInfo.name(); } -bool FossilClient::synchronousCreateRepository(const QString &workingDirectory, const QStringList &extraOptions) +bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory, const QStringList &extraOptions) { VcsBase::VcsOutputWindow *outputWindow = VcsBase::VcsOutputWindow::instance(); @@ -648,7 +649,7 @@ bool FossilClient::synchronousCreateRepository(const QString &workingDirectory, // use the configured default repository location for path // use the configured default user for admin - const QString repoName = QDir(workingDirectory).dirName().simplified(); + const QString repoName = workingDirectory.fileName().simplified(); const QString repoPath = settings().defaultRepoPath.value(); const QString adminUser = settings().userName.value(); @@ -665,7 +666,7 @@ bool FossilClient::synchronousCreateRepository(const QString &workingDirectory, if (!adminUser.isEmpty()) args << "--admin-user" << adminUser; args << extraOptions << repoFilePath.toUserOutput(); - SynchronousProcess proc; + QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); if (proc.result() != QtcProcess::Finished) return false; @@ -706,7 +707,7 @@ bool FossilClient::synchronousCreateRepository(const QString &workingDirectory, return true; } -bool FossilClient::synchronousMove(const QString &workingDir, +bool FossilClient::synchronousMove(const FilePath &workingDir, const QString &from, const QString &to, const QStringList &extraOptions) { @@ -719,12 +720,12 @@ bool FossilClient::synchronousMove(const QString &workingDir, QStringList args(vcsCommandString(MoveCommand)); args << extraOptions << from << to; - SynchronousProcess proc; + QtcProcess proc; vcsFullySynchronousExec(proc, workingDir, args); return (proc.result() == QtcProcess::Finished); } -bool FossilClient::synchronousPull(const QString &workingDir, const QString &srcLocation, const QStringList &extraOptions) +bool FossilClient::synchronousPull(const FilePath &workingDir, const QString &srcLocation, const QStringList &extraOptions) { QStringList args(vcsCommandString(PullCommand)); if (srcLocation.isEmpty()) { @@ -741,15 +742,15 @@ bool FossilClient::synchronousPull(const QString &workingDir, const QString &src VcsBase::VcsCommand::SshPasswordPrompt | VcsBase::VcsCommand::ShowStdOut | VcsBase::VcsCommand::ShowSuccessMessage; - SynchronousProcess proc; + QtcProcess proc; vcsSynchronousExec(proc, workingDir, args, flags); const bool success = (proc.result() == QtcProcess::Finished); if (success) - emit changed(QVariant(workingDir)); + emit changed(workingDir.toVariant()); return success; } -bool FossilClient::synchronousPush(const QString &workingDir, const QString &dstLocation, const QStringList &extraOptions) +bool FossilClient::synchronousPush(const FilePath &workingDir, const QString &dstLocation, const QStringList &extraOptions) { QStringList args(vcsCommandString(PushCommand)); if (dstLocation.isEmpty()) { @@ -766,20 +767,19 @@ bool FossilClient::synchronousPush(const QString &workingDir, const QString &dst VcsBase::VcsCommand::SshPasswordPrompt | VcsBase::VcsCommand::ShowStdOut | VcsBase::VcsCommand::ShowSuccessMessage; - SynchronousProcess proc; + QtcProcess proc; vcsSynchronousExec(proc, workingDir, args, flags); return (proc.result() == QtcProcess::Finished); } -void FossilClient::commit(const QString &repositoryRoot, const QStringList &files, +void FossilClient::commit(const FilePath &repositoryRoot, const QStringList &files, const QString &commitMessageFile, const QStringList &extraOptions) { VcsBaseClient::commit(repositoryRoot, files, commitMessageFile, QStringList(extraOptions) << "-M" << commitMessageFile); } -VcsBase::VcsBaseEditorWidget *FossilClient::annotate( - const QString &workingDir, const QString &file, const QString &revision, +VcsBase::VcsBaseEditorWidget *FossilClient::annotate(const FilePath &workingDir, const QString &file, const QString &revision, int lineNumber, const QStringList &extraOptions) { // 'fossil annotate' command has a variant 'fossil blame'. @@ -852,10 +852,10 @@ FilePath FossilClient::findTopLevelForFile(const FilePath &file) const return VcsBase::findRepositoryForFile(file, Constants::FOSSILREPO); } -bool FossilClient::managesFile(const QString &workingDirectory, const QString &fileName) const +bool FossilClient::managesFile(const FilePath &workingDirectory, const QString &fileName) const { const QStringList args({"finfo", fileName}); - SynchronousProcess proc; + QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); if (proc.result() != QtcProcess::Finished) return false; @@ -927,8 +927,8 @@ void FossilClient::view(const QString &source, const QString &id, const QStringL { QStringList args("diff"); - const QFileInfo fi(source); - const QString workingDirectory = fi.isFile() ? fi.absolutePath() : source; + const FilePath fPath = FilePath::fromString(source); + const FilePath workingDirectory = fPath.isFile() ? fPath.absolutePath() : fPath; RevisionInfo revisionInfo = synchronousRevisionQuery(workingDirectory,id); @@ -992,7 +992,7 @@ void FossilLogHighlighter::highlightBlock(const QString &text) } } -void FossilClient::log(const QString &workingDir, const QStringList &files, +void FossilClient::log(const FilePath &workingDir, const QStringList &files, const QStringList &extraOptions, bool enableAnnotationContextMenu) { @@ -1045,7 +1045,7 @@ void FossilClient::log(const QString &workingDir, const QStringList &files, enqueueJob(createCommand(workingDir, fossilEditor), args); } -void FossilClient::logCurrentFile(const QString &workingDir, const QStringList &files, +void FossilClient::logCurrentFile(const FilePath &workingDir, const QStringList &files, const QStringList &extraOptions, bool enableAnnotationContextMenu) { @@ -1095,7 +1095,7 @@ void FossilClient::logCurrentFile(const QString &workingDir, const QStringList & enqueueJob(createCommand(workingDir, fossilEditor), args); } -void FossilClient::revertFile(const QString &workingDir, +void FossilClient::revertFile(const FilePath &workingDir, const QString &file, const QString &revision, const QStringList &extraOptions) @@ -1108,12 +1108,12 @@ void FossilClient::revertFile(const QString &workingDir, // Indicate file list VcsBase::VcsCommand *cmd = createCommand(workingDir); - cmd->setCookie(QStringList(workingDir + "/" + file)); + cmd->setCookie(QStringList(workingDir.toString() + "/" + file)); connect(cmd, &VcsBase::VcsCommand::success, this, &VcsBase::VcsBaseClient::changed, Qt::QueuedConnection); enqueueJob(cmd, args); } -void FossilClient::revertAll(const QString &workingDir, const QString &revision, const QStringList &extraOptions) +void FossilClient::revertAll(const FilePath &workingDir, const QString &revision, const QStringList &extraOptions) { // Fossil allows whole tree revert to latest revision (effectively undoing uncommitted changes). // However it disallows revert to a specific revision for the whole tree, only for selected files. @@ -1134,7 +1134,7 @@ void FossilClient::revertAll(const QString &workingDir, const QString &revision, // Indicate repository change VcsBase::VcsCommand *cmd = createCommand(workingDir); - cmd->setCookie(QStringList(workingDir)); + cmd->setCookie(QStringList(workingDir.toString())); connect(cmd, &VcsBase::VcsCommand::success, this, &VcsBase::VcsBaseClient::changed, Qt::QueuedConnection); enqueueJob(createCommand(workingDir), args); } diff --git a/plugins/fossil/fossilclient.h b/plugins/fossil/fossilclient.h index 99b7e3ad738..6af10c05465 100644 --- a/plugins/fossil/fossilclient.h +++ b/plugins/fossil/fossilclient.h @@ -67,50 +67,51 @@ public: FossilSettings &settings() const; unsigned int synchronousBinaryVersion() const; - BranchInfo synchronousCurrentBranch(const QString &workingDirectory); - QList synchronousBranchQuery(const QString &workingDirectory); - RevisionInfo synchronousRevisionQuery(const QString &workingDirectory, const QString &id = QString(), + BranchInfo synchronousCurrentBranch(const Utils::FilePath &workingDirectory); + QList synchronousBranchQuery(const Utils::FilePath &workingDirectory); + RevisionInfo synchronousRevisionQuery(const Utils::FilePath &workingDirectory, + const QString &id = QString(), bool getCommentMsg = false) const; - QStringList synchronousTagQuery(const QString &workingDirectory, const QString &id = QString()); - RepositorySettings synchronousSettingsQuery(const QString &workingDirectory); - bool synchronousSetSetting(const QString &workingDirectory, const QString &property, + QStringList synchronousTagQuery(const Utils::FilePath &workingDirectory, const QString &id = {}); + RepositorySettings synchronousSettingsQuery(const Utils::FilePath &workingDirectory); + bool synchronousSetSetting(const Utils::FilePath &workingDirectory, const QString &property, const QString &value = QString(), bool isGlobal = false); - bool synchronousConfigureRepository(const QString &workingDirectory, const RepositorySettings &newSettings, + bool synchronousConfigureRepository(const Utils::FilePath &workingDirectory, const RepositorySettings &newSettings, const RepositorySettings ¤tSettings = RepositorySettings()); - QString synchronousUserDefaultQuery(const QString &workingDirectory); - bool synchronousSetUserDefault(const QString &workingDirectory, const QString &userName); - QString synchronousGetRepositoryURL(const QString &workingDirectory); - QString synchronousTopic(const QString &workingDirectory); - bool synchronousCreateRepository(const QString &workingDirectory, + QString synchronousUserDefaultQuery(const Utils::FilePath &workingDirectory); + bool synchronousSetUserDefault(const Utils::FilePath &workingDirectory, const QString &userName); + QString synchronousGetRepositoryURL(const Utils::FilePath &workingDirectory); + QString synchronousTopic(const Utils::FilePath &workingDirectory); + bool synchronousCreateRepository(const Utils::FilePath &workingDirectory, const QStringList &extraOptions = QStringList()) final; - bool synchronousMove(const QString &workingDir, + bool synchronousMove(const Utils::FilePath &workingDir, const QString &from, const QString &to, const QStringList &extraOptions = QStringList()) final; - bool synchronousPull(const QString &workingDir, + bool synchronousPull(const Utils::FilePath &workingDir, const QString &srcLocation, const QStringList &extraOptions = QStringList()) final; - bool synchronousPush(const QString &workingDir, + bool synchronousPush(const Utils::FilePath &workingDir, const QString &dstLocation, const QStringList &extraOptions = QStringList()) final; - void commit(const QString &repositoryRoot, const QStringList &files, + void commit(const Utils::FilePath &repositoryRoot, const QStringList &files, const QString &commitMessageFile, const QStringList &extraOptions = QStringList()) final; VcsBase::VcsBaseEditorWidget *annotate( - const QString &workingDir, const QString &file, const QString &revision = QString(), + const Utils::FilePath &workingDir, const QString &file, const QString &revision = {}, int lineNumber = -1, const QStringList &extraOptions = QStringList()) final; - void log(const QString &workingDir, const QStringList &files = QStringList(), + void log(const Utils::FilePath &workingDir, const QStringList &files = QStringList(), const QStringList &extraOptions = QStringList(), bool enableAnnotationContextMenu = false) final; - void logCurrentFile(const QString &workingDir, const QStringList &files = QStringList(), + void logCurrentFile(const Utils::FilePath &workingDir, const QStringList &files = QStringList(), const QStringList &extraOptions = QStringList(), bool enableAnnotationContextMenu = false); - void revertFile(const QString &workingDir, const QString &file, + void revertFile(const Utils::FilePath &workingDir, const QString &file, const QString &revision = QString(), const QStringList &extraOptions = QStringList()) final; - void revertAll(const QString &workingDir, const QString &revision = QString(), + void revertAll(const Utils::FilePath &workingDir, const QString &revision = QString(), const QStringList &extraOptions = QStringList()) final; bool isVcsFileOrDirectory(const Utils::FilePath &filePath) const; Utils::FilePath findTopLevelForFile(const Utils::FilePath &file) const final; - bool managesFile(const QString &workingDirectory, const QString &fileName) const; + bool managesFile(const Utils::FilePath &workingDirectory, const QString &fileName) const; unsigned int binaryVersion() const; QString binaryVersionString() const; SupportedFeatures supportedFeatures() const; diff --git a/plugins/fossil/fossileditor.cpp b/plugins/fossil/fossileditor.cpp index cab8dbf68c0..adeacda4fc5 100644 --- a/plugins/fossil/fossileditor.cpp +++ b/plugins/fossil/fossileditor.cpp @@ -90,8 +90,7 @@ QString FossilEditorWidget::decorateVersion(const QString &revision) const static const int shortChangesetIdSize(10); static const int maxTextSize(120); - const QFileInfo fi(source()); - const QString workingDirectory = fi.absolutePath(); + const Utils::FilePath workingDirectory = Utils::FilePath::fromString(source()).parentDir(); const FossilClient *client = FossilPlugin::client(); RevisionInfo revisionInfo = client->synchronousRevisionQuery(workingDirectory, revision, true); @@ -112,8 +111,7 @@ QString FossilEditorWidget::decorateVersion(const QString &revision) const QStringList FossilEditorWidget::annotationPreviousVersions(const QString &revision) const { QStringList revisions; - const QFileInfo fi(source()); - const QString workingDirectory = fi.absolutePath(); + const Utils::FilePath workingDirectory = Utils::FilePath::fromString(source()).parentDir(); const FossilClient *client = FossilPlugin::client(); RevisionInfo revisionInfo = client->synchronousRevisionQuery(workingDirectory, revision); diff --git a/plugins/fossil/fossileditor.h b/plugins/fossil/fossileditor.h index c9612f1a61a..78215792231 100644 --- a/plugins/fossil/fossileditor.h +++ b/plugins/fossil/fossileditor.h @@ -32,7 +32,7 @@ namespace Internal { class FossilEditorWidgetPrivate; -class FossilEditorWidget : public VcsBase::VcsBaseEditorWidget +class FossilEditorWidget final : public VcsBase::VcsBaseEditorWidget { Q_OBJECT diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 14e10aa5da9..9fb5d0cbb21 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -96,7 +96,7 @@ protected: QString refreshTopic(const FilePath &repository) final { - return m_client->synchronousTopic(repository.toString()); + return m_client->synchronousTopic(repository); } private: @@ -255,7 +255,7 @@ public: // Submit editor actions QAction *m_menuAction = nullptr; - QString m_submitRepository; + Utils::FilePath m_submitRepository; bool m_submitActionTriggered = false; // To be connected to the VcsTask's success signal to emit the repository/ @@ -729,8 +729,7 @@ void FossilPluginPrivate::showCommitWidget(const QListdocument()->setPreferredDisplayName(msg); const RevisionInfo currentRevision = m_client.synchronousRevisionQuery(m_submitRepository); @@ -739,7 +738,7 @@ void FossilPluginPrivate::showCommitWidget(const QListsetFields(m_submitRepository, currentBranch, tags, currentUser, status); + commitEditor->setFields(m_submitRepository.toString(), currentBranch, tags, currentUser, status); connect(commitEditor, &VcsBase::VcsBaseSubmitEditor::diffSelectedFiles, this, &FossilPluginPrivate::diffFromEditorSelected); @@ -763,27 +762,27 @@ void FossilPluginPrivate::createRepository() // re-implemented from void VcsBasePlugin::createRepository() // Find current starting directory - QString directory; + Utils::FilePath directory; if (const ProjectExplorer::Project *currentProject = ProjectExplorer::ProjectTree::currentProject()) - directory = currentProject->projectDirectory().toString(); + directory = currentProject->projectDirectory(); // Prompt for a directory that is not under version control yet QWidget *mw = Core::ICore::mainWindow(); do { - directory = QFileDialog::getExistingDirectory(mw, tr("Choose Checkout Directory"), directory); + directory = FileUtils::getExistingDirectory(tr("Choose Checkout Directory"), directory); if (directory.isEmpty()) return; const Core::IVersionControl *managingControl = Core::VcsManager::findVersionControlForDirectory(directory); if (managingControl == 0) break; const QString question = tr("The directory \"%1\" is already managed by a version control system (%2)." - " Would you like to specify another directory?").arg(directory, managingControl->displayName()); + " Would you like to specify another directory?").arg(directory.toUserOutput(), managingControl->displayName()); if (!ask(mw, tr("Repository already under version control"), question)) return; } while (true); // Create - const bool rc = vcsCreateRepository(FilePath::fromString(directory)); - const QString nativeDir = QDir::toNativeSeparators(directory); + const bool rc = vcsCreateRepository(directory); + const QString nativeDir = directory.toUserOutput(); if (rc) { QMessageBox::information(mw, tr("Repository Created"), tr("A version control repository has been created in %1."). @@ -915,7 +914,7 @@ bool FossilPluginPrivate::managesDirectory(const FilePath &directory, FilePath * bool FossilPluginPrivate::managesFile(const FilePath &workingDirectory, const QString &fileName) const { - return m_client.managesFile(workingDirectory.toString(), fileName); + return m_client.managesFile(workingDirectory, fileName); } bool FossilPluginPrivate::isConfigured() const @@ -967,34 +966,31 @@ bool FossilPluginPrivate::vcsOpen(const FilePath &filePath) bool FossilPluginPrivate::vcsAdd(const FilePath &filePath) { - const QFileInfo fi = filePath.toFileInfo(); - return m_client.synchronousAdd(fi.absolutePath(), fi.fileName()); + return m_client.synchronousAdd(filePath.absolutePath(), filePath.fileName()); } bool FossilPluginPrivate::vcsDelete(const FilePath &filePath) { - const QFileInfo fi = filePath.toFileInfo(); - return m_client.synchronousRemove(fi.absolutePath(), fi.fileName()); + return m_client.synchronousRemove(filePath.absolutePath(), filePath.fileName()); } bool FossilPluginPrivate::vcsMove(const FilePath &from, const FilePath &to) { const QFileInfo fromInfo = from.toFileInfo(); const QFileInfo toInfo = to.toFileInfo(); - return m_client.synchronousMove(fromInfo.absolutePath(), - fromInfo.absoluteFilePath(), - toInfo.absoluteFilePath()); + return m_client.synchronousMove(from.absolutePath(), + fromInfo.absoluteFilePath(), + toInfo.absoluteFilePath()); } bool FossilPluginPrivate::vcsCreateRepository(const FilePath &directory) { - return m_client.synchronousCreateRepository(directory.toString()); + return m_client.synchronousCreateRepository(directory); } void FossilPluginPrivate::vcsAnnotate(const FilePath &filePath, int line) { - const QFileInfo fi = filePath.toFileInfo(); - m_client.annotate(fi.absolutePath(), fi.fileName(), QString(), line); + m_client.annotate(filePath.absolutePath(), filePath.fileName(), QString(), line); } void FossilPluginPrivate::vcsDescribe(const FilePath &source, const QString &id) { m_client.view(source.toString(), id); } @@ -1018,7 +1014,7 @@ Core::ShellCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QStr // -- open/checkout an existing local fossil // Clone URL is an absolute local path and is the same as the local fossil. - const QString checkoutPath = baseDirectory.pathAppended(localName).toString(); + const Utils::FilePath checkoutPath = baseDirectory.pathAppended(localName); const QString fossilFile = options.value("fossil-file"); const Utils::FilePath fossilFilePath = Utils::FilePath::fromUserInput(QDir::fromNativeSeparators(fossilFile)); const QString fossilFileNative = fossilFilePath.toUserOutput(); @@ -1043,12 +1039,10 @@ Core::ShellCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QStr // first create the checkout directory, // as it needs to become a working directory for wizard command jobs - - const QDir checkoutDir(checkoutPath); - checkoutDir.mkpath(checkoutPath); + checkoutPath.createDir(); // Setup the wizard page command job - auto command = new VcsBase::VcsCommand(checkoutDir.path(), m_client.processEnvironment()); + auto command = new VcsBase::VcsCommand(checkoutPath, m_client.processEnvironment()); if (!isLocalRepository && !cloneRepository.exists()) { @@ -1116,7 +1110,7 @@ void FossilPluginPrivate::changed(const QVariant &v) { switch (v.type()) { case QVariant::String: - emit repositoryChanged(v.toString()); + emit repositoryChanged(Utils::FilePath::fromVariant(v)); break; case QVariant::StringList: emit filesChanged(v.toStringList()); From 8b3d718b3a303a4a9ba18f358680a931fb918967 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 24 Aug 2021 08:39:20 +0200 Subject: [PATCH 071/133] Adapt to upstream change Change-Id: If64379f70be8b241be1d671a470c5da6f3febc10 Reviewed-by: hjk --- plugins/fossil/fossilplugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 9fb5d0cbb21..5bc006a0c30 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -768,7 +768,7 @@ void FossilPluginPrivate::createRepository() // Prompt for a directory that is not under version control yet QWidget *mw = Core::ICore::mainWindow(); do { - directory = FileUtils::getExistingDirectory(tr("Choose Checkout Directory"), directory); + directory = FileUtils::getExistingDirectory(nullptr, tr("Choose Checkout Directory"), directory); if (directory.isEmpty()) return; const Core::IVersionControl *managingControl = Core::VcsManager::findVersionControlForDirectory(directory); From 71f975de85fd4c887b4dec4fe1b66776904e826c Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 22 Oct 2021 09:07:26 +0200 Subject: [PATCH 072/133] GitHub: Build against Qt Creator 6 snapshot with Qt 6.2 Change-Id: I5505a76d2ccb480eed5acbb90c7992cbba6f739d Reviewed-by: Cristian Adam --- .github/workflows/build_cmake.yml | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 77d5d8e1285..caa75cef8ef 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -4,8 +4,8 @@ on: [push] env: PLUGIN_NAME: Fossil - QT_VERSION: 5.15.2 - QT_CREATOR_VERSION: 5.0.0-rc1 + QT_VERSION: 6.2.0 + QT_CREATOR_VERSION: 6.0.0-beta2 QT_CREATOR_SNAPSHOT: latest CMAKE_VERSION: 3.21.1 NINJA_VERSION: 1.10.2 @@ -112,37 +112,44 @@ jobs: set(url_os "linux_x64") set(qt_package_arch_suffix "gcc_64") set(qt_dir_prefix "${qt_version}/gcc_64") - set(qt_package_suffix "-Linux-RHEL_7_6-GCC-Linux-RHEL_7_6-X86_64") + set(qt_package_suffix "-Linux-RHEL_8_2-GCC-Linux-RHEL_8_2-X86_64") elseif ("${{ runner.os }}" STREQUAL "macOS") set(url_os "mac_x64") set(qt_package_arch_suffix "clang_64") - set(qt_dir_prefix "${qt_version}/clang_64") - set(qt_package_suffix "-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64") + set(qt_dir_prefix "${qt_version}/macos") + set(qt_package_suffix "-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64-ARM64") endif() - set(qt_base_url "https://download.qt.io/online/qtsdkrepository/${url_os}/desktop/qt5_${qt_version_dotless}") + set(qt_base_url "https://download.qt.io/online/qtsdkrepository/${url_os}/desktop/qt6_${qt_version_dotless}") file(DOWNLOAD "${qt_base_url}/Updates.xml" ./Updates.xml SHOW_PROGRESS) file(READ ./Updates.xml updates_xml) - string(REGEX MATCH "qt.qt5.*([0-9+-.]+)" updates_xml_output "${updates_xml}") + string(REGEX MATCH "qt.qt6.*([0-9+-.]+)" updates_xml_output "${updates_xml}") set(qt_package_version ${CMAKE_MATCH_1}) - file(MAKE_DIRECTORY qt5) + file(MAKE_DIRECTORY qt) # Save the path for other steps - file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt5/${qt_dir_prefix}" qt_dir) + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt/${qt_dir_prefix}" qt_dir) message("::set-output name=qt_dir::${qt_dir}") message("Downloading Qt to ${qt_dir}") function(downloadAndExtract url archive) message("Downloading ${url}") file(DOWNLOAD "${url}" ./${archive} SHOW_PROGRESS) - execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../${archive} WORKING_DIRECTORY qt5) + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../${archive} WORKING_DIRECTORY qt) endfunction() foreach(package qtbase qtdeclarative) downloadAndExtract( - "${qt_base_url}/qt.qt5.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z" + "${qt_base_url}/qt.qt6.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z" + ${package}.7z + ) + endforeach() + + foreach(package qt5compat qtshadertools) + downloadAndExtract( + "${qt_base_url}/qt.qt6.${qt_version_dotless}.${package}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z" ${package}.7z ) endforeach() @@ -150,7 +157,7 @@ jobs: # uic depends on libicu56.so if ("${{ runner.os }}" STREQUAL "Linux") downloadAndExtract( - "${qt_base_url}/qt.qt5.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}icu-linux-Rhel7.2-x64.7z" + "${qt_base_url}/qt.qt6.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}icu-linux-Rhel7.2-x64.7z" icu.7z ) endif() From f37bd2436d2a2349718f69f67e9ca3e49094b977 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 3 Nov 2021 08:17:57 +0100 Subject: [PATCH 073/133] Adapt to upstream change Change-Id: I382253de65d1accf9693348f361924eb58d0bed0 Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilplugin.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 5bc006a0c30..d9df725b48f 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -714,8 +714,7 @@ void FossilPluginPrivate::showCommitWidget(const QList Date: Tue, 23 Nov 2021 11:45:01 +0100 Subject: [PATCH 074/133] Doc: Fix dependency to Qt Creator Change-Id: If7082978c204f8e5a84e40668b9aee26f0014668 Reviewed-by: Leena Miettinen --- doc/config/fossil.qdocconf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/config/fossil.qdocconf b/doc/config/fossil.qdocconf index 290023fba2d..98433df81dd 100644 --- a/doc/config/fossil.qdocconf +++ b/doc/config/fossil.qdocconf @@ -10,7 +10,7 @@ include($$QTC_DOCS_DIR/config/qt-defines.qdocconf) sources.fileextensions = "*.qdoc" -depends += qt-creator +depends += qtcreator qhp.projects = fossil qhp.fossil.file = fossil.qhp From 9a351ad5f8a2a85c13eea40fa0a7fc4399b098af Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 2 Dec 2021 11:37:38 +0100 Subject: [PATCH 075/133] GitHub: Bump to QtC 6.0 and Qt 6.2.1 Change-Id: If36a5e7ca71f40ecb701b7fd3e66e7fe0bd1c47f Reviewed-by: Cristian Adam --- .github/workflows/build_cmake.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index caa75cef8ef..8f77cd3d5dc 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -4,9 +4,9 @@ on: [push] env: PLUGIN_NAME: Fossil - QT_VERSION: 6.2.0 - QT_CREATOR_VERSION: 6.0.0-beta2 - QT_CREATOR_SNAPSHOT: latest + QT_VERSION: 6.2.1 + QT_CREATOR_VERSION: 6.0.0 + QT_CREATOR_SNAPSHOT: NO CMAKE_VERSION: 3.21.1 NINJA_VERSION: 1.10.2 From 02804556234e88866ac174fc8ea4b91f8b35ac5a Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 26 Jan 2022 11:38:35 +0100 Subject: [PATCH 076/133] Remove qmake build files Change-Id: I88f7bf7b04429a2501ad34dea7663ee8dafba820 Reviewed-by: hjk --- doc/doc.pri | 6 ---- fossil.pro | 11 ------- plugins/fossil/fossil.pro | 40 -------------------------- plugins/fossil/fossil_dependencies.pri | 9 ------ 4 files changed, 66 deletions(-) delete mode 100644 doc/doc.pri delete mode 100644 fossil.pro delete mode 100644 plugins/fossil/fossil.pro delete mode 100644 plugins/fossil/fossil_dependencies.pri diff --git a/doc/doc.pri b/doc/doc.pri deleted file mode 100644 index 155d6af9a81..00000000000 --- a/doc/doc.pri +++ /dev/null @@ -1,6 +0,0 @@ -build_online_docs: \ - DOC_FILES = $$PWD/fossil-online.qdocconf -else: \ - DOC_FILES = $$PWD/fossil.qdocconf - -include($$IDE_SOURCE_TREE/docs.pri) diff --git a/fossil.pro b/fossil.pro deleted file mode 100644 index 629cd87c6fd..00000000000 --- a/fossil.pro +++ /dev/null @@ -1,11 +0,0 @@ -isEmpty(IDE_SOURCE_TREE): IDE_SOURCE_TREE = $$(QTC_SOURCE) -isEmpty(IDE_SOURCE_TREE): error("You need to set the environment variable QTC_SOURCE to point to the directory where the Qt Creator sources are") - -isEmpty(IDE_BUILD_TREE): IDE_BUILD_TREE = $$(QTC_BUILD) -isEmpty(IDE_BUILD_TREE): error("You need to set the environment variable QTC_BUILD to point to the directory where Qt Creator was built") - -TEMPLATE = subdirs -SUBDIRS += plugins/fossil - -include($$IDE_SOURCE_TREE/qtcreator.pri) -include(doc/doc.pri) diff --git a/plugins/fossil/fossil.pro b/plugins/fossil/fossil.pro deleted file mode 100644 index c423ad164b2..00000000000 --- a/plugins/fossil/fossil.pro +++ /dev/null @@ -1,40 +0,0 @@ -isEmpty(IDE_SOURCE_TREE): IDE_SOURCE_TREE = $$(QTC_SOURCE) -isEmpty(IDE_SOURCE_TREE): error("You need to set the environment variable QTC_SOURCE to point to the directory where the Qt Creator sources are") - -isEmpty(IDE_BUILD_TREE): IDE_BUILD_TREE = $$(QTC_BUILD) -isEmpty(IDE_BUILD_TREE): error("You need to set the environment variable QTC_BUILD to point to the directory where Qt Creator was built") - -include($$IDE_SOURCE_TREE/src/qtcreatorplugin.pri) -SOURCES += \ - fossilclient.cpp \ - fossilplugin.cpp \ - fossilsettings.cpp \ - commiteditor.cpp \ - fossilcommitwidget.cpp \ - fossileditor.cpp \ - annotationhighlighter.cpp \ - pullorpushdialog.cpp \ - branchinfo.cpp \ - configuredialog.cpp \ - revisioninfo.cpp \ - wizard/fossiljsextension.cpp -HEADERS += \ - fossilclient.h \ - constants.h \ - fossilplugin.h \ - fossilsettings.h \ - commiteditor.h \ - fossilcommitwidget.h \ - fossileditor.h \ - annotationhighlighter.h \ - pullorpushdialog.h \ - branchinfo.h \ - configuredialog.h \ - revisioninfo.h \ - wizard/fossiljsextension.h -FORMS += \ - revertdialog.ui \ - fossilcommitpanel.ui \ - pullorpushdialog.ui \ - configuredialog.ui -RESOURCES += fossil.qrc diff --git a/plugins/fossil/fossil_dependencies.pri b/plugins/fossil/fossil_dependencies.pri deleted file mode 100644 index 44d52129d93..00000000000 --- a/plugins/fossil/fossil_dependencies.pri +++ /dev/null @@ -1,9 +0,0 @@ -QTC_PLUGIN_NAME = Fossil -QTC_LIB_DEPENDS += \ - extensionsystem \ - utils -QTC_PLUGIN_DEPENDS += \ - texteditor \ - projectexplorer \ - coreplugin \ - vcsbase From 1eb9263e315107fdd977c085282c6b8e2e41d691 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 26 Jan 2022 16:37:41 +0100 Subject: [PATCH 077/133] GitHub: Use checkout@v2 Fixes security concerns of v1 Change-Id: Ib62b3d51459d6e6d07bdacc63b9d2f7b4fcf584f Reviewed-by: Cristian Adam --- .github/workflows/build_cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 8f77cd3d5dc..23e27514f3d 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -35,7 +35,7 @@ jobs: } steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Download Ninja and CMake shell: cmake -P {0} From 8cec0274a50d756f9689674f4be569e616976764 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 9 Mar 2022 08:18:50 +0100 Subject: [PATCH 078/133] Adapt to upstream changes Change-Id: Iaa94ecf5614aa1fa86f288b7db9141efbb06318d Reviewed-by: Jarek Kobus --- plugins/fossil/fossilclient.cpp | 40 +++++++++++++++++---------------- plugins/fossil/fossilplugin.cpp | 1 + 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 2a6dd2b2b0a..f2a1b55a23a 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -36,7 +36,9 @@ #include #include #include +#include #include +#include #include #include @@ -263,7 +265,7 @@ unsigned int FossilClient::synchronousBinaryVersion() const QtcProcess proc; vcsFullySynchronousExec(proc, FilePath(), args); - if (proc.result() != QtcProcess::Finished) + if (proc.result() != ProcessResult::Finished) return 0; QString output = proc.stdOut(); @@ -302,7 +304,7 @@ BranchInfo FossilClient::synchronousCurrentBranch(const FilePath &workingDirecto // First try to get the current branch from the list of open branches QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list"}); - if (proc.result() != QtcProcess::Finished) + if (proc.result() != ProcessResult::Finished) return BranchInfo(); const QString output = sanitizeFossilOutput(proc.stdOut()); @@ -314,7 +316,7 @@ BranchInfo FossilClient::synchronousCurrentBranch(const FilePath &workingDirecto // If not available from open branches, request it from the list of closed branches. QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list", "--closed"}); - if (proc.result() != QtcProcess::Finished) + if (proc.result() != ProcessResult::Finished) return BranchInfo(); const QString output = sanitizeFossilOutput(proc.stdOut()); @@ -337,7 +339,7 @@ QList FossilClient::synchronousBranchQuery(const FilePath &workingDi // First get list of open branches QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list"}); - if (proc.result() != QtcProcess::Finished) + if (proc.result() != ProcessResult::Finished) return QList(); QString output = sanitizeFossilOutput(proc.stdOut()); @@ -345,7 +347,7 @@ QList FossilClient::synchronousBranchQuery(const FilePath &workingDi // Append a list of closed branches. vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list", "--closed"}); - if (proc.result() != QtcProcess::Finished) + if (proc.result() != ProcessResult::Finished) return QList(); output = sanitizeFossilOutput(proc.stdOut()); @@ -386,7 +388,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const FilePath &workingDirec QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args, ShellCommand::SuppressCommandLogging); - if (proc.result() != QtcProcess::Finished) + if (proc.result() != ProcessResult::Finished) return RevisionInfo(); const QString output = sanitizeFossilOutput(proc.stdOut()); @@ -450,7 +452,7 @@ QStringList FossilClient::synchronousTagQuery(const FilePath &workingDirectory, QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != QtcProcess::Finished) + if (proc.result() != ProcessResult::Finished) return QStringList(); const QString output = sanitizeFossilOutput(proc.stdOut()); @@ -473,7 +475,7 @@ RepositorySettings FossilClient::synchronousSettingsQuery(const FilePath &workin QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != QtcProcess::Finished) + if (proc.result() != ProcessResult::Finished) return RepositorySettings(); const QString output = sanitizeFossilOutput(proc.stdOut()); @@ -528,7 +530,7 @@ bool FossilClient::synchronousSetSetting(const FilePath &workingDirectory, QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); - return (proc.result() == QtcProcess::Finished); + return (proc.result() == ProcessResult::Finished); } @@ -585,7 +587,7 @@ QString FossilClient::synchronousUserDefaultQuery(const FilePath &workingDirecto QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != QtcProcess::Finished) + if (proc.result() != ProcessResult::Finished) return QString(); QString output = sanitizeFossilOutput(proc.stdOut()); @@ -602,7 +604,7 @@ bool FossilClient::synchronousSetUserDefault(const FilePath &workingDirectory, c const QStringList args({"user", "default", userName, "--user", userName}); QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); - return (proc.result() == QtcProcess::Finished); + return (proc.result() == ProcessResult::Finished); } QString FossilClient::synchronousGetRepositoryURL(const FilePath &workingDirectory) @@ -614,7 +616,7 @@ QString FossilClient::synchronousGetRepositoryURL(const FilePath &workingDirecto QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != QtcProcess::Finished) + if (proc.result() != ProcessResult::Finished) return QString(); QString output = sanitizeFossilOutput(proc.stdOut()); @@ -668,7 +670,7 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory, args << extraOptions << repoFilePath.toUserOutput(); QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != QtcProcess::Finished) + if (proc.result() != ProcessResult::Finished) return false; QString output = sanitizeFossilOutput(proc.stdOut()); @@ -681,7 +683,7 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory, args << "open" << repoFilePath.toUserOutput(); vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != QtcProcess::Finished) + if (proc.result() != ProcessResult::Finished) return false; output = sanitizeFossilOutput(proc.stdOut()); @@ -695,7 +697,7 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory, args << "user" << "default" << adminUser << "--user" << adminUser; vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != QtcProcess::Finished) + if (proc.result() != ProcessResult::Finished) return false; QString output = sanitizeFossilOutput(proc.stdOut()); @@ -722,7 +724,7 @@ bool FossilClient::synchronousMove(const FilePath &workingDir, args << extraOptions << from << to; QtcProcess proc; vcsFullySynchronousExec(proc, workingDir, args); - return (proc.result() == QtcProcess::Finished); + return (proc.result() == ProcessResult::Finished); } bool FossilClient::synchronousPull(const FilePath &workingDir, const QString &srcLocation, const QStringList &extraOptions) @@ -744,7 +746,7 @@ bool FossilClient::synchronousPull(const FilePath &workingDir, const QString &sr | VcsBase::VcsCommand::ShowSuccessMessage; QtcProcess proc; vcsSynchronousExec(proc, workingDir, args, flags); - const bool success = (proc.result() == QtcProcess::Finished); + const bool success = (proc.result() == ProcessResult::Finished); if (success) emit changed(workingDir.toVariant()); return success; @@ -769,7 +771,7 @@ bool FossilClient::synchronousPush(const FilePath &workingDir, const QString &ds | VcsBase::VcsCommand::ShowSuccessMessage; QtcProcess proc; vcsSynchronousExec(proc, workingDir, args, flags); - return (proc.result() == QtcProcess::Finished); + return (proc.result() == ProcessResult::Finished); } void FossilClient::commit(const FilePath &repositoryRoot, const QStringList &files, @@ -857,7 +859,7 @@ bool FossilClient::managesFile(const FilePath &workingDirectory, const QString & const QStringList args({"finfo", fileName}); QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != QtcProcess::Finished) + if (proc.result() != ProcessResult::Finished) return false; QString output = sanitizeFossilOutput(proc.stdOut()); return !output.startsWith("no history for file", Qt::CaseInsensitive); diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index d9df725b48f..cdb20b73430 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -53,6 +53,7 @@ #include #include +#include #include #include From f46df201aa73bef328b1b533da14e4496251fd88 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 23 May 2022 08:10:48 +0200 Subject: [PATCH 079/133] Adapt to upstream change Change-Id: Ic977a404aee47bb71a927bdd77fd4f06d98e1e95 Reviewed-by: Jarek Kobus --- plugins/fossil/fossilclient.cpp | 38 ++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index f2a1b55a23a..5885e0fb773 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -265,7 +265,7 @@ unsigned int FossilClient::synchronousBinaryVersion() const QtcProcess proc; vcsFullySynchronousExec(proc, FilePath(), args); - if (proc.result() != ProcessResult::Finished) + if (proc.result() != ProcessResult::FinishedWithSuccess) return 0; QString output = proc.stdOut(); @@ -304,7 +304,7 @@ BranchInfo FossilClient::synchronousCurrentBranch(const FilePath &workingDirecto // First try to get the current branch from the list of open branches QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list"}); - if (proc.result() != ProcessResult::Finished) + if (proc.result() != ProcessResult::FinishedWithSuccess) return BranchInfo(); const QString output = sanitizeFossilOutput(proc.stdOut()); @@ -316,7 +316,7 @@ BranchInfo FossilClient::synchronousCurrentBranch(const FilePath &workingDirecto // If not available from open branches, request it from the list of closed branches. QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list", "--closed"}); - if (proc.result() != ProcessResult::Finished) + if (proc.result() != ProcessResult::FinishedWithSuccess) return BranchInfo(); const QString output = sanitizeFossilOutput(proc.stdOut()); @@ -339,7 +339,7 @@ QList FossilClient::synchronousBranchQuery(const FilePath &workingDi // First get list of open branches QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list"}); - if (proc.result() != ProcessResult::Finished) + if (proc.result() != ProcessResult::FinishedWithSuccess) return QList(); QString output = sanitizeFossilOutput(proc.stdOut()); @@ -347,7 +347,7 @@ QList FossilClient::synchronousBranchQuery(const FilePath &workingDi // Append a list of closed branches. vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list", "--closed"}); - if (proc.result() != ProcessResult::Finished) + if (proc.result() != ProcessResult::FinishedWithSuccess) return QList(); output = sanitizeFossilOutput(proc.stdOut()); @@ -388,7 +388,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const FilePath &workingDirec QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args, ShellCommand::SuppressCommandLogging); - if (proc.result() != ProcessResult::Finished) + if (proc.result() != ProcessResult::FinishedWithSuccess) return RevisionInfo(); const QString output = sanitizeFossilOutput(proc.stdOut()); @@ -452,7 +452,7 @@ QStringList FossilClient::synchronousTagQuery(const FilePath &workingDirectory, QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != ProcessResult::Finished) + if (proc.result() != ProcessResult::FinishedWithSuccess) return QStringList(); const QString output = sanitizeFossilOutput(proc.stdOut()); @@ -475,7 +475,7 @@ RepositorySettings FossilClient::synchronousSettingsQuery(const FilePath &workin QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != ProcessResult::Finished) + if (proc.result() != ProcessResult::FinishedWithSuccess) return RepositorySettings(); const QString output = sanitizeFossilOutput(proc.stdOut()); @@ -530,7 +530,7 @@ bool FossilClient::synchronousSetSetting(const FilePath &workingDirectory, QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); - return (proc.result() == ProcessResult::Finished); + return (proc.result() == ProcessResult::FinishedWithSuccess); } @@ -587,7 +587,7 @@ QString FossilClient::synchronousUserDefaultQuery(const FilePath &workingDirecto QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != ProcessResult::Finished) + if (proc.result() != ProcessResult::FinishedWithSuccess) return QString(); QString output = sanitizeFossilOutput(proc.stdOut()); @@ -604,7 +604,7 @@ bool FossilClient::synchronousSetUserDefault(const FilePath &workingDirectory, c const QStringList args({"user", "default", userName, "--user", userName}); QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); - return (proc.result() == ProcessResult::Finished); + return (proc.result() == ProcessResult::FinishedWithSuccess); } QString FossilClient::synchronousGetRepositoryURL(const FilePath &workingDirectory) @@ -616,7 +616,7 @@ QString FossilClient::synchronousGetRepositoryURL(const FilePath &workingDirecto QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != ProcessResult::Finished) + if (proc.result() != ProcessResult::FinishedWithSuccess) return QString(); QString output = sanitizeFossilOutput(proc.stdOut()); @@ -670,7 +670,7 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory, args << extraOptions << repoFilePath.toUserOutput(); QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != ProcessResult::Finished) + if (proc.result() != ProcessResult::FinishedWithSuccess) return false; QString output = sanitizeFossilOutput(proc.stdOut()); @@ -683,7 +683,7 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory, args << "open" << repoFilePath.toUserOutput(); vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != ProcessResult::Finished) + if (proc.result() != ProcessResult::FinishedWithSuccess) return false; output = sanitizeFossilOutput(proc.stdOut()); @@ -697,7 +697,7 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory, args << "user" << "default" << adminUser << "--user" << adminUser; vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != ProcessResult::Finished) + if (proc.result() != ProcessResult::FinishedWithSuccess) return false; QString output = sanitizeFossilOutput(proc.stdOut()); @@ -724,7 +724,7 @@ bool FossilClient::synchronousMove(const FilePath &workingDir, args << extraOptions << from << to; QtcProcess proc; vcsFullySynchronousExec(proc, workingDir, args); - return (proc.result() == ProcessResult::Finished); + return (proc.result() == ProcessResult::FinishedWithSuccess); } bool FossilClient::synchronousPull(const FilePath &workingDir, const QString &srcLocation, const QStringList &extraOptions) @@ -746,7 +746,7 @@ bool FossilClient::synchronousPull(const FilePath &workingDir, const QString &sr | VcsBase::VcsCommand::ShowSuccessMessage; QtcProcess proc; vcsSynchronousExec(proc, workingDir, args, flags); - const bool success = (proc.result() == ProcessResult::Finished); + const bool success = (proc.result() == ProcessResult::FinishedWithSuccess); if (success) emit changed(workingDir.toVariant()); return success; @@ -771,7 +771,7 @@ bool FossilClient::synchronousPush(const FilePath &workingDir, const QString &ds | VcsBase::VcsCommand::ShowSuccessMessage; QtcProcess proc; vcsSynchronousExec(proc, workingDir, args, flags); - return (proc.result() == ProcessResult::Finished); + return (proc.result() == ProcessResult::FinishedWithSuccess); } void FossilClient::commit(const FilePath &repositoryRoot, const QStringList &files, @@ -859,7 +859,7 @@ bool FossilClient::managesFile(const FilePath &workingDirectory, const QString & const QStringList args({"finfo", fileName}); QtcProcess proc; vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != ProcessResult::Finished) + if (proc.result() != ProcessResult::FinishedWithSuccess) return false; QString output = sanitizeFossilOutput(proc.stdOut()); return !output.startsWith("no history for file", Qt::CaseInsensitive); From 1088bc93e27306d21dc65fe54789fe01d999322a Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 20 Jun 2022 12:41:42 +0200 Subject: [PATCH 080/133] GitHub: Build against Qt Creator 8 beta1 Change-Id: If0390481eeb66bb62a652214328266ed56c1647a Reviewed-by: Cristian Adam --- .github/workflows/build_cmake.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 23e27514f3d..e524b3c3405 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -4,9 +4,9 @@ on: [push] env: PLUGIN_NAME: Fossil - QT_VERSION: 6.2.1 - QT_CREATOR_VERSION: 6.0.0 - QT_CREATOR_SNAPSHOT: NO + QT_VERSION: 6.3.0 + QT_CREATOR_VERSION: 8.0.0-beta1 + QT_CREATOR_SNAPSHOT: latest CMAKE_VERSION: 3.21.1 NINJA_VERSION: 1.10.2 @@ -18,8 +18,8 @@ jobs: matrix: config: - { - name: "Windows Latest MSVC", artifact: "Windows-x64", - os: windows-latest, + name: "Windows MSVC 2019", artifact: "Windows-x64", + os: windows-2019, cc: "cl", cxx: "cl", environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", } @@ -107,17 +107,17 @@ jobs: set(url_os "windows_x86") set(qt_package_arch_suffix "win64_msvc2019_64") set(qt_dir_prefix "${qt_version}/msvc2019_64") - set(qt_package_suffix "-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64") + set(qt_package_suffix "-Windows-Windows_10_21H2-MSVC2019-Windows-Windows_10_21H2-X86_64") elseif ("${{ runner.os }}" STREQUAL "Linux") set(url_os "linux_x64") set(qt_package_arch_suffix "gcc_64") set(qt_dir_prefix "${qt_version}/gcc_64") - set(qt_package_suffix "-Linux-RHEL_8_2-GCC-Linux-RHEL_8_2-X86_64") + set(qt_package_suffix "-Linux-RHEL_8_4-GCC-Linux-RHEL_8_4-X86_64") elseif ("${{ runner.os }}" STREQUAL "macOS") set(url_os "mac_x64") set(qt_package_arch_suffix "clang_64") set(qt_dir_prefix "${qt_version}/macos") - set(qt_package_suffix "-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64-ARM64") + set(qt_package_suffix "-MacOS-MacOS_12-Clang-MacOS-MacOS_12-X86_64-ARM64") endif() set(qt_base_url "https://download.qt.io/online/qtsdkrepository/${url_os}/desktop/qt6_${qt_version_dotless}") From a8fa3310ee6dcccaae57dad45ec49f5cc84f42a5 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 20 Jun 2022 16:16:57 +0200 Subject: [PATCH 081/133] GitHub: Build against Qt Creator 8 Beta2 Change-Id: I62b6b794aaa500baeb787de8a2ae31733df1e729 Reviewed-by: Cristian Adam --- .github/workflows/build_cmake.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index e524b3c3405..c2b46ae3ab6 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -4,8 +4,8 @@ on: [push] env: PLUGIN_NAME: Fossil - QT_VERSION: 6.3.0 - QT_CREATOR_VERSION: 8.0.0-beta1 + QT_VERSION: 6.3.1 + QT_CREATOR_VERSION: 8.0.0-beta2 QT_CREATOR_SNAPSHOT: latest CMAKE_VERSION: 3.21.1 NINJA_VERSION: 1.10.2 From d44056f9d861b0f3794a1b593c89c92f3b8bbffb Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 13 Jul 2022 01:10:07 +0200 Subject: [PATCH 082/133] Adapt to upstream changes Change-Id: Idbe054570ef3af558d1c9cb2a18a1824502fe265 Reviewed-by: Eike Ziller --- plugins/fossil/fossilplugin.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index cdb20b73430..17a26582ec0 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -56,6 +56,7 @@ #include #include #include +#include #include #include @@ -165,10 +166,10 @@ public: void vcsAnnotate(const FilePath &file, int line) final; void vcsDescribe(const FilePath &source, const QString &id) final; - Core::ShellCommand *createInitialCheckoutCommand(const QString &url, - const Utils::FilePath &baseDirectory, - const QString &localName, - const QStringList &extraArgs) final; + Utils::ShellCommand *createInitialCheckoutCommand(const QString &url, + const Utils::FilePath &baseDirectory, + const QString &localName, + const QStringList &extraArgs) final; void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override; bool submitEditorAboutToClose() override; @@ -995,10 +996,10 @@ void FossilPluginPrivate::vcsAnnotate(const FilePath &filePath, int line) void FossilPluginPrivate::vcsDescribe(const FilePath &source, const QString &id) { m_client.view(source.toString(), id); } -Core::ShellCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QString &sourceUrl, - const FilePath &baseDirectory, - const QString &localName, - const QStringList &extraArgs) +Utils::ShellCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QString &sourceUrl, + const FilePath &baseDirectory, + const QString &localName, + const QStringList &extraArgs) { QMap options; FossilJsExtension::parseArgOptions(extraArgs, options); From 8060ca52041b780ecc5d38f3b8704f6c2417a4df Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 14 Jul 2022 00:05:07 +0200 Subject: [PATCH 083/133] Adapt to upstream changes Change-Id: I0ec67b57432ac03b3cf3f93802686effdfce78c7 Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 32 ++++++++++++++------------------ plugins/fossil/fossilplugin.cpp | 6 +++--- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 5885e0fb773..ab01a8ef12c 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include @@ -39,6 +38,7 @@ #include #include #include +#include #include #include @@ -56,6 +56,12 @@ using namespace Utils; namespace Fossil { namespace Internal { +// Disable UNIX terminals to suppress SSH prompting +const unsigned s_pullFlags = ShellCommand::SshPasswordPrompt + | ShellCommand::ShowStdOut + | ShellCommand::ShowSuccessMessage; + + // Parameter widget controlling whitespace diff mode, associated with a parameter class FossilDiffConfig : public VcsBase::VcsBaseEditorConfig { @@ -739,13 +745,8 @@ bool FossilClient::synchronousPull(const FilePath &workingDir, const QString &sr } args << extraOptions; - // Disable UNIX terminals to suppress SSH prompting - const unsigned flags = - VcsBase::VcsCommand::SshPasswordPrompt - | VcsBase::VcsCommand::ShowStdOut - | VcsBase::VcsCommand::ShowSuccessMessage; QtcProcess proc; - vcsSynchronousExec(proc, workingDir, args, flags); + vcsSynchronousExec(proc, workingDir, args, s_pullFlags); const bool success = (proc.result() == ProcessResult::FinishedWithSuccess); if (success) emit changed(workingDir.toVariant()); @@ -764,13 +765,8 @@ bool FossilClient::synchronousPush(const FilePath &workingDir, const QString &ds } args << extraOptions; - // Disable UNIX terminals to suppress SSH prompting - const unsigned flags = - VcsBase::VcsCommand::SshPasswordPrompt - | VcsBase::VcsCommand::ShowStdOut - | VcsBase::VcsCommand::ShowSuccessMessage; QtcProcess proc; - vcsSynchronousExec(proc, workingDir, args, flags); + vcsSynchronousExec(proc, workingDir, args, s_pullFlags); return (proc.result() == ProcessResult::FinishedWithSuccess); } @@ -817,7 +813,7 @@ VcsBase::VcsBaseEditorWidget *FossilClient::annotate(const FilePath &workingDir, if (VcsBase::VcsBaseEditorConfig *editorConfig = fossilEditor->editorConfig()) effectiveArgs = editorConfig->arguments(); - VcsBase::VcsCommand *cmd = createCommand(workingDir, fossilEditor); + ShellCommand *cmd = createCommand(workingDir, fossilEditor); // here we introduce a "|BLAME|" meta-option to allow both annotate and blame modes int pos = effectiveArgs.indexOf("|BLAME|"); @@ -1109,9 +1105,9 @@ void FossilClient::revertFile(const FilePath &workingDir, args << extraOptions << file; // Indicate file list - VcsBase::VcsCommand *cmd = createCommand(workingDir); + ShellCommand *cmd = createCommand(workingDir); cmd->setCookie(QStringList(workingDir.toString() + "/" + file)); - connect(cmd, &VcsBase::VcsCommand::success, this, &VcsBase::VcsBaseClient::changed, Qt::QueuedConnection); + connect(cmd, &ShellCommand::success, this, &VcsBase::VcsBaseClient::changed, Qt::QueuedConnection); enqueueJob(cmd, args); } @@ -1135,9 +1131,9 @@ void FossilClient::revertAll(const FilePath &workingDir, const QString &revision } // Indicate repository change - VcsBase::VcsCommand *cmd = createCommand(workingDir); + ShellCommand *cmd = createCommand(workingDir); cmd->setCookie(QStringList(workingDir.toString())); - connect(cmd, &VcsBase::VcsCommand::success, this, &VcsBase::VcsBaseClient::changed, Qt::QueuedConnection); + connect(cmd, &ShellCommand::success, this, &VcsBase::VcsBaseClient::changed, Qt::QueuedConnection); enqueueJob(createCommand(workingDir), args); } diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 17a26582ec0..63c51a298e3 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -60,10 +60,10 @@ #include #include -#include +#include #include #include -#include +#include #include #include @@ -1043,7 +1043,7 @@ Utils::ShellCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QSt checkoutPath.createDir(); // Setup the wizard page command job - auto command = new VcsBase::VcsCommand(checkoutPath, m_client.processEnvironment()); + auto command = VcsBaseClient::createVcsCommand(checkoutPath, m_client.processEnvironment()); if (!isLocalRepository && !cloneRepository.exists()) { From 253d9a02f6157b0a971504734a92853ae51e45d8 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 20 Jul 2022 12:17:35 +0200 Subject: [PATCH 084/133] GitHub: Build against Qt Creator 8 release Change-Id: I21a7ae0cc35f54f618f3e27e5edf0d2ed5b49a15 Reviewed-by: Eike Ziller --- .github/workflows/build_cmake.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index c2b46ae3ab6..6d25094e13d 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -5,8 +5,8 @@ on: [push] env: PLUGIN_NAME: Fossil QT_VERSION: 6.3.1 - QT_CREATOR_VERSION: 8.0.0-beta2 - QT_CREATOR_SNAPSHOT: latest + QT_CREATOR_VERSION: 8.0.0 + QT_CREATOR_SNAPSHOT: NO CMAKE_VERSION: 3.21.1 NINJA_VERSION: 1.10.2 From c06a40afcded4f00561316418c2802b93eb49593 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 27 Jul 2022 10:58:45 +0200 Subject: [PATCH 085/133] Adapt to upstream changes Change-Id: If876d7f91172ddd3398c6a37ad8f14b73a3e55ee Reviewed-by: hjk --- plugins/fossil/fossilplugin.cpp | 2 +- plugins/fossil/fossilsettings.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 63c51a298e3..d99ab084e4b 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -767,7 +767,7 @@ void FossilPluginPrivate::createRepository() if (const ProjectExplorer::Project *currentProject = ProjectExplorer::ProjectTree::currentProject()) directory = currentProject->projectDirectory(); // Prompt for a directory that is not under version control yet - QWidget *mw = Core::ICore::mainWindow(); + QWidget *mw = Core::ICore::dialogParent(); do { directory = FileUtils::getExistingDirectory(nullptr, tr("Choose Checkout Directory"), directory); if (directory.isEmpty()) diff --git a/plugins/fossil/fossilsettings.cpp b/plugins/fossil/fossilsettings.cpp index fc5d63b9d94..ef3f62f6e3b 100644 --- a/plugins/fossil/fossilsettings.cpp +++ b/plugins/fossil/fossilsettings.cpp @@ -177,13 +177,15 @@ OptionsPageWidget::OptionsPageWidget(const std::function &onApply, Fossi Group { Title(tr("Miscellaneous")), - Row { + Column { + Row { s.logCount, s.timelineWidth, s.timeout, Stretch() + }, + s.disableAutosync }, - s.disableAutosync }, Stretch() From b5af8e957f153fe5be6c6548b179a13df748b302 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 28 Jul 2022 07:43:36 +0200 Subject: [PATCH 086/133] Adapt to upstream change Change-Id: I1d1f793aa6506652fad20ea8d198c5331e6e402f Reviewed-by: hjk --- plugins/fossil/fossilsettings.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/fossil/fossilsettings.cpp b/plugins/fossil/fossilsettings.cpp index ef3f62f6e3b..420222a2ba1 100644 --- a/plugins/fossil/fossilsettings.cpp +++ b/plugins/fossil/fossilsettings.cpp @@ -155,28 +155,27 @@ OptionsPageWidget::OptionsPageWidget(const std::function &onApply, Fossi FossilSettings &s = *m_settings; using namespace Layouting; - const Break nl; Column { Group { - Title(tr("Configuration")), + title(tr("Configuration")), Row { s.binaryPath } }, Group { - Title(tr("Local Repositories")), + title(tr("Local Repositories")), Row { s.defaultRepoPath } }, Group { - Title(tr("User")), + title(tr("User")), Form { - s.userName, nl, + s.userName, br, s.sslIdentityFile } }, Group { - Title(tr("Miscellaneous")), + title(tr("Miscellaneous")), Column { Row { s.logCount, From 91a82da6b730fb0ae2f7af421a4993a713a1d6a7 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 1 Aug 2022 08:25:30 +0200 Subject: [PATCH 087/133] Adapt to upstream change Change-Id: I013c61805eeed05937fa46eb6e6e330d4b99ebb1 Reviewed-by: Jarek Kobus --- plugins/fossil/fossilclient.cpp | 132 +++++++++++++++----------------- 1 file changed, 60 insertions(+), 72 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index ab01a8ef12c..0d30728a9b0 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -269,13 +269,11 @@ unsigned int FossilClient::synchronousBinaryVersion() const QStringList args("version"); - QtcProcess proc; - vcsFullySynchronousExec(proc, FilePath(), args); - if (proc.result() != ProcessResult::FinishedWithSuccess) + const CommandResult result = vcsFullySynchronousExec(FilePath(), args); + if (result.result() != ProcessResult::FinishedWithSuccess) return 0; - QString output = proc.stdOut(); - output = output.trimmed(); + const QString output = result.cleanedStdOut().trimmed(); // fossil version: // "This is fossil version 1.27 [ccdefa355b] 2013-09-30 11:47:18 UTC" @@ -308,24 +306,22 @@ BranchInfo FossilClient::synchronousCurrentBranch(const FilePath &workingDirecto return BranchInfo(); // First try to get the current branch from the list of open branches - QtcProcess proc; - vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list"}); - if (proc.result() != ProcessResult::FinishedWithSuccess) + const CommandResult result = vcsFullySynchronousExec(workingDirectory, {"branch", "list"}); + if (result.result() != ProcessResult::FinishedWithSuccess) return BranchInfo(); - const QString output = sanitizeFossilOutput(proc.stdOut()); + const QString output = sanitizeFossilOutput(result.cleanedStdOut()); BranchInfo currentBranch = Utils::findOrDefault(branchListFromOutput(output), [](const BranchInfo &b) { return b.isCurrent(); }); if (!currentBranch.isCurrent()) { // If not available from open branches, request it from the list of closed branches. - QtcProcess proc; - vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list", "--closed"}); - if (proc.result() != ProcessResult::FinishedWithSuccess) + const CommandResult result = vcsFullySynchronousExec(workingDirectory, {"branch", "list", "--closed"}); + if (result.result() != ProcessResult::FinishedWithSuccess) return BranchInfo(); - const QString output = sanitizeFossilOutput(proc.stdOut()); + const QString output = sanitizeFossilOutput(result.cleanedStdOut()); currentBranch = Utils::findOrDefault(branchListFromOutput(output, BranchInfo::Closed), [](const BranchInfo &b) { return b.isCurrent(); }); @@ -343,20 +339,19 @@ QList FossilClient::synchronousBranchQuery(const FilePath &workingDi return QList(); // First get list of open branches - QtcProcess proc; - vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list"}); - if (proc.result() != ProcessResult::FinishedWithSuccess) + CommandResult result = vcsFullySynchronousExec(workingDirectory, {"branch", "list"}); + if (result.result() != ProcessResult::FinishedWithSuccess) return QList(); - QString output = sanitizeFossilOutput(proc.stdOut()); + QString output = sanitizeFossilOutput(result.cleanedStdOut()); QList branches = branchListFromOutput(output); // Append a list of closed branches. - vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list", "--closed"}); - if (proc.result() != ProcessResult::FinishedWithSuccess) + result = vcsFullySynchronousExec(workingDirectory, {"branch", "list", "--closed"}); + if (result.result() != ProcessResult::FinishedWithSuccess) return QList(); - output = sanitizeFossilOutput(proc.stdOut()); + output = sanitizeFossilOutput(result.cleanedStdOut()); branches.append(branchListFromOutput(output, BranchInfo::Closed)); std::sort(branches.begin(), branches.end(), @@ -392,12 +387,12 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const FilePath &workingDirec if (!id.isEmpty()) args << id; - QtcProcess proc; - vcsFullySynchronousExec(proc, workingDirectory, args, ShellCommand::SuppressCommandLogging); - if (proc.result() != ProcessResult::FinishedWithSuccess) + const CommandResult result = vcsFullySynchronousExec(workingDirectory, args, + ShellCommand::SuppressCommandLogging); + if (result.result() != ProcessResult::FinishedWithSuccess) return RevisionInfo(); - const QString output = sanitizeFossilOutput(proc.stdOut()); + const QString output = sanitizeFossilOutput(result.cleanedStdOut()); QString revisionId; QString parentId; @@ -456,12 +451,11 @@ QStringList FossilClient::synchronousTagQuery(const FilePath &workingDirectory, if (!id.isEmpty()) args << id; - QtcProcess proc; - vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != ProcessResult::FinishedWithSuccess) + const CommandResult result = vcsFullySynchronousExec(workingDirectory, args); + if (result.result() != ProcessResult::FinishedWithSuccess) return QStringList(); - const QString output = sanitizeFossilOutput(proc.stdOut()); + const QString output = sanitizeFossilOutput(result.cleanedStdOut()); return output.split('\n', Qt::SkipEmptyParts); } @@ -479,12 +473,11 @@ RepositorySettings FossilClient::synchronousSettingsQuery(const FilePath &workin const QStringList args("settings"); - QtcProcess proc; - vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != ProcessResult::FinishedWithSuccess) + const CommandResult result = vcsFullySynchronousExec(workingDirectory, args); + if (result.result() != ProcessResult::FinishedWithSuccess) return RepositorySettings(); - const QString output = sanitizeFossilOutput(proc.stdOut()); + const QString output = sanitizeFossilOutput(result.cleanedStdOut()); for (const QString &line : output.split('\n', Qt::SkipEmptyParts)) { // parse settings line: @@ -534,9 +527,8 @@ bool FossilClient::synchronousSetSetting(const FilePath &workingDirectory, if (isGlobal) args << "--global"; - QtcProcess proc; - vcsFullySynchronousExec(proc, workingDirectory, args); - return (proc.result() == ProcessResult::FinishedWithSuccess); + return vcsFullySynchronousExec(workingDirectory, args).result() + == ProcessResult::FinishedWithSuccess; } @@ -591,12 +583,11 @@ QString FossilClient::synchronousUserDefaultQuery(const FilePath &workingDirecto const QStringList args({"user", "default"}); - QtcProcess proc; - vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != ProcessResult::FinishedWithSuccess) + const CommandResult result = vcsFullySynchronousExec(workingDirectory, args); + if (result.result() != ProcessResult::FinishedWithSuccess) return QString(); - QString output = sanitizeFossilOutput(proc.stdOut()); + QString output = sanitizeFossilOutput(result.cleanedStdOut()); return output.trimmed(); } @@ -608,9 +599,8 @@ bool FossilClient::synchronousSetUserDefault(const FilePath &workingDirectory, c // set repository-default user const QStringList args({"user", "default", userName, "--user", userName}); - QtcProcess proc; - vcsFullySynchronousExec(proc, workingDirectory, args); - return (proc.result() == ProcessResult::FinishedWithSuccess); + return vcsFullySynchronousExec(workingDirectory, args).result() + == ProcessResult::FinishedWithSuccess; } QString FossilClient::synchronousGetRepositoryURL(const FilePath &workingDirectory) @@ -620,13 +610,11 @@ QString FossilClient::synchronousGetRepositoryURL(const FilePath &workingDirecto const QStringList args("remote-url"); - QtcProcess proc; - vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != ProcessResult::FinishedWithSuccess) + const CommandResult result = vcsFullySynchronousExec(workingDirectory, args); + if (result.result() != ProcessResult::FinishedWithSuccess) return QString(); - QString output = sanitizeFossilOutput(proc.stdOut()); - output = output.trimmed(); + const QString output = sanitizeFossilOutput(result.cleanedStdOut()).trimmed(); // Fossil returns "off" when no remote-url is set. if (output.isEmpty() || output.toLower() == "off") @@ -674,12 +662,11 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory, if (!adminUser.isEmpty()) args << "--admin-user" << adminUser; args << extraOptions << repoFilePath.toUserOutput(); - QtcProcess proc; - vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != ProcessResult::FinishedWithSuccess) + CommandResult result = vcsFullySynchronousExec(workingDirectory, args); + if (result.result() != ProcessResult::FinishedWithSuccess) return false; - QString output = sanitizeFossilOutput(proc.stdOut()); + QString output = sanitizeFossilOutput(result.cleanedStdOut()); outputWindow->append(output); // check out the created repository file into the working directory @@ -688,11 +675,11 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory, output.clear(); args << "open" << repoFilePath.toUserOutput(); - vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != ProcessResult::FinishedWithSuccess) + result = vcsFullySynchronousExec(workingDirectory, args); + if (result.result() != ProcessResult::FinishedWithSuccess) return false; - output = sanitizeFossilOutput(proc.stdOut()); + output = sanitizeFossilOutput(result.cleanedStdOut()); outputWindow->append(output); // set user default to admin if specified @@ -702,11 +689,11 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory, output.clear(); args << "user" << "default" << adminUser << "--user" << adminUser; - vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != ProcessResult::FinishedWithSuccess) + result = vcsFullySynchronousExec(workingDirectory, args); + if (result.result() != ProcessResult::FinishedWithSuccess) return false; - QString output = sanitizeFossilOutput(proc.stdOut()); + QString output = sanitizeFossilOutput(result.cleanedStdOut()); outputWindow->append(output); } @@ -728,9 +715,7 @@ bool FossilClient::synchronousMove(const FilePath &workingDir, QStringList args(vcsCommandString(MoveCommand)); args << extraOptions << from << to; - QtcProcess proc; - vcsFullySynchronousExec(proc, workingDir, args); - return (proc.result() == ProcessResult::FinishedWithSuccess); + return vcsFullySynchronousExec(workingDir, args).result() == ProcessResult::FinishedWithSuccess; } bool FossilClient::synchronousPull(const FilePath &workingDir, const QString &srcLocation, const QStringList &extraOptions) @@ -745,9 +730,8 @@ bool FossilClient::synchronousPull(const FilePath &workingDir, const QString &sr } args << extraOptions; - QtcProcess proc; - vcsSynchronousExec(proc, workingDir, args, s_pullFlags); - const bool success = (proc.result() == ProcessResult::FinishedWithSuccess); + const CommandResult result = vcsSynchronousExec(workingDir, args, s_pullFlags); + const bool success = (result.result() == ProcessResult::FinishedWithSuccess); if (success) emit changed(workingDir.toVariant()); return success; @@ -765,9 +749,8 @@ bool FossilClient::synchronousPush(const FilePath &workingDir, const QString &ds } args << extraOptions; - QtcProcess proc; - vcsSynchronousExec(proc, workingDir, args, s_pullFlags); - return (proc.result() == ProcessResult::FinishedWithSuccess); + return vcsSynchronousExec(workingDir, args, s_pullFlags).result() + == ProcessResult::FinishedWithSuccess; } void FossilClient::commit(const FilePath &repositoryRoot, const QStringList &files, @@ -853,11 +836,10 @@ FilePath FossilClient::findTopLevelForFile(const FilePath &file) const bool FossilClient::managesFile(const FilePath &workingDirectory, const QString &fileName) const { const QStringList args({"finfo", fileName}); - QtcProcess proc; - vcsFullySynchronousExec(proc, workingDirectory, args); - if (proc.result() != ProcessResult::FinishedWithSuccess) + const CommandResult result = vcsFullySynchronousExec(workingDirectory, args); + if (result.result() != ProcessResult::FinishedWithSuccess) return false; - QString output = sanitizeFossilOutput(proc.stdOut()); + QString output = sanitizeFossilOutput(result.cleanedStdOut()); return !output.startsWith("no history for file", Qt::CaseInsensitive); } @@ -1107,7 +1089,10 @@ void FossilClient::revertFile(const FilePath &workingDir, // Indicate file list ShellCommand *cmd = createCommand(workingDir); cmd->setCookie(QStringList(workingDir.toString() + "/" + file)); - connect(cmd, &ShellCommand::success, this, &VcsBase::VcsBaseClient::changed, Qt::QueuedConnection); + connect(cmd, &ShellCommand::finished, this, [this](bool success, const QVariant &cookie) { + if (success) + emit changed(cookie); + }); enqueueJob(cmd, args); } @@ -1133,7 +1118,10 @@ void FossilClient::revertAll(const FilePath &workingDir, const QString &revision // Indicate repository change ShellCommand *cmd = createCommand(workingDir); cmd->setCookie(QStringList(workingDir.toString())); - connect(cmd, &ShellCommand::success, this, &VcsBase::VcsBaseClient::changed, Qt::QueuedConnection); + connect(cmd, &ShellCommand::finished, this, [this](bool success, const QVariant &cookie) { + if (success) + emit changed(cookie); + }); enqueueJob(createCommand(workingDir), args); } From 810517d9c9996b26adbdebf02bb963cfdd9c93ea Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 2 Aug 2022 09:08:15 +0200 Subject: [PATCH 088/133] Adapt to upstream changes Change-Id: Iae091f1dedb3ea944c4e65ad6a2d67c2f327a939 Reviewed-by: Jarek Kobus --- plugins/fossil/fossilclient.cpp | 103 ++++++++++++++++---------------- plugins/fossil/fossilplugin.cpp | 18 +++--- 2 files changed, 61 insertions(+), 60 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 0d30728a9b0..a9a6bc5e712 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -38,7 +39,6 @@ #include #include #include -#include #include #include @@ -52,24 +52,25 @@ #include using namespace Utils; +using namespace VcsBase; namespace Fossil { namespace Internal { // Disable UNIX terminals to suppress SSH prompting -const unsigned s_pullFlags = ShellCommand::SshPasswordPrompt - | ShellCommand::ShowStdOut - | ShellCommand::ShowSuccessMessage; +const unsigned s_pullFlags = VcsCommand::SshPasswordPrompt + | VcsCommand::ShowStdOut + | VcsCommand::ShowSuccessMessage; // Parameter widget controlling whitespace diff mode, associated with a parameter -class FossilDiffConfig : public VcsBase::VcsBaseEditorConfig +class FossilDiffConfig : public VcsBaseEditorConfig { Q_OBJECT public: FossilDiffConfig(FossilClient *client, QToolBar *toolBar) : - VcsBase::VcsBaseEditorConfig(toolBar) + VcsBaseEditorConfig(toolBar) { QTC_ASSERT(client, return); @@ -86,13 +87,13 @@ public: }; // Parameter widget controlling annotate/blame mode -class FossilAnnotateConfig : public VcsBase::VcsBaseEditorConfig +class FossilAnnotateConfig : public VcsBaseEditorConfig { Q_OBJECT public: FossilAnnotateConfig(FossilClient *client, QToolBar *toolBar) : - VcsBase::VcsBaseEditorConfig(toolBar) + VcsBaseEditorConfig(toolBar) { QTC_ASSERT(client, return); @@ -113,13 +114,13 @@ public: } }; -class FossilLogCurrentFileConfig : public VcsBase::VcsBaseEditorConfig +class FossilLogCurrentFileConfig : public VcsBaseEditorConfig { Q_OBJECT public: FossilLogCurrentFileConfig(FossilClient *client, QToolBar *toolBar) : - VcsBase::VcsBaseEditorConfig(toolBar) + VcsBaseEditorConfig(toolBar) { QTC_ASSERT(client, return); addReloadButton(); @@ -127,13 +128,13 @@ public: }; -class FossilLogConfig : public VcsBase::VcsBaseEditorConfig +class FossilLogConfig : public VcsBaseEditorConfig { Q_OBJECT public: FossilLogConfig(FossilClient *client, QToolBar *toolBar) : - VcsBase::VcsBaseEditorConfig(toolBar), + VcsBaseEditorConfig(toolBar), m_client(client) { QTC_ASSERT(client, return); @@ -250,7 +251,7 @@ QString FossilClient::makeVersionString(unsigned version) } FossilClient::FossilClient(FossilSettings *settings) - : VcsBase::VcsBaseClient(settings), m_settings(settings) + : VcsBaseClient(settings), m_settings(settings) { setDiffConfigCreator([this](QToolBar *toolBar) { return new FossilDiffConfig(this, toolBar); @@ -388,7 +389,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const FilePath &workingDirec args << id; const CommandResult result = vcsFullySynchronousExec(workingDirectory, args, - ShellCommand::SuppressCommandLogging); + VcsCommand::SuppressCommandLogging); if (result.result() != ProcessResult::FinishedWithSuccess) return RevisionInfo(); @@ -639,7 +640,7 @@ QString FossilClient::synchronousTopic(const FilePath &workingDirectory) bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory, const QStringList &extraOptions) { - VcsBase::VcsOutputWindow *outputWindow = VcsBase::VcsOutputWindow::instance(); + VcsOutputWindow *outputWindow = VcsOutputWindow::instance(); // init repository file of the same name as the working directory // use the configured default repository location for path @@ -760,7 +761,7 @@ void FossilClient::commit(const FilePath &repositoryRoot, const QStringList &fil QStringList(extraOptions) << "-M" << commitMessageFile); } -VcsBase::VcsBaseEditorWidget *FossilClient::annotate(const FilePath &workingDir, const QString &file, const QString &revision, +VcsBaseEditorWidget *FossilClient::annotate(const FilePath &workingDir, const QString &file, const QString &revision, int lineNumber, const QStringList &extraOptions) { // 'fossil annotate' command has a variant 'fossil blame'. @@ -769,34 +770,34 @@ VcsBase::VcsBaseEditorWidget *FossilClient::annotate(const FilePath &workingDir, QString vcsCmdString = vcsCommandString(AnnotateCommand); const Id kind = vcsEditorKind(AnnotateCommand); - const QString id = VcsBase::VcsBaseEditor::getTitleId(workingDir, QStringList(file), revision); + const QString id = VcsBaseEditor::getTitleId(workingDir, QStringList(file), revision); const QString title = vcsEditorTitle(vcsCmdString, id); - const QString source = VcsBase::VcsBaseEditor::getSource(workingDir, file); + const QString source = VcsBaseEditor::getSource(workingDir, file); - VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, - VcsBase::VcsBaseEditor::getCodec(source), + VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, + VcsBaseEditor::getCodec(source), vcsCmdString.toLatin1().constData(), id); auto *fossilEditor = qobject_cast(editor); QTC_ASSERT(fossilEditor, return editor); if (!fossilEditor->editorConfig()) { - if (VcsBase::VcsBaseEditorConfig *editorConfig = createAnnotateEditor(fossilEditor)) { + if (VcsBaseEditorConfig *editorConfig = createAnnotateEditor(fossilEditor)) { editorConfig->setBaseArguments(extraOptions); // editor has been just created, createVcsEditor() didn't set a configuration widget yet - connect(editorConfig, &VcsBase::VcsBaseEditorConfig::commandExecutionRequested, + connect(editorConfig, &VcsBaseEditorConfig::commandExecutionRequested, [=]() { - const int line = VcsBase::VcsBaseEditor::lineNumberOfCurrentEditor(); + const int line = VcsBaseEditor::lineNumberOfCurrentEditor(); return this->annotate(workingDir, file, revision, line, editorConfig->arguments()); } ); fossilEditor->setEditorConfig(editorConfig); } } QStringList effectiveArgs = extraOptions; - if (VcsBase::VcsBaseEditorConfig *editorConfig = fossilEditor->editorConfig()) + if (VcsBaseEditorConfig *editorConfig = fossilEditor->editorConfig()) effectiveArgs = editorConfig->arguments(); - ShellCommand *cmd = createCommand(workingDir, fossilEditor); + VcsCommand *cmd = createCommand(workingDir, fossilEditor); // here we introduce a "|BLAME|" meta-option to allow both annotate and blame modes int pos = effectiveArgs.indexOf("|BLAME|"); @@ -830,7 +831,7 @@ bool FossilClient::isVcsFileOrDirectory(const FilePath &filePath) const FilePath FossilClient::findTopLevelForFile(const FilePath &file) const { - return VcsBase::findRepositoryForFile(file, Constants::FOSSILREPO); + return findRepositoryForFile(file, Constants::FOSSILREPO); } bool FossilClient::managesFile(const FilePath &workingDirectory, const QString &fileName) const @@ -920,8 +921,8 @@ void FossilClient::view(const QString &source, const QString &id, const QStringL const Id kind = vcsEditorKind(DiffCommand); const QString title = vcsEditorTitle(vcsCommandString(DiffCommand), id); - VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, - VcsBase::VcsBaseEditor::getCodec(source), "view", id); + VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, + VcsBaseEditor::getCodec(source), "view", id); editor->setWorkingDirectory(workingDirectory); enqueueJob(createCommand(workingDirectory, editor), args); @@ -989,12 +990,12 @@ void FossilClient::log(const FilePath &workingDir, const QStringList &files, const QString vcsCmdString = vcsCommandString(LogCommand); const Id kind = vcsEditorKind(LogCommand); - const QString id = VcsBase::VcsBaseEditor::getTitleId(workingDir, files); + const QString id = VcsBaseEditor::getTitleId(workingDir, files); const QString title = vcsEditorTitle(vcsCmdString, id); - const QString source = VcsBase::VcsBaseEditor::getSource(workingDir, files); - VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, - VcsBase::VcsBaseEditor::getCodec(source), - vcsCmdString.toLatin1().constData(), id); + const QString source = VcsBaseEditor::getSource(workingDir, files); + VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, + VcsBaseEditor::getCodec(source), + vcsCmdString.toLatin1().constData(), id); auto *fossilEditor = qobject_cast(editor); QTC_ASSERT(fossilEditor, return); @@ -1002,16 +1003,16 @@ void FossilClient::log(const FilePath &workingDir, const QStringList &files, fossilEditor->setFileLogAnnotateEnabled(enableAnnotationContextMenu); if (!fossilEditor->editorConfig()) { - if (VcsBase::VcsBaseEditorConfig *editorConfig = createLogEditor(fossilEditor)) { + if (VcsBaseEditorConfig *editorConfig = createLogEditor(fossilEditor)) { editorConfig->setBaseArguments(extraOptions); // editor has been just created, createVcsEditor() didn't set a configuration widget yet - connect(editorConfig, &VcsBase::VcsBaseEditorConfig::commandExecutionRequested, + connect(editorConfig, &VcsBaseEditorConfig::commandExecutionRequested, [=]() { this->log(workingDir, files, editorConfig->arguments(), enableAnnotationContextMenu); } ); fossilEditor->setEditorConfig(editorConfig); } } QStringList effectiveArgs = extraOptions; - if (VcsBase::VcsBaseEditorConfig *editorConfig = fossilEditor->editorConfig()) + if (VcsBaseEditorConfig *editorConfig = fossilEditor->editorConfig()) effectiveArgs = editorConfig->arguments(); //@TODO: move highlighter and widgets to fossil editor sources. @@ -1041,12 +1042,12 @@ void FossilClient::logCurrentFile(const FilePath &workingDir, const QStringList const QString vcsCmdString = "finfo"; const Id kind = vcsEditorKind(LogCommand); - const QString id = VcsBase::VcsBaseEditor::getTitleId(workingDir, files); + const QString id = VcsBaseEditor::getTitleId(workingDir, files); const QString title = vcsEditorTitle(vcsCmdString, id); - const QString source = VcsBase::VcsBaseEditor::getSource(workingDir, files); - VcsBase::VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, - VcsBase::VcsBaseEditor::getCodec(source), - vcsCmdString.toLatin1().constData(), id); + const QString source = VcsBaseEditor::getSource(workingDir, files); + VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, + VcsBaseEditor::getCodec(source), + vcsCmdString.toLatin1().constData(), id); auto *fossilEditor = qobject_cast(editor); QTC_ASSERT(fossilEditor, return); @@ -1054,16 +1055,16 @@ void FossilClient::logCurrentFile(const FilePath &workingDir, const QStringList fossilEditor->setFileLogAnnotateEnabled(enableAnnotationContextMenu); if (!fossilEditor->editorConfig()) { - if (VcsBase::VcsBaseEditorConfig *editorConfig = createLogCurrentFileEditor(fossilEditor)) { + if (VcsBaseEditorConfig *editorConfig = createLogCurrentFileEditor(fossilEditor)) { editorConfig->setBaseArguments(extraOptions); // editor has been just created, createVcsEditor() didn't set a configuration widget yet - connect(editorConfig, &VcsBase::VcsBaseEditorConfig::commandExecutionRequested, + connect(editorConfig, &VcsBaseEditorConfig::commandExecutionRequested, [=]() { this->logCurrentFile(workingDir, files, editorConfig->arguments(), enableAnnotationContextMenu); } ); fossilEditor->setEditorConfig(editorConfig); } } QStringList effectiveArgs = extraOptions; - if (VcsBase::VcsBaseEditorConfig *editorConfig = fossilEditor->editorConfig()) + if (VcsBaseEditorConfig *editorConfig = fossilEditor->editorConfig()) effectiveArgs = editorConfig->arguments(); //@TODO: move highlighter and widgets to fossil editor sources. @@ -1087,9 +1088,9 @@ void FossilClient::revertFile(const FilePath &workingDir, args << extraOptions << file; // Indicate file list - ShellCommand *cmd = createCommand(workingDir); + VcsCommand *cmd = createCommand(workingDir); cmd->setCookie(QStringList(workingDir.toString() + "/" + file)); - connect(cmd, &ShellCommand::finished, this, [this](bool success, const QVariant &cookie) { + connect(cmd, &VcsCommand::finished, this, [this](bool success, const QVariant &cookie) { if (success) emit changed(cookie); }); @@ -1116,9 +1117,9 @@ void FossilClient::revertAll(const FilePath &workingDir, const QString &revision } // Indicate repository change - ShellCommand *cmd = createCommand(workingDir); + VcsCommand *cmd = createCommand(workingDir); cmd->setCookie(QStringList(workingDir.toString())); - connect(cmd, &ShellCommand::finished, this, [this](bool success, const QVariant &cookie) { + connect(cmd, &VcsCommand::finished, this, [this](bool success, const QVariant &cookie) { if (success) emit changed(cookie); }); @@ -1243,12 +1244,12 @@ FossilClient::StatusItem FossilClient::parseStatusLine(const QString &line) cons return item; } -VcsBase::VcsBaseEditorConfig *FossilClient::createAnnotateEditor(VcsBase::VcsBaseEditorWidget *editor) +VcsBaseEditorConfig *FossilClient::createAnnotateEditor(VcsBaseEditorWidget *editor) { return new FossilAnnotateConfig(this, editor->toolBar()); } -VcsBase::VcsBaseEditorConfig *FossilClient::createLogCurrentFileEditor(VcsBase::VcsBaseEditorWidget *editor) +VcsBaseEditorConfig *FossilClient::createLogCurrentFileEditor(VcsBaseEditorWidget *editor) { SupportedFeatures features = supportedFeatures(); @@ -1258,7 +1259,7 @@ VcsBase::VcsBaseEditorConfig *FossilClient::createLogCurrentFileEditor(VcsBase:: return new FossilLogCurrentFileConfig(this, editor->toolBar()); } -VcsBase::VcsBaseEditorConfig *FossilClient::createLogEditor(VcsBase::VcsBaseEditorWidget *editor) +VcsBaseEditorConfig *FossilClient::createLogEditor(VcsBaseEditorWidget *editor) { return new FossilLogConfig(this, editor->toolBar()); } diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index d99ab084e4b..c4281e40704 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -56,7 +56,6 @@ #include #include #include -#include #include #include @@ -64,6 +63,7 @@ #include #include #include +#include #include #include @@ -166,10 +166,10 @@ public: void vcsAnnotate(const FilePath &file, int line) final; void vcsDescribe(const FilePath &source, const QString &id) final; - Utils::ShellCommand *createInitialCheckoutCommand(const QString &url, - const Utils::FilePath &baseDirectory, - const QString &localName, - const QStringList &extraArgs) final; + VcsCommand *createInitialCheckoutCommand(const QString &url, + const Utils::FilePath &baseDirectory, + const QString &localName, + const QStringList &extraArgs) final; void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override; bool submitEditorAboutToClose() override; @@ -996,10 +996,10 @@ void FossilPluginPrivate::vcsAnnotate(const FilePath &filePath, int line) void FossilPluginPrivate::vcsDescribe(const FilePath &source, const QString &id) { m_client.view(source.toString(), id); } -Utils::ShellCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QString &sourceUrl, - const FilePath &baseDirectory, - const QString &localName, - const QStringList &extraArgs) +VcsCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QString &sourceUrl, + const FilePath &baseDirectory, + const QString &localName, + const QStringList &extraArgs) { QMap options; FossilJsExtension::parseArgOptions(extraArgs, options); From 0bfc4424ff36f1783498b5dd74b481a2337d2a2a Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 2 Aug 2022 12:27:58 +0200 Subject: [PATCH 089/133] Adapt to upstream changes Change-Id: I67b2d68747787574f72b395f7e5b0151b988fdff Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index a9a6bc5e712..06425f7a392 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -815,7 +815,7 @@ VcsBaseEditorWidget *FossilClient::annotate(const FilePath &workingDir, const QS // When version list requested, ignore the source line. if (args.contains("--log")) lineNumber = -1; - cmd->setCookie(lineNumber); + editor->setDefaultLineNumber(lineNumber); enqueueJob(cmd, args); return fossilEditor; @@ -1089,10 +1089,10 @@ void FossilClient::revertFile(const FilePath &workingDir, // Indicate file list VcsCommand *cmd = createCommand(workingDir); - cmd->setCookie(QStringList(workingDir.toString() + "/" + file)); - connect(cmd, &VcsCommand::finished, this, [this](bool success, const QVariant &cookie) { + const QStringList files = QStringList(workingDir.toString() + "/" + file); + connect(cmd, &VcsCommand::finished, this, [this, files](bool success) { if (success) - emit changed(cookie); + emit changed(files); }); enqueueJob(cmd, args); } @@ -1118,10 +1118,10 @@ void FossilClient::revertAll(const FilePath &workingDir, const QString &revision // Indicate repository change VcsCommand *cmd = createCommand(workingDir); - cmd->setCookie(QStringList(workingDir.toString())); - connect(cmd, &VcsCommand::finished, this, [this](bool success, const QVariant &cookie) { + const QStringList files = QStringList(workingDir.toString()); + connect(cmd, &VcsCommand::finished, this, [this, files](bool success) { if (success) - emit changed(cookie); + emit changed(files); }); enqueueJob(createCommand(workingDir), args); } From 56638b69a83e602b9462cc75ce78284d27f2e41b Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 23 Aug 2022 09:34:40 +0200 Subject: [PATCH 090/133] Fix compile Change-Id: I462623e1bee638f7544ec0d7ff91343059cc321e Reviewed-by: hjk --- plugins/fossil/fossilsettings.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/fossil/fossilsettings.cpp b/plugins/fossil/fossilsettings.cpp index 420222a2ba1..27296ad2095 100644 --- a/plugins/fossil/fossilsettings.cpp +++ b/plugins/fossil/fossilsettings.cpp @@ -181,12 +181,12 @@ OptionsPageWidget::OptionsPageWidget(const std::function &onApply, Fossi s.logCount, s.timelineWidth, s.timeout, - Stretch() + st }, s.disableAutosync }, }, - Stretch() + st }.attachTo(this); } From ec32aa0427f4d725cfca04c2d5b951fd4713589c Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 30 Aug 2022 07:36:02 +0200 Subject: [PATCH 091/133] Adapt to upstream change Change-Id: Ieb95b24500c868bf4e5786ac17bcc005463d3ae2 Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 06425f7a392..ca125696765 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -57,10 +57,7 @@ using namespace VcsBase; namespace Fossil { namespace Internal { -// Disable UNIX terminals to suppress SSH prompting -const unsigned s_pullFlags = VcsCommand::SshPasswordPrompt - | VcsCommand::ShowStdOut - | VcsCommand::ShowSuccessMessage; +const unsigned s_pullFlags = VcsCommand::ShowStdOut | VcsCommand::ShowSuccessMessage; // Parameter widget controlling whitespace diff mode, associated with a parameter From 3e322ba3a679ee58287b17e8e624b8913263ee8f Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 2 Sep 2022 15:53:53 +0200 Subject: [PATCH 092/133] Adapt to upstream changes Change-Id: I521016449a1e779647a25b3e6a1d98f7990f6a10 Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index ca125696765..52495c5dab6 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -267,7 +267,7 @@ unsigned int FossilClient::synchronousBinaryVersion() const QStringList args("version"); - const CommandResult result = vcsFullySynchronousExec(FilePath(), args); + const CommandResult result = vcsSynchronousExec(FilePath(), args); if (result.result() != ProcessResult::FinishedWithSuccess) return 0; @@ -304,7 +304,7 @@ BranchInfo FossilClient::synchronousCurrentBranch(const FilePath &workingDirecto return BranchInfo(); // First try to get the current branch from the list of open branches - const CommandResult result = vcsFullySynchronousExec(workingDirectory, {"branch", "list"}); + const CommandResult result = vcsSynchronousExec(workingDirectory, {"branch", "list"}); if (result.result() != ProcessResult::FinishedWithSuccess) return BranchInfo(); @@ -315,7 +315,7 @@ BranchInfo FossilClient::synchronousCurrentBranch(const FilePath &workingDirecto if (!currentBranch.isCurrent()) { // If not available from open branches, request it from the list of closed branches. - const CommandResult result = vcsFullySynchronousExec(workingDirectory, {"branch", "list", "--closed"}); + const CommandResult result = vcsSynchronousExec(workingDirectory, {"branch", "list", "--closed"}); if (result.result() != ProcessResult::FinishedWithSuccess) return BranchInfo(); @@ -337,7 +337,7 @@ QList FossilClient::synchronousBranchQuery(const FilePath &workingDi return QList(); // First get list of open branches - CommandResult result = vcsFullySynchronousExec(workingDirectory, {"branch", "list"}); + CommandResult result = vcsSynchronousExec(workingDirectory, {"branch", "list"}); if (result.result() != ProcessResult::FinishedWithSuccess) return QList(); @@ -345,7 +345,7 @@ QList FossilClient::synchronousBranchQuery(const FilePath &workingDi QList branches = branchListFromOutput(output); // Append a list of closed branches. - result = vcsFullySynchronousExec(workingDirectory, {"branch", "list", "--closed"}); + result = vcsSynchronousExec(workingDirectory, {"branch", "list", "--closed"}); if (result.result() != ProcessResult::FinishedWithSuccess) return QList(); @@ -385,7 +385,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const FilePath &workingDirec if (!id.isEmpty()) args << id; - const CommandResult result = vcsFullySynchronousExec(workingDirectory, args, + const CommandResult result = vcsSynchronousExec(workingDirectory, args, VcsCommand::SuppressCommandLogging); if (result.result() != ProcessResult::FinishedWithSuccess) return RevisionInfo(); @@ -449,7 +449,7 @@ QStringList FossilClient::synchronousTagQuery(const FilePath &workingDirectory, if (!id.isEmpty()) args << id; - const CommandResult result = vcsFullySynchronousExec(workingDirectory, args); + const CommandResult result = vcsSynchronousExec(workingDirectory, args); if (result.result() != ProcessResult::FinishedWithSuccess) return QStringList(); @@ -471,7 +471,7 @@ RepositorySettings FossilClient::synchronousSettingsQuery(const FilePath &workin const QStringList args("settings"); - const CommandResult result = vcsFullySynchronousExec(workingDirectory, args); + const CommandResult result = vcsSynchronousExec(workingDirectory, args); if (result.result() != ProcessResult::FinishedWithSuccess) return RepositorySettings(); @@ -525,7 +525,7 @@ bool FossilClient::synchronousSetSetting(const FilePath &workingDirectory, if (isGlobal) args << "--global"; - return vcsFullySynchronousExec(workingDirectory, args).result() + return vcsSynchronousExec(workingDirectory, args).result() == ProcessResult::FinishedWithSuccess; } @@ -581,7 +581,7 @@ QString FossilClient::synchronousUserDefaultQuery(const FilePath &workingDirecto const QStringList args({"user", "default"}); - const CommandResult result = vcsFullySynchronousExec(workingDirectory, args); + const CommandResult result = vcsSynchronousExec(workingDirectory, args); if (result.result() != ProcessResult::FinishedWithSuccess) return QString(); @@ -597,7 +597,7 @@ bool FossilClient::synchronousSetUserDefault(const FilePath &workingDirectory, c // set repository-default user const QStringList args({"user", "default", userName, "--user", userName}); - return vcsFullySynchronousExec(workingDirectory, args).result() + return vcsSynchronousExec(workingDirectory, args).result() == ProcessResult::FinishedWithSuccess; } @@ -608,7 +608,7 @@ QString FossilClient::synchronousGetRepositoryURL(const FilePath &workingDirecto const QStringList args("remote-url"); - const CommandResult result = vcsFullySynchronousExec(workingDirectory, args); + const CommandResult result = vcsSynchronousExec(workingDirectory, args); if (result.result() != ProcessResult::FinishedWithSuccess) return QString(); @@ -660,7 +660,7 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory, if (!adminUser.isEmpty()) args << "--admin-user" << adminUser; args << extraOptions << repoFilePath.toUserOutput(); - CommandResult result = vcsFullySynchronousExec(workingDirectory, args); + CommandResult result = vcsSynchronousExec(workingDirectory, args); if (result.result() != ProcessResult::FinishedWithSuccess) return false; @@ -673,7 +673,7 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory, output.clear(); args << "open" << repoFilePath.toUserOutput(); - result = vcsFullySynchronousExec(workingDirectory, args); + result = vcsSynchronousExec(workingDirectory, args); if (result.result() != ProcessResult::FinishedWithSuccess) return false; @@ -687,7 +687,7 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory, output.clear(); args << "user" << "default" << adminUser << "--user" << adminUser; - result = vcsFullySynchronousExec(workingDirectory, args); + result = vcsSynchronousExec(workingDirectory, args); if (result.result() != ProcessResult::FinishedWithSuccess) return false; @@ -713,7 +713,7 @@ bool FossilClient::synchronousMove(const FilePath &workingDir, QStringList args(vcsCommandString(MoveCommand)); args << extraOptions << from << to; - return vcsFullySynchronousExec(workingDir, args).result() == ProcessResult::FinishedWithSuccess; + return vcsSynchronousExec(workingDir, args).result() == ProcessResult::FinishedWithSuccess; } bool FossilClient::synchronousPull(const FilePath &workingDir, const QString &srcLocation, const QStringList &extraOptions) @@ -834,7 +834,7 @@ FilePath FossilClient::findTopLevelForFile(const FilePath &file) const bool FossilClient::managesFile(const FilePath &workingDirectory, const QString &fileName) const { const QStringList args({"finfo", fileName}); - const CommandResult result = vcsFullySynchronousExec(workingDirectory, args); + const CommandResult result = vcsSynchronousExec(workingDirectory, args); if (result.result() != ProcessResult::FinishedWithSuccess) return false; QString output = sanitizeFossilOutput(result.cleanedStdOut()); From 294f2831920bbd86f4a7445aeccb17e3add27003 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 20 Sep 2022 18:44:30 +0200 Subject: [PATCH 093/133] Adapt to upstream changes Change-Id: I508d2944eb16c9f72980a55989f57ce71474c0b0 Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 52495c5dab6..02306a37845 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -1087,8 +1087,8 @@ void FossilClient::revertFile(const FilePath &workingDir, // Indicate file list VcsCommand *cmd = createCommand(workingDir); const QStringList files = QStringList(workingDir.toString() + "/" + file); - connect(cmd, &VcsCommand::finished, this, [this, files](bool success) { - if (success) + connect(cmd, &VcsCommand::done, this, [this, files, cmd] { + if (cmd->result() == ProcessResult::FinishedWithSuccess) emit changed(files); }); enqueueJob(cmd, args); @@ -1116,8 +1116,8 @@ void FossilClient::revertAll(const FilePath &workingDir, const QString &revision // Indicate repository change VcsCommand *cmd = createCommand(workingDir); const QStringList files = QStringList(workingDir.toString()); - connect(cmd, &VcsCommand::finished, this, [this, files](bool success) { - if (success) + connect(cmd, &VcsCommand::done, this, [this, files, cmd] { + if (cmd->result() == ProcessResult::FinishedWithSuccess) emit changed(files); }); enqueueJob(createCommand(workingDir), args); From 9cea8ab213c789e6bb832b0e371bd018396219f5 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 21 Sep 2022 08:13:29 +0200 Subject: [PATCH 094/133] Adapt to upstream change Change-Id: I6c5dc04977e802860a1c5f5259893406f50750e1 Reviewed-by: hjk --- plugins/fossil/configuredialog.cpp | 2 +- plugins/fossil/pullorpushdialog.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/fossil/configuredialog.cpp b/plugins/fossil/configuredialog.cpp index d072d2df2cd..a6e72b9dcaf 100644 --- a/plugins/fossil/configuredialog.cpp +++ b/plugins/fossil/configuredialog.cpp @@ -39,7 +39,7 @@ class ConfigureDialogPrivate { public: RepositorySettings settings() { m_settings.user = m_ui.userLineEdit->text().trimmed(); - m_settings.sslIdentityFile = m_ui.sslIdentityFilePathChooser->path(); + m_settings.sslIdentityFile = m_ui.sslIdentityFilePathChooser->filePath().toString(); m_settings.autosync = (m_ui.disableAutosyncCheckBox->isChecked() ? RepositorySettings::AutosyncOff : RepositorySettings::AutosyncOn); diff --git a/plugins/fossil/pullorpushdialog.cpp b/plugins/fossil/pullorpushdialog.cpp index f9fda3cdb65..660407087d3 100644 --- a/plugins/fossil/pullorpushdialog.cpp +++ b/plugins/fossil/pullorpushdialog.cpp @@ -68,7 +68,7 @@ QString PullOrPushDialog::remoteLocation() const if (m_ui->defaultButton->isChecked()) return QString(); if (m_ui->localButton->isChecked()) - return m_ui->localPathChooser->path(); + return m_ui->localPathChooser->filePath().toString(); return m_ui->urlLineEdit->text(); } From 7ffdada4a3a0ce02371135813015aeb838c89c76 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 6 Oct 2022 18:59:29 +0200 Subject: [PATCH 095/133] Adapt to upstream changes Do some cleanup. Change-Id: Ibbd9406d202bd6fa0eaf47ecd81f656578407634 Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 128 ++++++++++++-------------------- 1 file changed, 46 insertions(+), 82 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 02306a37845..2cbc1d602bc 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -57,8 +57,7 @@ using namespace VcsBase; namespace Fossil { namespace Internal { -const unsigned s_pullFlags = VcsCommand::ShowStdOut | VcsCommand::ShowSuccessMessage; - +const RunFlags s_pullFlags = RunFlags::ShowStdOut | RunFlags::ShowSuccessMessage; // Parameter widget controlling whitespace diff mode, associated with a parameter class FossilDiffConfig : public VcsBaseEditorConfig @@ -265,9 +264,7 @@ unsigned int FossilClient::synchronousBinaryVersion() const if (settings().binaryPath.value().isEmpty()) return 0; - QStringList args("version"); - - const CommandResult result = vcsSynchronousExec(FilePath(), args); + const CommandResult result = vcsSynchronousExec({}, QStringList{"version"}); if (result.result() != ProcessResult::FinishedWithSuccess) return 0; @@ -315,7 +312,8 @@ BranchInfo FossilClient::synchronousCurrentBranch(const FilePath &workingDirecto if (!currentBranch.isCurrent()) { // If not available from open branches, request it from the list of closed branches. - const CommandResult result = vcsSynchronousExec(workingDirectory, {"branch", "list", "--closed"}); + const CommandResult result = vcsSynchronousExec(workingDirectory, + {"branch", "list", "--closed"}); if (result.result() != ProcessResult::FinishedWithSuccess) return BranchInfo(); @@ -334,12 +332,12 @@ QList FossilClient::synchronousBranchQuery(const FilePath &workingDi // Sort the list by branch name. if (workingDirectory.isEmpty()) - return QList(); + return {}; // First get list of open branches CommandResult result = vcsSynchronousExec(workingDirectory, {"branch", "list"}); if (result.result() != ProcessResult::FinishedWithSuccess) - return QList(); + return {}; QString output = sanitizeFossilOutput(result.cleanedStdOut()); QList branches = branchListFromOutput(output); @@ -347,7 +345,7 @@ QList FossilClient::synchronousBranchQuery(const FilePath &workingDi // Append a list of closed branches. result = vcsSynchronousExec(workingDirectory, {"branch", "list", "--closed"}); if (result.result() != ProcessResult::FinishedWithSuccess) - return QList(); + return {}; output = sanitizeFossilOutput(result.cleanedStdOut()); branches.append(branchListFromOutput(output, BranchInfo::Closed)); @@ -363,13 +361,13 @@ QStringList FossilClient::parseRevisionCommentLine(const QString &commentLine) const QRegularExpression commentRx("^comment:\\s+(.*)\\s\\(user:\\s(.*)\\)$", QRegularExpression::CaseInsensitiveOption); - QTC_ASSERT(commentRx.isValid(), return QStringList()); + QTC_ASSERT(commentRx.isValid(), return {}); const QRegularExpressionMatch match = commentRx.match(commentLine); if (!match.hasMatch()) - return QStringList(); + return {}; - return QStringList({match.captured(1), match.captured(2)}); + return {match.captured(1), match.captured(2)}; } RevisionInfo FossilClient::synchronousRevisionQuery(const FilePath &workingDirectory, @@ -386,7 +384,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const FilePath &workingDirec args << id; const CommandResult result = vcsSynchronousExec(workingDirectory, args, - VcsCommand::SuppressCommandLogging); + RunFlags::SuppressCommandLogging); if (result.result() != ProcessResult::FinishedWithSuccess) return RevisionInfo(); @@ -442,41 +440,33 @@ QStringList FossilClient::synchronousTagQuery(const FilePath &workingDirectory, // Tag list includes branch names. if (workingDirectory.isEmpty()) - return QStringList(); + return {}; QStringList args({"tag", "list"}); - if (!id.isEmpty()) args << id; - const CommandResult result = vcsSynchronousExec(workingDirectory, args); if (result.result() != ProcessResult::FinishedWithSuccess) - return QStringList(); + return {}; - const QString output = sanitizeFossilOutput(result.cleanedStdOut()); - - return output.split('\n', Qt::SkipEmptyParts); + return sanitizeFossilOutput(result.cleanedStdOut()).split('\n', Qt::SkipEmptyParts); } RepositorySettings FossilClient::synchronousSettingsQuery(const FilePath &workingDirectory) { if (workingDirectory.isEmpty()) - return RepositorySettings(); + return {}; + + const CommandResult result = vcsSynchronousExec(workingDirectory, QStringList{"settings"}); + if (result.result() != ProcessResult::FinishedWithSuccess) + return {}; + const QString output = sanitizeFossilOutput(result.cleanedStdOut()); RepositorySettings repoSettings; - repoSettings.user = synchronousUserDefaultQuery(workingDirectory); if (repoSettings.user.isEmpty()) repoSettings.user = settings().userName.value(); - const QStringList args("settings"); - - const CommandResult result = vcsSynchronousExec(workingDirectory, args); - if (result.result() != ProcessResult::FinishedWithSuccess) - return RepositorySettings(); - - const QString output = sanitizeFossilOutput(result.cleanedStdOut()); - for (const QString &line : output.split('\n', Qt::SkipEmptyParts)) { // parse settings line: // <(local|global)> @@ -507,8 +497,8 @@ RepositorySettings FossilClient::synchronousSettingsQuery(const FilePath &workin return repoSettings; } -bool FossilClient::synchronousSetSetting(const FilePath &workingDirectory, - const QString &property, const QString &value, bool isGlobal) +bool FossilClient::synchronousSetSetting(const FilePath &workingDirectory, const QString &property, + const QString &value, bool isGlobal) { // set a repository property to the given value // if no value is given, unset the property @@ -529,7 +519,6 @@ bool FossilClient::synchronousSetSetting(const FilePath &workingDirectory, == ProcessResult::FinishedWithSuccess; } - bool FossilClient::synchronousConfigureRepository(const FilePath &workingDirectory, const RepositorySettings &newSettings, const RepositorySettings ¤tSettings) { @@ -577,17 +566,13 @@ bool FossilClient::synchronousConfigureRepository(const FilePath &workingDirecto QString FossilClient::synchronousUserDefaultQuery(const FilePath &workingDirectory) { if (workingDirectory.isEmpty()) - return QString(); + return {}; - const QStringList args({"user", "default"}); - - const CommandResult result = vcsSynchronousExec(workingDirectory, args); + const CommandResult result = vcsSynchronousExec(workingDirectory, {"user", "default"}); if (result.result() != ProcessResult::FinishedWithSuccess) - return QString(); + return {}; - QString output = sanitizeFossilOutput(result.cleanedStdOut()); - - return output.trimmed(); + return sanitizeFossilOutput(result.cleanedStdOut()).trimmed(); } bool FossilClient::synchronousSetUserDefault(const FilePath &workingDirectory, const QString &userName) @@ -604,19 +589,16 @@ bool FossilClient::synchronousSetUserDefault(const FilePath &workingDirectory, c QString FossilClient::synchronousGetRepositoryURL(const FilePath &workingDirectory) { if (workingDirectory.isEmpty()) - return QString(); + return {}; - const QStringList args("remote-url"); - - const CommandResult result = vcsSynchronousExec(workingDirectory, args); + const CommandResult result = vcsSynchronousExec(workingDirectory, QStringList{"remote-url"}); if (result.result() != ProcessResult::FinishedWithSuccess) - return QString(); - + return {}; const QString output = sanitizeFossilOutput(result.cleanedStdOut()).trimmed(); // Fossil returns "off" when no remote-url is set. - if (output.isEmpty() || output.toLower() == "off") - return QString(); + if (output.toLower() == "off") + return {}; return output; } @@ -624,13 +606,13 @@ QString FossilClient::synchronousGetRepositoryURL(const FilePath &workingDirecto QString FossilClient::synchronousTopic(const FilePath &workingDirectory) { if (workingDirectory.isEmpty()) - return QString(); + return {}; // return current branch name const BranchInfo branchInfo = synchronousCurrentBranch(workingDirectory); if (branchInfo.name().isEmpty()) - return QString(); + return {}; return branchInfo.name(); } @@ -663,40 +645,24 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory, CommandResult result = vcsSynchronousExec(workingDirectory, args); if (result.result() != ProcessResult::FinishedWithSuccess) return false; - - QString output = sanitizeFossilOutput(result.cleanedStdOut()); - outputWindow->append(output); + outputWindow->append(sanitizeFossilOutput(result.cleanedStdOut())); // check out the created repository file into the working directory - - args.clear(); - output.clear(); - - args << "open" << repoFilePath.toUserOutput(); - result = vcsSynchronousExec(workingDirectory, args); + result = vcsSynchronousExec(workingDirectory, {"open", repoFilePath.toUserOutput()}); if (result.result() != ProcessResult::FinishedWithSuccess) return false; - - output = sanitizeFossilOutput(result.cleanedStdOut()); - outputWindow->append(output); + outputWindow->append(sanitizeFossilOutput(result.cleanedStdOut())); // set user default to admin if specified - if (!adminUser.isEmpty()) { - args.clear(); - output.clear(); - - args << "user" << "default" << adminUser << "--user" << adminUser; - result = vcsSynchronousExec(workingDirectory, args); + result = vcsSynchronousExec(workingDirectory, + {"user", "default", adminUser, "--user", adminUser}); if (result.result() != ProcessResult::FinishedWithSuccess) return false; - - QString output = sanitizeFossilOutput(result.cleanedStdOut()); - outputWindow->append(output); + outputWindow->append(sanitizeFossilOutput(result.cleanedStdOut())); } resetCachedVcsInfo(workingDirectory); - return true; } @@ -833,8 +799,7 @@ FilePath FossilClient::findTopLevelForFile(const FilePath &file) const bool FossilClient::managesFile(const FilePath &workingDirectory, const QString &fileName) const { - const QStringList args({"finfo", fileName}); - const CommandResult result = vcsSynchronousExec(workingDirectory, args); + const CommandResult result = vcsSynchronousExec(workingDirectory, {"finfo", fileName}); if (result.result() != ProcessResult::FinishedWithSuccess) return false; QString output = sanitizeFossilOutput(result.cleanedStdOut()); @@ -1146,10 +1111,9 @@ QString FossilClient::vcsCommandString(VcsCommandTag cmd) const // otherwise return baseclient command switch (cmd) { - case RemoveCommand: return QString("rm"); - case MoveCommand: return QString("mv"); - case LogCommand: return QString("timeline"); - + case RemoveCommand: return "rm"; + case MoveCommand: return "mv"; + case LogCommand: return "timeline"; default: return VcsBaseClient::vcsCommandString(cmd); } } @@ -1164,7 +1128,7 @@ Id FossilClient::vcsEditorKind(VcsCommandTag cmd) const case LogCommand: return Constants::FILELOG_ID; default: - return Id(); + return {}; } } @@ -1192,7 +1156,7 @@ FossilClient::StatusItem FossilClient::parseStatusLine(const QString &line) cons int pos = line.indexOf(' '); if (line.isEmpty() || pos < 1) - return StatusItem(); + return {}; QString label(line.left(pos)); QString flags; @@ -1230,7 +1194,7 @@ FossilClient::StatusItem FossilClient::parseStatusLine(const QString &line) cons if (flags.isEmpty()) - return StatusItem(); + return {}; // adjust the position to the last space before the file name for (int size = line.size(); (pos+1) < size && line[pos+1].isSpace(); ++pos) {} From 28c507eccb789e53a748784e9ec2de100b56e608 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 6 Oct 2022 19:34:47 +0200 Subject: [PATCH 096/133] Simplify data structures Do some cleanup. Change-Id: If40fefbdb646f0eb434539f8306421a40e47a3ee Reviewed-by: Orgad Shaneh --- plugins/fossil/CMakeLists.txt | 4 +- plugins/fossil/annotationhighlighter.cpp | 2 +- plugins/fossil/branchinfo.cpp | 57 ------------------------ plugins/fossil/branchinfo.h | 13 ++---- plugins/fossil/commiteditor.cpp | 8 ++-- plugins/fossil/configuredialog.cpp | 5 +-- plugins/fossil/fossil.qbs | 4 +- plugins/fossil/fossilclient.cpp | 44 +++++++----------- plugins/fossil/fossilclient.h | 57 +++++++++++------------- plugins/fossil/fossilcommitwidget.cpp | 24 +++------- plugins/fossil/fossilcommitwidget.h | 4 +- plugins/fossil/fossileditor.cpp | 24 +++------- plugins/fossil/fossilplugin.cpp | 16 ++++--- plugins/fossil/revisioninfo.cpp | 42 ----------------- plugins/fossil/revisioninfo.h | 7 --- 15 files changed, 82 insertions(+), 229 deletions(-) delete mode 100644 plugins/fossil/branchinfo.cpp delete mode 100644 plugins/fossil/revisioninfo.cpp diff --git a/plugins/fossil/CMakeLists.txt b/plugins/fossil/CMakeLists.txt index ad94bb90ab5..0b58b165262 100644 --- a/plugins/fossil/CMakeLists.txt +++ b/plugins/fossil/CMakeLists.txt @@ -12,7 +12,7 @@ add_qtc_plugin(Fossil DEPENDS Qt5::Widgets QtCreator::ExtensionSystem QtCreator::Utils SOURCES annotationhighlighter.cpp annotationhighlighter.h - branchinfo.cpp branchinfo.h + branchinfo.h commiteditor.cpp commiteditor.h configuredialog.cpp configuredialog.h configuredialog.ui constants.h @@ -25,6 +25,6 @@ add_qtc_plugin(Fossil fossilsettings.cpp fossilsettings.h pullorpushdialog.cpp pullorpushdialog.h pullorpushdialog.ui revertdialog.ui - revisioninfo.cpp revisioninfo.h + revisioninfo.h wizard/fossiljsextension.cpp wizard/fossiljsextension.h ) diff --git a/plugins/fossil/annotationhighlighter.cpp b/plugins/fossil/annotationhighlighter.cpp index a910bb7dd68..92aee0959ed 100644 --- a/plugins/fossil/annotationhighlighter.cpp +++ b/plugins/fossil/annotationhighlighter.cpp @@ -44,7 +44,7 @@ QString FossilAnnotationHighlighter::changeNumber(const QString &block) const QRegularExpressionMatch changesetIdMatch = m_changesetIdPattern.match(block); if (changesetIdMatch.hasMatch()) return changesetIdMatch.captured(1); - return QString(); + return {}; } } // namespace Internal diff --git a/plugins/fossil/branchinfo.cpp b/plugins/fossil/branchinfo.cpp deleted file mode 100644 index 08cdd26e85f..00000000000 --- a/plugins/fossil/branchinfo.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (c) 2018 Artur Shepilko -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "branchinfo.h" - -namespace Fossil { -namespace Internal { - -BranchInfo::BranchInfo(const QString &name, BranchFlags flags) : - m_name(name), - m_flags(flags) -{ } - -const QString &BranchInfo::name() const -{ - return m_name; -} - -bool BranchInfo::isCurrent() const -{ - return m_flags.testFlag(Current); -} - -bool BranchInfo::isClosed() const -{ - return m_flags.testFlag(Closed); -} - -bool BranchInfo::isPrivate() const -{ - return m_flags.testFlag(Private); -} - -} // namespace Internal -} // namespace Fossil diff --git a/plugins/fossil/branchinfo.h b/plugins/fossil/branchinfo.h index 034280b4dd4..336ea9ec46c 100644 --- a/plugins/fossil/branchinfo.h +++ b/plugins/fossil/branchinfo.h @@ -40,17 +40,10 @@ public: }; Q_DECLARE_FLAGS(BranchFlags, BranchFlag) - explicit BranchInfo(const QString &name = QString(), BranchFlags flags = {}); + bool isCurrent() const { return flags.testFlag(Current); } -public: - const QString &name() const; - bool isCurrent() const; - bool isClosed() const; - bool isPrivate() const; - -private: - QString m_name; - BranchFlags m_flags; + QString name; + BranchFlags flags; }; Q_DECLARE_OPERATORS_FOR_FLAGS(BranchInfo::BranchFlags) diff --git a/plugins/fossil/commiteditor.cpp b/plugins/fossil/commiteditor.cpp index 58d62144456..ac12ae128f6 100644 --- a/plugins/fossil/commiteditor.cpp +++ b/plugins/fossil/commiteditor.cpp @@ -59,8 +59,7 @@ void CommitEditor::setFields(const QString &repositoryRoot, const BranchInfo &br m_fileModel = new VcsBase::SubmitFileModel(this); m_fileModel->setRepositoryRoot(repositoryRoot); m_fileModel->setFileStatusQualifier([](const QString &status, const QVariant &) - -> VcsBase::SubmitFileModel::FileStatusHint - { + -> VcsBase::SubmitFileModel::FileStatusHint { if (status == Constants::FSTATUS_ADDED || status == Constants::FSTATUS_ADDED_BY_MERGE || status == Constants::FSTATUS_ADDED_BY_INTEGRATE) { @@ -75,10 +74,11 @@ void CommitEditor::setFields(const QString &repositoryRoot, const BranchInfo &br return VcsBase::SubmitFileModel::FileRenamed; } return VcsBase::SubmitFileModel::FileStatusUnknown; - } ); + }); const QList toAdd = Utils::filtered(repoStatus, - [](const VcsBase::VcsBaseClient::StatusItem &item) { return item.flags != Constants::FSTATUS_UNKNOWN; }); + [](const VcsBase::VcsBaseClient::StatusItem &item) + { return item.flags != Constants::FSTATUS_UNKNOWN; }); for (const VcsBase::VcsBaseClient::StatusItem &item : toAdd) m_fileModel->addFile(item.file, item.flags); diff --git a/plugins/fossil/configuredialog.cpp b/plugins/fossil/configuredialog.cpp index a6e72b9dcaf..d169704d29f 100644 --- a/plugins/fossil/configuredialog.cpp +++ b/plugins/fossil/configuredialog.cpp @@ -40,9 +40,8 @@ public: RepositorySettings settings() { m_settings.user = m_ui.userLineEdit->text().trimmed(); m_settings.sslIdentityFile = m_ui.sslIdentityFilePathChooser->filePath().toString(); - m_settings.autosync = - (m_ui.disableAutosyncCheckBox->isChecked() ? RepositorySettings::AutosyncOff - : RepositorySettings::AutosyncOn); + m_settings.autosync = m_ui.disableAutosyncCheckBox->isChecked() + ? RepositorySettings::AutosyncOff : RepositorySettings::AutosyncOn; return m_settings; } diff --git a/plugins/fossil/fossil.qbs b/plugins/fossil/fossil.qbs index e89b69171e3..0bab349e392 100644 --- a/plugins/fossil/fossil.qbs +++ b/plugins/fossil/fossil.qbs @@ -21,9 +21,9 @@ QtcPlugin { "fossileditor.cpp", "fossileditor.h", "annotationhighlighter.cpp", "annotationhighlighter.h", "pullorpushdialog.cpp", "pullorpushdialog.h", "pullorpushdialog.ui", - "branchinfo.cpp", "branchinfo.h", + "branchinfo.h", "configuredialog.cpp", "configuredialog.h", "configuredialog.ui", - "revisioninfo.cpp", "revisioninfo.h", + "revisioninfo.h", "fossil.qrc", "revertdialog.ui", "fossilcommitpanel.ui", diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 2cbc1d602bc..f1cd0110f4f 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -287,11 +287,13 @@ QList FossilClient::branchListFromOutput(const QString &output, cons // Branch list format: // " branch-name" // "* current-branch" - return Utils::transform(output.split('\n', Qt::SkipEmptyParts), [=](const QString &l) { + return Utils::transform(output.split('\n', Qt::SkipEmptyParts), + [=](const QString &l) -> BranchInfo { const QString &name = l.mid(2); - QTC_ASSERT(!name.isEmpty(), return BranchInfo()); - const BranchInfo::BranchFlags flags = (l.startsWith("* ") ? defaultFlags | BranchInfo::Current : defaultFlags); - return BranchInfo(name, flags); + QTC_ASSERT(!name.isEmpty(), return {}); + const BranchInfo::BranchFlags flags = (l.startsWith("* ") + ? defaultFlags | BranchInfo::Current : defaultFlags); + return {name, flags}; }); } @@ -351,7 +353,7 @@ QList FossilClient::synchronousBranchQuery(const FilePath &workingDi branches.append(branchListFromOutput(output, BranchInfo::Closed)); std::sort(branches.begin(), branches.end(), - [](const BranchInfo &a, const BranchInfo &b) { return a.name() < b.name(); }); + [](const BranchInfo &a, const BranchInfo &b) { return a.name < b.name; }); return branches; } @@ -377,7 +379,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const FilePath &workingDirec // Query details of the given revision/check-out id, // if none specified, provide information about current revision if (workingDirectory.isEmpty()) - return RevisionInfo(); + return {}; QStringList args("info"); if (!id.isEmpty()) @@ -386,7 +388,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const FilePath &workingDirec const CommandResult result = vcsSynchronousExec(workingDirectory, args, RunFlags::SuppressCommandLogging); if (result.result() != ProcessResult::FinishedWithSuccess) - return RevisionInfo(); + return {}; const QString output = sanitizeFossilOutput(result.cleanedStdOut()); @@ -397,7 +399,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const FilePath &workingDirec QString committer; const QRegularExpression idRx("([0-9a-f]{5,40})"); - QTC_ASSERT(idRx.isValid(), return RevisionInfo()); + QTC_ASSERT(idRx.isValid(), return {}); const QString hashToken = QString::fromUtf8(supportedFeatures().testFlag(InfoHashFeature) ? "hash: " : "uuid: "); @@ -406,7 +408,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const FilePath &workingDirec if (l.startsWith("checkout: ", Qt::CaseInsensitive) || l.startsWith(hashToken, Qt::CaseInsensitive)) { const QRegularExpressionMatch idMatch = idRx.match(l); - QTC_ASSERT(idMatch.hasMatch(), return RevisionInfo()); + QTC_ASSERT(idMatch.hasMatch(), return {}); revisionId = idMatch.captured(1); } else if (l.startsWith("parent: ", Qt::CaseInsensitive)){ @@ -425,12 +427,12 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const FilePath &workingDirec } // make sure id at least partially matches the retrieved revisionId - QTC_ASSERT(revisionId.startsWith(id, Qt::CaseInsensitive), return RevisionInfo()); + QTC_ASSERT(revisionId.startsWith(id, Qt::CaseInsensitive), return {}); if (parentId.isEmpty()) parentId = revisionId; // root - return RevisionInfo(revisionId, parentId, mergeParentIds, commentMsg, committer); + return {revisionId, parentId, mergeParentIds, commentMsg, committer}; } QStringList FossilClient::synchronousTagQuery(const FilePath &workingDirectory, const QString &id) @@ -609,12 +611,7 @@ QString FossilClient::synchronousTopic(const FilePath &workingDirectory) return {}; // return current branch name - - const BranchInfo branchInfo = synchronousCurrentBranch(workingDirectory); - if (branchInfo.name().isEmpty()) - return {}; - - return branchInfo.name(); + return synchronousCurrentBranch(workingDirectory).name; } bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory, const QStringList &extraOptions) @@ -868,18 +865,11 @@ FossilClient::SupportedFeatures FossilClient::supportedFeatures() const void FossilClient::view(const QString &source, const QString &id, const QStringList &extraOptions) { - QStringList args("diff"); - const FilePath fPath = FilePath::fromString(source); const FilePath workingDirectory = fPath.isFile() ? fPath.absolutePath() : fPath; - RevisionInfo revisionInfo = synchronousRevisionQuery(workingDirectory,id); - - args << "--from" << revisionInfo.parentId - << "--to" << revisionInfo.id - << "-v" - << extraOptions; - + const RevisionInfo revisionInfo = synchronousRevisionQuery(workingDirectory,id); + const QStringList args{"diff", "--from", revisionInfo.parentId, "--to", revisionInfo.id, "-v"}; const Id kind = vcsEditorKind(DiffCommand); const QString title = vcsEditorTitle(vcsCommandString(DiffCommand), id); @@ -887,7 +877,7 @@ void FossilClient::view(const QString &source, const QString &id, const QStringL VcsBaseEditor::getCodec(source), "view", id); editor->setWorkingDirectory(workingDirectory); - enqueueJob(createCommand(workingDirectory, editor), args); + enqueueJob(createCommand(workingDirectory, editor), args + extraOptions); } class FossilLogHighlighter : QSyntaxHighlighter diff --git a/plugins/fossil/fossilclient.h b/plugins/fossil/fossilclient.h index 6af10c05465..bc5d0bdc4f5 100644 --- a/plugins/fossil/fossilclient.h +++ b/plugins/fossil/fossilclient.h @@ -70,56 +70,51 @@ public: BranchInfo synchronousCurrentBranch(const Utils::FilePath &workingDirectory); QList synchronousBranchQuery(const Utils::FilePath &workingDirectory); RevisionInfo synchronousRevisionQuery(const Utils::FilePath &workingDirectory, - const QString &id = QString(), - bool getCommentMsg = false) const; + const QString &id = {}, bool getCommentMsg = false) const; QStringList synchronousTagQuery(const Utils::FilePath &workingDirectory, const QString &id = {}); RepositorySettings synchronousSettingsQuery(const Utils::FilePath &workingDirectory); bool synchronousSetSetting(const Utils::FilePath &workingDirectory, const QString &property, - const QString &value = QString(), bool isGlobal = false); - bool synchronousConfigureRepository(const Utils::FilePath &workingDirectory, const RepositorySettings &newSettings, - const RepositorySettings ¤tSettings = RepositorySettings()); + const QString &value = {}, bool isGlobal = false); + bool synchronousConfigureRepository(const Utils::FilePath &workingDirectory, + const RepositorySettings &newSettings, + const RepositorySettings ¤tSettings = {}); QString synchronousUserDefaultQuery(const Utils::FilePath &workingDirectory); bool synchronousSetUserDefault(const Utils::FilePath &workingDirectory, const QString &userName); QString synchronousGetRepositoryURL(const Utils::FilePath &workingDirectory); QString synchronousTopic(const Utils::FilePath &workingDirectory); bool synchronousCreateRepository(const Utils::FilePath &workingDirectory, - const QStringList &extraOptions = QStringList()) final; - bool synchronousMove(const Utils::FilePath &workingDir, - const QString &from, const QString &to, - const QStringList &extraOptions = QStringList()) final; - bool synchronousPull(const Utils::FilePath &workingDir, - const QString &srcLocation, - const QStringList &extraOptions = QStringList()) final; - bool synchronousPush(const Utils::FilePath &workingDir, - const QString &dstLocation, - const QStringList &extraOptions = QStringList()) final; + const QStringList &extraOptions = {}) final; + bool synchronousMove(const Utils::FilePath &workingDir, const QString &from, const QString &to, + const QStringList &extraOptions = {}) final; + bool synchronousPull(const Utils::FilePath &workingDir, const QString &srcLocation, + const QStringList &extraOptions = {}) final; + bool synchronousPush(const Utils::FilePath &workingDir, const QString &dstLocation, + const QStringList &extraOptions = {}) final; void commit(const Utils::FilePath &repositoryRoot, const QStringList &files, - const QString &commitMessageFile, const QStringList &extraOptions = QStringList()) final; - VcsBase::VcsBaseEditorWidget *annotate( - const Utils::FilePath &workingDir, const QString &file, const QString &revision = {}, - int lineNumber = -1, const QStringList &extraOptions = QStringList()) final; - void log(const Utils::FilePath &workingDir, const QStringList &files = QStringList(), - const QStringList &extraOptions = QStringList(), - bool enableAnnotationContextMenu = false) final; - void logCurrentFile(const Utils::FilePath &workingDir, const QStringList &files = QStringList(), - const QStringList &extraOptions = QStringList(), + const QString &commitMessageFile, const QStringList &extraOptions = {}) final; + VcsBase::VcsBaseEditorWidget *annotate(const Utils::FilePath &workingDir, const QString &file, + const QString &revision = {}, int lineNumber = -1, + const QStringList &extraOptions = {}) final; + void log(const Utils::FilePath &workingDir, const QStringList &files = {}, + const QStringList &extraOptions = {}, bool enableAnnotationContextMenu = false) final; + void logCurrentFile(const Utils::FilePath &workingDir, const QStringList &files = {}, + const QStringList &extraOptions = {}, bool enableAnnotationContextMenu = false); void revertFile(const Utils::FilePath &workingDir, const QString &file, - const QString &revision = QString(), - const QStringList &extraOptions = QStringList()) final; - void revertAll(const Utils::FilePath &workingDir, const QString &revision = QString(), - const QStringList &extraOptions = QStringList()) final; + const QString &revision = {}, const QStringList &extraOptions = {}) final; + void revertAll(const Utils::FilePath &workingDir, const QString &revision = {}, + const QStringList &extraOptions = {}) final; bool isVcsFileOrDirectory(const Utils::FilePath &filePath) const; Utils::FilePath findTopLevelForFile(const Utils::FilePath &file) const final; bool managesFile(const Utils::FilePath &workingDirectory, const QString &fileName) const; unsigned int binaryVersion() const; QString binaryVersionString() const; SupportedFeatures supportedFeatures() const; - void view(const QString &source, const QString &id, - const QStringList &extraOptions = QStringList()) final; + void view(const QString &source, const QString &id, const QStringList &extraOptions = {}) final; private: - static QList branchListFromOutput(const QString &output, const BranchInfo::BranchFlags defaultFlags = {}); + static QList branchListFromOutput(const QString &output, + const BranchInfo::BranchFlags defaultFlags = {}); static QStringList parseRevisionCommentLine(const QString &commentLine); QString sanitizeFossilOutput(const QString &output) const; diff --git a/plugins/fossil/fossilcommitwidget.cpp b/plugins/fossil/fossilcommitwidget.cpp index d53ac59c102..beef90fb5dd 100644 --- a/plugins/fossil/fossilcommitwidget.cpp +++ b/plugins/fossil/fossilcommitwidget.cpp @@ -33,11 +33,9 @@ #include #include -#include -#include - -#include #include +#include +#include namespace Fossil { namespace Internal { @@ -101,7 +99,7 @@ void FossilCommitWidget::setFields(const QString &repoPath, const BranchInfo &br const QStringList &tags, const QString &userName) { m_commitPanelUi.localRootLineEdit->setText(QDir::toNativeSeparators(repoPath)); - m_commitPanelUi.currentBranchLineEdit->setText(branch.name()); + m_commitPanelUi.currentBranchLineEdit->setText(branch.name); const QString tagsText = tags.join(", "); m_commitPanelUi.currentTagsLineEdit->setText(tagsText); m_commitPanelUi.authorLineEdit->setText(userName); @@ -111,29 +109,21 @@ void FossilCommitWidget::setFields(const QString &repoPath, const BranchInfo &br QString FossilCommitWidget::newBranch() const { - const QString branchName = m_commitPanelUi.branchLineEdit->text().trimmed(); - return branchName; + return m_commitPanelUi.branchLineEdit->text().trimmed(); } QStringList FossilCommitWidget::tags() const { QString tagsText = m_commitPanelUi.tagsLineEdit->text().trimmed(); if (tagsText.isEmpty()) - return QStringList(); + return {}; - tagsText.replace(',', ' '); - const QStringList tags = tagsText.split(' ', Qt::SkipEmptyParts); - return tags; + return tagsText.replace(',', ' ').split(' ', Qt::SkipEmptyParts); } QString FossilCommitWidget::committer() const { - const QString author = m_commitPanelUi.authorLineEdit->text(); - if (author.isEmpty()) - return QString(); - - const QString user = author; - return user; + return m_commitPanelUi.authorLineEdit->text(); } bool FossilCommitWidget::isPrivateOptionEnabled() const diff --git a/plugins/fossil/fossilcommitwidget.h b/plugins/fossil/fossilcommitwidget.h index 689eb4575a2..aa84e4eee8f 100644 --- a/plugins/fossil/fossilcommitwidget.h +++ b/plugins/fossil/fossilcommitwidget.h @@ -50,8 +50,8 @@ class FossilCommitWidget : public VcsBase::SubmitEditorWidget public: FossilCommitWidget(); - void setFields(const QString &repoPath, - const BranchInfo &newBranch, const QStringList &tags, const QString &userName); + void setFields(const QString &repoPath, const BranchInfo &newBranch, const QStringList &tags, + const QString &userName); QString newBranch() const; QStringList tags() const; diff --git a/plugins/fossil/fossileditor.cpp b/plugins/fossil/fossileditor.cpp index adeacda4fc5..92145b7ac78 100644 --- a/plugins/fossil/fossileditor.cpp +++ b/plugins/fossil/fossileditor.cpp @@ -29,17 +29,10 @@ #include "fossilplugin.h" #include "fossilclient.h" -#include #include -#include -#include #include -#include #include -#include -#include -#include namespace Fossil { namespace Internal { @@ -78,11 +71,11 @@ QString FossilEditorWidget::changeUnderCursor(const QTextCursor &cursorIn) const cursor.select(QTextCursor::WordUnderCursor); if (cursor.hasSelection()) { const QString change = cursor.selectedText(); - QRegularExpressionMatch exactChangesetIdMatch = d->m_exactChangesetId.match(change); + const QRegularExpressionMatch exactChangesetIdMatch = d->m_exactChangesetId.match(change); if (exactChangesetIdMatch.hasMatch()) return change; } - return QString(); + return {}; } QString FossilEditorWidget::decorateVersion(const QString &revision) const @@ -92,9 +85,8 @@ QString FossilEditorWidget::decorateVersion(const QString &revision) const const Utils::FilePath workingDirectory = Utils::FilePath::fromString(source()).parentDir(); const FossilClient *client = FossilPlugin::client(); - RevisionInfo revisionInfo = - client->synchronousRevisionQuery(workingDirectory, revision, true); - + const RevisionInfo revisionInfo = client->synchronousRevisionQuery(workingDirectory, revision, + true); // format: 'revision (committer "comment...")' QString output = revision.left(shortChangesetIdSize) + " (" + revisionInfo.committer @@ -110,15 +102,13 @@ QString FossilEditorWidget::decorateVersion(const QString &revision) const QStringList FossilEditorWidget::annotationPreviousVersions(const QString &revision) const { - QStringList revisions; const Utils::FilePath workingDirectory = Utils::FilePath::fromString(source()).parentDir(); const FossilClient *client = FossilPlugin::client(); - RevisionInfo revisionInfo = - client->synchronousRevisionQuery(workingDirectory, revision); + const RevisionInfo revisionInfo = client->synchronousRevisionQuery(workingDirectory, revision); if (revisionInfo.parentId.isEmpty()) - return QStringList(); + return {}; - revisions.append(revisionInfo.parentId); + QStringList revisions{revisionInfo.parentId}; revisions.append(revisionInfo.mergeParentIds); return revisions; } diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index c4281e40704..3bfb0f94423 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -420,7 +420,7 @@ void FossilPluginPrivate::annotateCurrentFile() const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasFile(), return); const int lineNumber = VcsBase::VcsBaseEditor::lineNumberOfCurrentEditor(state.currentFile()); - m_client.annotate(state.currentFileTopLevel(), state.relativeCurrentFile(), QString(), lineNumber); + m_client.annotate(state.currentFileTopLevel(), state.relativeCurrentFile(), {}, lineNumber); } void FossilPluginPrivate::diffCurrentFile() @@ -524,7 +524,7 @@ void FossilPluginPrivate::logRepository() if (features.testFlag(FossilClient::TimelineWidthFeature)) extraOptions << "-W" << QString::number(m_client.settings().timelineWidth.value()); - m_client.log(state.topLevel(), QStringList(), extraOptions); + m_client.log(state.topLevel(), {}, extraOptions); } void FossilPluginPrivate::revertAll() @@ -738,7 +738,7 @@ void FossilPluginPrivate::showCommitWidget(const QListsetFields(m_submitRepository.toString(), currentBranch, tags, currentUser, status); connect(commitEditor, &VcsBase::VcsBaseSubmitEditor::diffSelectedFiles, @@ -979,8 +979,7 @@ bool FossilPluginPrivate::vcsMove(const FilePath &from, const FilePath &to) { const QFileInfo fromInfo = from.toFileInfo(); const QFileInfo toInfo = to.toFileInfo(); - return m_client.synchronousMove(from.absolutePath(), - fromInfo.absoluteFilePath(), + return m_client.synchronousMove(from.absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath()); } @@ -991,10 +990,13 @@ bool FossilPluginPrivate::vcsCreateRepository(const FilePath &directory) void FossilPluginPrivate::vcsAnnotate(const FilePath &filePath, int line) { - m_client.annotate(filePath.absolutePath(), filePath.fileName(), QString(), line); + m_client.annotate(filePath.absolutePath(), filePath.fileName(), {}, line); } -void FossilPluginPrivate::vcsDescribe(const FilePath &source, const QString &id) { m_client.view(source.toString(), id); } +void FossilPluginPrivate::vcsDescribe(const FilePath &source, const QString &id) +{ + m_client.view(source.toString(), id); +} VcsCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QString &sourceUrl, const FilePath &baseDirectory, diff --git a/plugins/fossil/revisioninfo.cpp b/plugins/fossil/revisioninfo.cpp deleted file mode 100644 index aeacfdc7c81..00000000000 --- a/plugins/fossil/revisioninfo.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (c) 2018 Artur Shepilko -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "revisioninfo.h" - -namespace Fossil { -namespace Internal { - -RevisionInfo::RevisionInfo(const QString &revisionId, const QString &parent, - const QStringList &mergeParents, const QString &comment, - const QString &user) : - id(revisionId), - parentId(parent), - mergeParentIds(mergeParents), - commentMsg(comment), - committer(user) -{ } - -} // namespace Internal -} // namespace Fossil diff --git a/plugins/fossil/revisioninfo.h b/plugins/fossil/revisioninfo.h index 11cd4a74962..984c61bdf6e 100644 --- a/plugins/fossil/revisioninfo.h +++ b/plugins/fossil/revisioninfo.h @@ -25,8 +25,6 @@ #pragma once -#include "branchinfo.h" - #include #include @@ -36,16 +34,11 @@ namespace Internal { class RevisionInfo { public: - explicit RevisionInfo(const QString &revisionId = QString(), const QString &parent = QString(), - const QStringList &mergeParents = QStringList(), - const QString &comment = QString(), const QString &user = QString()); - const QString id; const QString parentId; const QStringList mergeParentIds; const QString commentMsg; const QString committer; - }; } // namespace Internal From 70466ed81191e4fb40d30b8d3078ff0247018b0c Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 6 Oct 2022 20:00:31 +0200 Subject: [PATCH 097/133] Replace foreach with ranged for loop Change-Id: I6238651d0b6ea8b932195711d3da7442158d2456 Reviewed-by: Orgad Shaneh --- plugins/fossil/commiteditor.cpp | 2 +- plugins/fossil/fossilclient.cpp | 3 ++- plugins/fossil/fossilplugin.cpp | 5 +++-- plugins/fossil/wizard/fossiljsextension.cpp | 8 ++++---- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/plugins/fossil/commiteditor.cpp b/plugins/fossil/commiteditor.cpp index ac12ae128f6..0a32e68b7ef 100644 --- a/plugins/fossil/commiteditor.cpp +++ b/plugins/fossil/commiteditor.cpp @@ -80,7 +80,7 @@ void CommitEditor::setFields(const QString &repositoryRoot, const BranchInfo &br [](const VcsBase::VcsBaseClient::StatusItem &item) { return item.flags != Constants::FSTATUS_UNKNOWN; }); for (const VcsBase::VcsBaseClient::StatusItem &item : toAdd) - m_fileModel->addFile(item.file, item.flags); + m_fileModel->addFile(item.file, item.flags); setFileModel(m_fileModel); } diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index f1cd0110f4f..5cb7bccf2a2 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -198,7 +198,8 @@ public: QStringList args; // split "-t val" => "-t" "val" - foreach (const QString &arg, VcsBaseEditorConfig::arguments()) { + const QStringList arguments = VcsBaseEditorConfig::arguments(); + for (const QString &arg : arguments) { if (arg.startsWith("-t")) { args << arg.split(' '); diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 3bfb0f94423..2ae9a1ef256 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -853,7 +853,8 @@ bool FossilPluginPrivate::submitEditorAboutToClose() extraOptions << "--branch" << enquotedBranch; } // Tags - foreach (QString tag, commitWidget->tags()) { + const QStringList tags = commitWidget->tags(); + for (const QString &tag : tags) { extraOptions << "--tag" << tag; } @@ -886,7 +887,7 @@ void FossilPluginPrivate::updateActions(VcsBase::VcsBasePluginPrivate::ActionSta m_revertFile->setParameter(filename); m_statusFile->setParameter(filename); - foreach (QAction *repoAction, m_repositoryActionList) + for (QAction *repoAction : qAsConst(m_repositoryActionList)) repoAction->setEnabled(repoEnabled); } diff --git a/plugins/fossil/wizard/fossiljsextension.cpp b/plugins/fossil/wizard/fossiljsextension.cpp index 701c55d9224..2cdf2c27952 100644 --- a/plugins/fossil/wizard/fossiljsextension.cpp +++ b/plugins/fossil/wizard/fossiljsextension.cpp @@ -56,10 +56,10 @@ void FossilJsExtension::parseArgOptions(const QStringList &args, QMap 1 ? opt[1] : QString()); } } From e6bfa33be0ebb253e1e6761d5318032aa7224b79 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 6 Oct 2022 20:04:04 +0200 Subject: [PATCH 098/133] Avoid returning value by reference Change-Id: Id094d6f70a0e3eb8ef9cb6336880f6ff9187d7df Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilplugin.cpp | 3 +-- plugins/fossil/wizard/fossiljsextension.cpp | 6 +++--- plugins/fossil/wizard/fossiljsextension.h | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 2ae9a1ef256..aa1d464e4ab 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -1004,8 +1004,7 @@ VcsCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QString &sou const QString &localName, const QStringList &extraArgs) { - QMap options; - FossilJsExtension::parseArgOptions(extraArgs, options); + const QMap options = FossilJsExtension::parseArgOptions(extraArgs); // Two operating modes: // 1) CloneCheckout: diff --git a/plugins/fossil/wizard/fossiljsextension.cpp b/plugins/fossil/wizard/fossiljsextension.cpp index 2cdf2c27952..dad175dde43 100644 --- a/plugins/fossil/wizard/fossiljsextension.cpp +++ b/plugins/fossil/wizard/fossiljsextension.cpp @@ -52,16 +52,16 @@ public: }; -void FossilJsExtension::parseArgOptions(const QStringList &args, QMap &options) +QMap FossilJsExtension::parseArgOptions(const QStringList &args) { - options.clear(); - + QMap options; for (const QString &arg : args) { if (arg.isEmpty()) continue; const QStringList opt = arg.split('|', Qt::KeepEmptyParts); options.insert(opt[0], opt.size() > 1 ? opt[1] : QString()); } + return options; } FossilJsExtension::FossilJsExtension(FossilSettings *settings) : diff --git a/plugins/fossil/wizard/fossiljsextension.h b/plugins/fossil/wizard/fossiljsextension.h index 9e9ff022034..3d04f235434 100644 --- a/plugins/fossil/wizard/fossiljsextension.h +++ b/plugins/fossil/wizard/fossiljsextension.h @@ -42,7 +42,7 @@ class FossilJsExtension : public QObject Q_OBJECT public: - static void parseArgOptions(const QStringList &args, QMap &options); + static QMap parseArgOptions(const QStringList &args); FossilJsExtension(FossilSettings *settings); ~FossilJsExtension(); From ef573e44073262cd6383e371a257359604369502 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 7 Oct 2022 08:38:02 +0200 Subject: [PATCH 099/133] Do some cleanup Change-Id: Ia63ed85397a4a86f8037797aa899253e9bcf3913 Reviewed-by: Orgad Shaneh --- plugins/fossil/commiteditor.cpp | 3 +- plugins/fossil/configuredialog.cpp | 12 +++--- plugins/fossil/fossilclient.cpp | 61 +++++++++++------------------- plugins/fossil/fossilplugin.cpp | 13 +------ plugins/fossil/fossilplugin.h | 2 - plugins/fossil/fossilsettings.cpp | 6 --- plugins/fossil/fossilsettings.h | 14 +++---- 7 files changed, 37 insertions(+), 74 deletions(-) diff --git a/plugins/fossil/commiteditor.cpp b/plugins/fossil/commiteditor.cpp index 0a32e68b7ef..4ed3370541a 100644 --- a/plugins/fossil/commiteditor.cpp +++ b/plugins/fossil/commiteditor.cpp @@ -58,8 +58,7 @@ void CommitEditor::setFields(const QString &repositoryRoot, const BranchInfo &br m_fileModel = new VcsBase::SubmitFileModel(this); m_fileModel->setRepositoryRoot(repositoryRoot); - m_fileModel->setFileStatusQualifier([](const QString &status, const QVariant &) - -> VcsBase::SubmitFileModel::FileStatusHint { + m_fileModel->setFileStatusQualifier([](const QString &status, const QVariant &) { if (status == Constants::FSTATUS_ADDED || status == Constants::FSTATUS_ADDED_BY_MERGE || status == Constants::FSTATUS_ADDED_BY_INTEGRATE) { diff --git a/plugins/fossil/configuredialog.cpp b/plugins/fossil/configuredialog.cpp index d169704d29f..a19ae5d9a83 100644 --- a/plugins/fossil/configuredialog.cpp +++ b/plugins/fossil/configuredialog.cpp @@ -37,12 +37,12 @@ namespace Internal { class ConfigureDialogPrivate { public: - RepositorySettings settings() { - m_settings.user = m_ui.userLineEdit->text().trimmed(); - m_settings.sslIdentityFile = m_ui.sslIdentityFilePathChooser->filePath().toString(); - m_settings.autosync = m_ui.disableAutosyncCheckBox->isChecked() - ? RepositorySettings::AutosyncOff : RepositorySettings::AutosyncOn; - return m_settings; + RepositorySettings settings() const + { + return {m_ui.userLineEdit->text().trimmed(), + m_ui.sslIdentityFilePathChooser->filePath().toString(), + m_ui.disableAutosyncCheckBox->isChecked() + ? RepositorySettings::AutosyncOff : RepositorySettings::AutosyncOn}; } void updateUi() { diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 5cb7bccf2a2..f6bd4a639df 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -121,7 +121,6 @@ public: QTC_ASSERT(client, return); addReloadButton(); } - }; class FossilLogConfig : public VcsBaseEditorConfig @@ -214,12 +213,10 @@ public: } args << params[i]; } - } else { args << arg; } } - return args; } @@ -280,10 +277,11 @@ unsigned int FossilClient::synchronousBinaryVersion() const const int major = versionMatch.captured(1).toInt(); const int minor = versionMatch.captured(2).toInt(); const int patch = 0; - return makeVersionNumber(major,minor,patch); + return makeVersionNumber(major, minor, patch); } -QList FossilClient::branchListFromOutput(const QString &output, const BranchInfo::BranchFlags defaultFlags) +QList FossilClient::branchListFromOutput(const QString &output, + const BranchInfo::BranchFlags defaultFlags) { // Branch list format: // " branch-name" @@ -301,12 +299,12 @@ QList FossilClient::branchListFromOutput(const QString &output, cons BranchInfo FossilClient::synchronousCurrentBranch(const FilePath &workingDirectory) { if (workingDirectory.isEmpty()) - return BranchInfo(); + return {}; // First try to get the current branch from the list of open branches const CommandResult result = vcsSynchronousExec(workingDirectory, {"branch", "list"}); if (result.result() != ProcessResult::FinishedWithSuccess) - return BranchInfo(); + return {}; const QString output = sanitizeFossilOutput(result.cleanedStdOut()); BranchInfo currentBranch = Utils::findOrDefault(branchListFromOutput(output), [](const BranchInfo &b) { @@ -318,7 +316,7 @@ BranchInfo FossilClient::synchronousCurrentBranch(const FilePath &workingDirecto const CommandResult result = vcsSynchronousExec(workingDirectory, {"branch", "list", "--closed"}); if (result.result() != ProcessResult::FinishedWithSuccess) - return BranchInfo(); + return {}; const QString output = sanitizeFossilOutput(result.cleanedStdOut()); currentBranch = Utils::findOrDefault(branchListFromOutput(output, BranchInfo::Closed), [](const BranchInfo &b) { @@ -532,20 +530,17 @@ bool FossilClient::synchronousConfigureRepository(const FilePath &workingDirecto const bool applyAll = (currentSettings == RepositorySettings()); if (!newSettings.user.isEmpty() - && (applyAll - || newSettings.user != currentSettings.user) - && !synchronousSetUserDefault(workingDirectory, newSettings.user)){ + && (applyAll || newSettings.user != currentSettings.user) + && !synchronousSetUserDefault(workingDirectory, newSettings.user)) { return false; } - if ((applyAll - || newSettings.sslIdentityFile != currentSettings.sslIdentityFile) - && !synchronousSetSetting(workingDirectory, "ssl-identity", newSettings.sslIdentityFile)){ + if ((applyAll || newSettings.sslIdentityFile != currentSettings.sslIdentityFile) + && !synchronousSetSetting(workingDirectory, "ssl-identity", newSettings.sslIdentityFile)) { return false; } - if (applyAll - || newSettings.autosync != currentSettings.autosync) { + if (applyAll || newSettings.autosync != currentSettings.autosync) { QString value; switch (newSettings.autosync) { case RepositorySettings::AutosyncOff: @@ -758,8 +753,6 @@ VcsBaseEditorWidget *FossilClient::annotate(const FilePath &workingDir, const QS if (VcsBaseEditorConfig *editorConfig = fossilEditor->editorConfig()) effectiveArgs = editorConfig->arguments(); - VcsCommand *cmd = createCommand(workingDir, fossilEditor); - // here we introduce a "|BLAME|" meta-option to allow both annotate and blame modes int pos = effectiveArgs.indexOf("|BLAME|"); if (pos != -1) { @@ -767,10 +760,8 @@ VcsBaseEditorWidget *FossilClient::annotate(const FilePath &workingDir, const QS effectiveArgs.removeAt(pos); } QStringList args(vcsCmdString); - if (!revision.isEmpty() - && supportedFeatures().testFlag(AnnotateRevisionFeature)) + if (!revision.isEmpty() && supportedFeatures().testFlag(AnnotateRevisionFeature)) args << "-r" << revision; - args << effectiveArgs << file; // When version list requested, ignore the source line. @@ -778,7 +769,7 @@ VcsBaseEditorWidget *FossilClient::annotate(const FilePath &workingDir, const QS lineNumber = -1; editor->setDefaultLineNumber(lineNumber); - enqueueJob(cmd, args); + enqueueJob(createCommand(workingDir, fossilEditor), args); return fossilEditor; } @@ -816,8 +807,7 @@ unsigned int FossilClient::binaryVersion() const // Invalidate cache on failed version result. // Assume that fossil client options have been changed and will change again. - if (!cachedBinaryVersion - || currentBinaryPath != cachedBinaryPath) { + if (!cachedBinaryVersion || currentBinaryPath != cachedBinaryPath) { cachedBinaryVersion = synchronousBinaryVersion(); if (cachedBinaryVersion) cachedBinaryPath = currentBinaryPath; @@ -869,7 +859,7 @@ void FossilClient::view(const QString &source, const QString &id, const QStringL const FilePath fPath = FilePath::fromString(source); const FilePath workingDirectory = fPath.isFile() ? fPath.absolutePath() : fPath; - const RevisionInfo revisionInfo = synchronousRevisionQuery(workingDirectory,id); + const RevisionInfo revisionInfo = synchronousRevisionQuery(workingDirectory, id); const QStringList args{"diff", "--from", revisionInfo.parentId, "--to", revisionInfo.id, "-v"}; const Id kind = vcsEditorKind(DiffCommand); const QString title = vcsEditorTitle(vcsCommandString(DiffCommand), id); @@ -1037,12 +1027,11 @@ void FossilClient::revertFile(const FilePath &workingDir, QStringList args(vcsCommandString(RevertCommand)); if (!revision.isEmpty()) args << "-r" << revision; - args << extraOptions << file; // Indicate file list VcsCommand *cmd = createCommand(workingDir); - const QStringList files = QStringList(workingDir.toString() + "/" + file); + const QStringList files = {workingDir.toString() + "/" + file}; connect(cmd, &VcsCommand::done, this, [this, files, cmd] { if (cmd->result() == ProcessResult::FinishedWithSuccess) emit changed(files); @@ -1059,15 +1048,10 @@ void FossilClient::revertAll(const FilePath &workingDir, const QString &revision // Thus undo for whole tree revert should not be possible. QStringList args; - if (revision.isEmpty()) { - args << vcsCommandString(RevertCommand) - << extraOptions; - - } else { - args << "checkout" << revision - << "--force" - << extraOptions; - } + if (revision.isEmpty()) + args << vcsCommandString(RevertCommand) << extraOptions; + else + args << "checkout" << revision << "--force" << extraOptions; // Indicate repository change VcsCommand *cmd = createCommand(workingDir); @@ -1183,16 +1167,15 @@ FossilClient::StatusItem FossilClient::parseStatusLine(const QString &line) cons else if (label == "NOT_A_FILE") flags = Constants::FSTATUS_UNKNOWN; - if (flags.isEmpty()) return {}; // adjust the position to the last space before the file name - for (int size = line.size(); (pos+1) < size && line[pos+1].isSpace(); ++pos) {} + for (int size = line.size(); (pos + 1) < size && line[pos + 1].isSpace(); ++pos) + ; item.flags = flags; item.file = line.mid(pos + 1); - return item; } diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index aa1d464e4ab..643a213f15e 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -298,11 +298,6 @@ FossilClient *FossilPlugin::client() return &dd->m_client; } -void FossilPlugin::showCommitWidget(const QList &status) -{ - dd->showCommitWidget(status); -} - FossilPluginPrivate::FossilPluginPrivate() : VcsBase::VcsBasePluginPrivate(Core::Context(Constants::FOSSIL_CONTEXT)) { @@ -688,12 +683,8 @@ void FossilPluginPrivate::commit() QTC_ASSERT(state.hasTopLevel(), return); m_submitRepository = state.topLevel(); - - connect(&m_client, &VcsBaseClient::parsedStatus, - this, &FossilPluginPrivate::showCommitWidget); - - QStringList extraOptions; - m_client.emitParsedStatus(m_submitRepository, extraOptions); + connect(&m_client, &VcsBaseClient::parsedStatus, this, &FossilPluginPrivate::showCommitWidget); + m_client.emitParsedStatus(m_submitRepository, {}); } void FossilPluginPrivate::showCommitWidget(const QList &status) diff --git a/plugins/fossil/fossilplugin.h b/plugins/fossil/fossilplugin.h index 436f2372b9a..4046a83f888 100644 --- a/plugins/fossil/fossilplugin.h +++ b/plugins/fossil/fossilplugin.h @@ -50,8 +50,6 @@ public: static const FossilSettings &settings(); static FossilClient *client(); - static void showCommitWidget(const QList &status); - #ifdef WITH_TESTS private slots: void testDiffFileResolving_data(); diff --git a/plugins/fossil/fossilsettings.cpp b/plugins/fossil/fossilsettings.cpp index 27296ad2095..72bb99dba68 100644 --- a/plugins/fossil/fossilsettings.cpp +++ b/plugins/fossil/fossilsettings.cpp @@ -26,7 +26,6 @@ #include "fossilsettings.h" #include "constants.h" -#include "fossilclient.h" #include @@ -119,11 +118,6 @@ FossilSettings::FossilSettings() "Choose 0 to see all entries.")); }; -RepositorySettings::RepositorySettings() - : autosync(AutosyncOn) -{ -} - // OptionsPage class OptionsPageWidget final : public Core::IOptionsPageWidget diff --git a/plugins/fossil/fossilsettings.h b/plugins/fossil/fossilsettings.h index e686c8fc389..f06e683c6ea 100644 --- a/plugins/fossil/fossilsettings.h +++ b/plugins/fossil/fossilsettings.h @@ -51,20 +51,18 @@ public: struct RepositorySettings { - enum AutosyncMode {AutosyncOff = 0, AutosyncOn = 1, AutosyncPullOnly}; + enum AutosyncMode {AutosyncOff, AutosyncOn, AutosyncPullOnly}; QString user; - AutosyncMode autosync; QString sslIdentityFile; - - RepositorySettings(); + AutosyncMode autosync = AutosyncOn; }; -inline bool operator== (const RepositorySettings &lh, const RepositorySettings &rh) +inline bool operator==(const RepositorySettings &lh, const RepositorySettings &rh) { - return (lh.user == rh.user - && lh.autosync == rh.autosync - && lh.sslIdentityFile == rh.sslIdentityFile); + return (lh.user == rh.user && + lh.sslIdentityFile == rh.sslIdentityFile && + lh.autosync == rh.autosync); } class OptionsPage : public Core::IOptionsPage From 5cc14a2453597c2edd16bccce6e090e3ca896f4a Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 12 Oct 2022 11:02:39 +0200 Subject: [PATCH 100/133] GitHub: Build against QtC 9 Beta Change-Id: Ied29c225f0106a7d8f6fc122379d146d8efbd6ad Reviewed-by: Eike Ziller --- .github/workflows/build_cmake.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 6d25094e13d..97dba40a4b3 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -4,9 +4,9 @@ on: [push] env: PLUGIN_NAME: Fossil - QT_VERSION: 6.3.1 - QT_CREATOR_VERSION: 8.0.0 - QT_CREATOR_SNAPSHOT: NO + QT_VERSION: 6.4.0 + QT_CREATOR_VERSION: 9.0.0-beta1 + QT_CREATOR_SNAPSHOT: latest CMAKE_VERSION: 3.21.1 NINJA_VERSION: 1.10.2 From cd7a378418378949a6d208978b66fcc96795b290 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 20 Oct 2022 13:30:14 +0200 Subject: [PATCH 101/133] Adapt to upstream changes Change-Id: I1432be3be2b5f5795587fd4263fcb1389966dff0 Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilplugin.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 643a213f15e..da46dc550f9 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -196,7 +196,6 @@ public: void configureRepository(); void commit(); void showCommitWidget(const QList &status); - void commitFromEditor() override; void diffFromEditorSelected(const QStringList &files); void createRepository(); @@ -258,7 +257,6 @@ public: QAction *m_menuAction = nullptr; Utils::FilePath m_submitRepository; - bool m_submitActionTriggered = false; // To be connected to the VcsTask's success signal to emit the repository/ // files changed signals according to the variant's type: @@ -786,14 +784,6 @@ void FossilPluginPrivate::createRepository() } } -void FossilPluginPrivate::commitFromEditor() -{ - // Close the submit editor - m_submitActionTriggered = true; - QTC_ASSERT(submitEditor(), return); - Core::EditorManager::closeDocuments({submitEditor()->document()}); -} - bool FossilPluginPrivate::submitEditorAboutToClose() { CommitEditor *commitEditor = qobject_cast(submitEditor()); @@ -801,10 +791,8 @@ bool FossilPluginPrivate::submitEditorAboutToClose() Core::IDocument *editorDocument = commitEditor->document(); QTC_ASSERT(editorDocument, return true); - bool promptOnSubmit = false; const VcsBase::VcsBaseSubmitEditor::PromptSubmitResult response - = commitEditor->promptSubmit(this, &promptOnSubmit, !m_submitActionTriggered); - m_submitActionTriggered = false; + = commitEditor->promptSubmit(this); switch (response) { case VcsBase::VcsBaseSubmitEditor::SubmitCanceled: From 267bfdb0f98fa5e11a584d86e412578b435409fb Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 28 Oct 2022 14:43:04 +0200 Subject: [PATCH 102/133] Adapt to upstream change Change-Id: I486cae994d432acafb7a882688933e7e85b51a2e Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilplugin.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index da46dc550f9..471912b0b24 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -172,7 +172,7 @@ public: const QStringList &extraArgs) final; void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override; - bool submitEditorAboutToClose() override; + bool activateCommit() override; // File menu action slots void addCurrentFile(); @@ -784,25 +784,13 @@ void FossilPluginPrivate::createRepository() } } -bool FossilPluginPrivate::submitEditorAboutToClose() +bool FossilPluginPrivate::activateCommit() { CommitEditor *commitEditor = qobject_cast(submitEditor()); QTC_ASSERT(commitEditor, return true); Core::IDocument *editorDocument = commitEditor->document(); QTC_ASSERT(editorDocument, return true); - const VcsBase::VcsBaseSubmitEditor::PromptSubmitResult response - = commitEditor->promptSubmit(this); - - switch (response) { - case VcsBase::VcsBaseSubmitEditor::SubmitCanceled: - return false; - case VcsBase::VcsBaseSubmitEditor::SubmitDiscarded: - return true; - default: - break; - } - QStringList files = commitEditor->checkedFiles(); if (!files.empty()) { //save the commit message From 06191a5883a384611b6437f4634bd4c85955332d Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 11 Nov 2022 08:15:45 +0100 Subject: [PATCH 103/133] Adapt to upstream change Change-Id: I78dc0a6a300857cadeb770ad43dc06beca32351b Reviewed-by: Orgad Shaneh --- plugins/fossil/commiteditor.cpp | 2 +- plugins/fossil/commiteditor.h | 2 +- plugins/fossil/fossilcommitwidget.cpp | 5 +++-- plugins/fossil/fossilcommitwidget.h | 5 +++-- plugins/fossil/fossilplugin.cpp | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/fossil/commiteditor.cpp b/plugins/fossil/commiteditor.cpp index 4ed3370541a..9b02ab7a30a 100644 --- a/plugins/fossil/commiteditor.cpp +++ b/plugins/fossil/commiteditor.cpp @@ -47,7 +47,7 @@ FossilCommitWidget *CommitEditor::commitWidget() return static_cast(widget()); } -void CommitEditor::setFields(const QString &repositoryRoot, const BranchInfo &branch, +void CommitEditor::setFields(const Utils::FilePath &repositoryRoot, const BranchInfo &branch, const QStringList &tags, const QString &userName, const QList &repoStatus) { diff --git a/plugins/fossil/commiteditor.h b/plugins/fossil/commiteditor.h index cb8bbfa289e..531628f8cc1 100644 --- a/plugins/fossil/commiteditor.h +++ b/plugins/fossil/commiteditor.h @@ -43,7 +43,7 @@ class CommitEditor : public VcsBase::VcsBaseSubmitEditor public: CommitEditor(); - void setFields(const QString &repositoryRoot, const BranchInfo &branch, + void setFields(const Utils::FilePath &repositoryRoot, const BranchInfo &branch, const QStringList &tags, const QString &userName, const QList &repoStatus); diff --git a/plugins/fossil/fossilcommitwidget.cpp b/plugins/fossil/fossilcommitwidget.cpp index beef90fb5dd..f45fcacde86 100644 --- a/plugins/fossil/fossilcommitwidget.cpp +++ b/plugins/fossil/fossilcommitwidget.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include @@ -95,10 +96,10 @@ FossilCommitWidget::FossilCommitWidget() : m_commitPanel(new QWidget) this, &FossilCommitWidget::branchChanged); } -void FossilCommitWidget::setFields(const QString &repoPath, const BranchInfo &branch, +void FossilCommitWidget::setFields(const Utils::FilePath &repoPath, const BranchInfo &branch, const QStringList &tags, const QString &userName) { - m_commitPanelUi.localRootLineEdit->setText(QDir::toNativeSeparators(repoPath)); + m_commitPanelUi.localRootLineEdit->setText(repoPath.toUserOutput()); m_commitPanelUi.currentBranchLineEdit->setText(branch.name); const QString tagsText = tags.join(", "); m_commitPanelUi.currentTagsLineEdit->setText(tagsText); diff --git a/plugins/fossil/fossilcommitwidget.h b/plugins/fossil/fossilcommitwidget.h index aa84e4eee8f..21180d28357 100644 --- a/plugins/fossil/fossilcommitwidget.h +++ b/plugins/fossil/fossilcommitwidget.h @@ -33,6 +33,7 @@ QT_BEGIN_NAMESPACE class QValidator; QT_END_NAMESPACE +namespace Utils { class FilePath; } namespace Fossil { namespace Internal { @@ -50,8 +51,8 @@ class FossilCommitWidget : public VcsBase::SubmitEditorWidget public: FossilCommitWidget(); - void setFields(const QString &repoPath, const BranchInfo &newBranch, const QStringList &tags, - const QString &userName); + void setFields(const Utils::FilePath &repoPath, const BranchInfo &newBranch, + const QStringList &tags, const QString &userName); QString newBranch() const; QStringList tags() const; diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 471912b0b24..3d13f2de94a 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -728,7 +728,7 @@ void FossilPluginPrivate::showCommitWidget(const QListsetFields(m_submitRepository.toString(), currentBranch, tags, currentUser, status); + commitEditor->setFields(m_submitRepository, currentBranch, tags, currentUser, status); connect(commitEditor, &VcsBase::VcsBaseSubmitEditor::diffSelectedFiles, this, &FossilPluginPrivate::diffFromEditorSelected); From 110332e920439a7ec41ba39b34e8700554d7208b Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 24 Nov 2022 10:08:38 +0100 Subject: [PATCH 104/133] GitHub: Build with Qt Creator 9 and Qt 6.4.1 Change-Id: I622f820e7a1026888ff02442057d7bdee9eb4c87 Reviewed-by: Eike Ziller --- .github/workflows/build_cmake.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 97dba40a4b3..29c0c43c243 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -4,9 +4,9 @@ on: [push] env: PLUGIN_NAME: Fossil - QT_VERSION: 6.4.0 - QT_CREATOR_VERSION: 9.0.0-beta1 - QT_CREATOR_SNAPSHOT: latest + QT_VERSION: 6.4.1 + QT_CREATOR_VERSION: 9.0.0 + QT_CREATOR_SNAPSHOT: NO CMAKE_VERSION: 3.21.1 NINJA_VERSION: 1.10.2 From 12f66d18ff79390bec5635eef397e84f10f37651 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Sun, 11 Dec 2022 15:50:21 +0100 Subject: [PATCH 105/133] Fossil: Adapt to upstream changes Follow up 32e824c76257c21ee4a5d036ecb7bfcbf6664448 Change-Id: I2d8c9f1b9424bfc2db2abbc25ed272c093a6ed63 Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 17 ++++++++--------- plugins/fossil/fossilclient.h | 6 +++--- plugins/fossil/fossilplugin.cpp | 4 ++-- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index f6bd4a639df..04050d8965a 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -717,9 +717,10 @@ void FossilClient::commit(const FilePath &repositoryRoot, const QStringList &fil QStringList(extraOptions) << "-M" << commitMessageFile); } -VcsBaseEditorWidget *FossilClient::annotate(const FilePath &workingDir, const QString &file, const QString &revision, - int lineNumber, const QStringList &extraOptions) +void FossilClient::annotate(const FilePath &workingDir, const QString &file, int lineNumber, + const QString &revision, const QStringList &extraOptions, int firstLine) { + Q_UNUSED(firstLine) // 'fossil annotate' command has a variant 'fossil blame'. // blame command attributes a committing username to source lines, // annotate shows line numbers @@ -735,17 +736,16 @@ VcsBaseEditorWidget *FossilClient::annotate(const FilePath &workingDir, const QS vcsCmdString.toLatin1().constData(), id); auto *fossilEditor = qobject_cast(editor); - QTC_ASSERT(fossilEditor, return editor); + QTC_ASSERT(fossilEditor, return); if (!fossilEditor->editorConfig()) { if (VcsBaseEditorConfig *editorConfig = createAnnotateEditor(fossilEditor)) { editorConfig->setBaseArguments(extraOptions); // editor has been just created, createVcsEditor() didn't set a configuration widget yet - connect(editorConfig, &VcsBaseEditorConfig::commandExecutionRequested, - [=]() { - const int line = VcsBaseEditor::lineNumberOfCurrentEditor(); - return this->annotate(workingDir, file, revision, line, editorConfig->arguments()); - } ); + connect(editorConfig, &VcsBaseEditorConfig::commandExecutionRequested, this, [=] { + const int line = VcsBaseEditor::lineNumberOfCurrentEditor(); + annotate(workingDir, file, line, revision, editorConfig->arguments()); + }); fossilEditor->setEditorConfig(editorConfig); } } @@ -770,7 +770,6 @@ VcsBaseEditorWidget *FossilClient::annotate(const FilePath &workingDir, const QS editor->setDefaultLineNumber(lineNumber); enqueueJob(createCommand(workingDir, fossilEditor), args); - return fossilEditor; } bool FossilClient::isVcsFileOrDirectory(const FilePath &filePath) const diff --git a/plugins/fossil/fossilclient.h b/plugins/fossil/fossilclient.h index bc5d0bdc4f5..70aff0fdbf2 100644 --- a/plugins/fossil/fossilclient.h +++ b/plugins/fossil/fossilclient.h @@ -92,9 +92,9 @@ public: const QStringList &extraOptions = {}) final; void commit(const Utils::FilePath &repositoryRoot, const QStringList &files, const QString &commitMessageFile, const QStringList &extraOptions = {}) final; - VcsBase::VcsBaseEditorWidget *annotate(const Utils::FilePath &workingDir, const QString &file, - const QString &revision = {}, int lineNumber = -1, - const QStringList &extraOptions = {}) final; + void annotate(const Utils::FilePath &workingDir, const QString &file, + int lineNumber = -1, const QString &revision = {}, + const QStringList &extraOptions = {}, int firstLine = -1) final; void log(const Utils::FilePath &workingDir, const QStringList &files = {}, const QStringList &extraOptions = {}, bool enableAnnotationContextMenu = false) final; void logCurrentFile(const Utils::FilePath &workingDir, const QStringList &files = {}, diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 3d13f2de94a..007e02afc96 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -413,7 +413,7 @@ void FossilPluginPrivate::annotateCurrentFile() const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasFile(), return); const int lineNumber = VcsBase::VcsBaseEditor::lineNumberOfCurrentEditor(state.currentFile()); - m_client.annotate(state.currentFileTopLevel(), state.relativeCurrentFile(), {}, lineNumber); + m_client.annotate(state.currentFileTopLevel(), state.relativeCurrentFile(), lineNumber); } void FossilPluginPrivate::diffCurrentFile() @@ -958,7 +958,7 @@ bool FossilPluginPrivate::vcsCreateRepository(const FilePath &directory) void FossilPluginPrivate::vcsAnnotate(const FilePath &filePath, int line) { - m_client.annotate(filePath.absolutePath(), filePath.fileName(), {}, line); + m_client.annotate(filePath.absolutePath(), filePath.fileName(), line); } void FossilPluginPrivate::vcsDescribe(const FilePath &source, const QString &id) From ac32a163eb5e6d4c504bcf72090d814becce9380 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 2 Jan 2023 14:22:21 +0100 Subject: [PATCH 106/133] GitHub: Update deployment target and architectures on macOS We only support macOS 10.14 with Qt Creator 9, and we do support Apple ARM for a while now. Change-Id: I4c3ac07b60cfed0d4f3444836748a995d6edfcc6 Reviewed-by: Cristian Adam --- .github/workflows/build_cmake.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 29c0c43c243..4c7f708161b 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -5,6 +5,7 @@ on: [push] env: PLUGIN_NAME: Fossil QT_VERSION: 6.4.1 + MACOS_DEPLOYMENT_TARGET: 10.14 QT_CREATOR_VERSION: 9.0.0 QT_CREATOR_SNAPSHOT: NO CMAKE_VERSION: 3.21.1 @@ -202,7 +203,7 @@ jobs: run: | set(ENV{CC} ${{ matrix.config.cc }}) set(ENV{CXX} ${{ matrix.config.cxx }}) - set(ENV{MACOSX_DEPLOYMENT_TARGET} "10.13") + set(ENV{MACOSX_DEPLOYMENT_TARGET} "${{ env.MACOS_DEPLOYMENT_TARGET }}") if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") execute_process( @@ -227,6 +228,10 @@ jobs: endif() endforeach() + if("${{ runner.os }}" STREQUAL "macOS") + set(architecture_config "--add-config=-DCMAKE_OSX_ARCHITECTURES=x86_64\;arm64") + endif() + execute_process( COMMAND python -u @@ -237,6 +242,7 @@ jobs: --qt-path "${{ steps.qt.outputs.qt_dir }}" --qtc-path "${{ steps.qt_creator.outputs.qtc_dir }}" --output-path "$ENV{GITHUB_WORKSPACE}" + ${architecture_config} RESULT_VARIABLE result ) if (NOT result EQUAL 0) From ea1cafa675ffa8268b4ae3be9991c25f2a43391a Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 3 Jan 2023 16:31:52 +0100 Subject: [PATCH 107/133] GitHub: Build against 10.0.0-beta1 Change-Id: Ia473e53c32518dd5da1ef7bd7785fb34c52109e4 Reviewed-by: Cristian Adam --- .github/workflows/build_cmake.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 4c7f708161b..8ead7f86e88 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -6,8 +6,8 @@ env: PLUGIN_NAME: Fossil QT_VERSION: 6.4.1 MACOS_DEPLOYMENT_TARGET: 10.14 - QT_CREATOR_VERSION: 9.0.0 - QT_CREATOR_SNAPSHOT: NO + QT_CREATOR_VERSION: 10.0.0-beta1 + QT_CREATOR_SNAPSHOT: latest CMAKE_VERSION: 3.21.1 NINJA_VERSION: 1.10.2 From ef798ae4eb9d1f8ac6bafa2e2d3daf2c8c5293ad Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 5 Jan 2023 11:42:21 +0100 Subject: [PATCH 108/133] GitHub: Use Qt 6.4.2 Change-Id: I79d570bbddd8498b26fff57fca1c90e99c06f540 Reviewed-by: Eike Ziller --- .github/workflows/build_cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 4c7f708161b..38a37dcdc2d 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -4,7 +4,7 @@ on: [push] env: PLUGIN_NAME: Fossil - QT_VERSION: 6.4.1 + QT_VERSION: 6.4.2 MACOS_DEPLOYMENT_TARGET: 10.14 QT_CREATOR_VERSION: 9.0.0 QT_CREATOR_SNAPSHOT: NO From 435fe5e4db2a1fca710727e46f514eb50a5b483b Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 19 Jan 2023 07:44:46 +0100 Subject: [PATCH 109/133] Adapt to upstream change Change-Id: I0f0de2823eb338cbd327846347f3b3c8e2b61c89 Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 14 ++++++++------ plugins/fossil/fossilclient.h | 6 ++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index 04050d8965a..ce354384bef 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -917,7 +917,8 @@ void FossilLogHighlighter::highlightBlock(const QString &text) void FossilClient::log(const FilePath &workingDir, const QStringList &files, const QStringList &extraOptions, - bool enableAnnotationContextMenu) + bool enableAnnotationContextMenu, + const std::function &addAuthOptions) { // Show timeline for both repository and a file or path (--path ) // When used for log repository, the files list is empty @@ -926,7 +927,7 @@ void FossilClient::log(const FilePath &workingDir, const QStringList &files, SupportedFeatures features = supportedFeatures(); if (!files.isEmpty() && !features.testFlag(TimelinePathFeature)) { - logCurrentFile(workingDir, files, extraOptions, enableAnnotationContextMenu); + logCurrentFile(workingDir, files, extraOptions, enableAnnotationContextMenu, addAuthOptions); return; } @@ -949,7 +950,7 @@ void FossilClient::log(const FilePath &workingDir, const QStringList &files, editorConfig->setBaseArguments(extraOptions); // editor has been just created, createVcsEditor() didn't set a configuration widget yet connect(editorConfig, &VcsBaseEditorConfig::commandExecutionRequested, - [=]() { this->log(workingDir, files, editorConfig->arguments(), enableAnnotationContextMenu); } ); + [=]() { this->log(workingDir, files, editorConfig->arguments(), enableAnnotationContextMenu, addAuthOptions); } ); fossilEditor->setEditorConfig(editorConfig); } } @@ -970,7 +971,8 @@ void FossilClient::log(const FilePath &workingDir, const QStringList &files, void FossilClient::logCurrentFile(const FilePath &workingDir, const QStringList &files, const QStringList &extraOptions, - bool enableAnnotationContextMenu) + bool enableAnnotationContextMenu, + const std::function &addAuthOptions) { // Show commit history for the given file/file-revision // NOTE: 'fossil finfo' shows full history from all branches. @@ -978,7 +980,7 @@ void FossilClient::logCurrentFile(const FilePath &workingDir, const QStringList // With newer clients, 'fossil timeline' can handle both repository and file SupportedFeatures features = supportedFeatures(); if (features.testFlag(TimelinePathFeature)) { - log(workingDir, files, extraOptions, enableAnnotationContextMenu); + log(workingDir, files, extraOptions, enableAnnotationContextMenu, addAuthOptions); return; } @@ -1001,7 +1003,7 @@ void FossilClient::logCurrentFile(const FilePath &workingDir, const QStringList editorConfig->setBaseArguments(extraOptions); // editor has been just created, createVcsEditor() didn't set a configuration widget yet connect(editorConfig, &VcsBaseEditorConfig::commandExecutionRequested, - [=]() { this->logCurrentFile(workingDir, files, editorConfig->arguments(), enableAnnotationContextMenu); } ); + [=]() { this->logCurrentFile(workingDir, files, editorConfig->arguments(), enableAnnotationContextMenu, addAuthOptions); } ); fossilEditor->setEditorConfig(editorConfig); } } diff --git a/plugins/fossil/fossilclient.h b/plugins/fossil/fossilclient.h index 70aff0fdbf2..e2ed6a8a351 100644 --- a/plugins/fossil/fossilclient.h +++ b/plugins/fossil/fossilclient.h @@ -96,10 +96,12 @@ public: int lineNumber = -1, const QString &revision = {}, const QStringList &extraOptions = {}, int firstLine = -1) final; void log(const Utils::FilePath &workingDir, const QStringList &files = {}, - const QStringList &extraOptions = {}, bool enableAnnotationContextMenu = false) final; + const QStringList &extraOptions = {}, bool enableAnnotationContextMenu = false, + const std::function &addAuthOptions = {}) final; void logCurrentFile(const Utils::FilePath &workingDir, const QStringList &files = {}, const QStringList &extraOptions = {}, - bool enableAnnotationContextMenu = false); + bool enableAnnotationContextMenu = false, + const std::function &addAuthOptions = {}); void revertFile(const Utils::FilePath &workingDir, const QString &file, const QString &revision = {}, const QStringList &extraOptions = {}) final; void revertAll(const Utils::FilePath &workingDir, const QString &revision = {}, From c8b9e4504e2dae4451e7bc794cef7f8f2efc5463 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 20 Jan 2023 13:07:51 +0100 Subject: [PATCH 110/133] Update to upstream FilePath changes Change-Id: I151fc9cb369bafd943dbfcfa17a301e09cd897df Reviewed-by: Orgad Shaneh --- plugins/fossil/fossilclient.cpp | 11 +++++------ plugins/fossil/fossilclient.h | 2 +- plugins/fossil/fossileditor.cpp | 4 ++-- plugins/fossil/fossilplugin.cpp | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index ce354384bef..492fcd1f6ab 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -729,7 +729,7 @@ void FossilClient::annotate(const FilePath &workingDir, const QString &file, int const Id kind = vcsEditorKind(AnnotateCommand); const QString id = VcsBaseEditor::getTitleId(workingDir, QStringList(file), revision); const QString title = vcsEditorTitle(vcsCmdString, id); - const QString source = VcsBaseEditor::getSource(workingDir, file); + const FilePath source = VcsBaseEditor::getSource(workingDir, file); VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, VcsBaseEditor::getCodec(source), @@ -853,10 +853,9 @@ FossilClient::SupportedFeatures FossilClient::supportedFeatures() const return features; } -void FossilClient::view(const QString &source, const QString &id, const QStringList &extraOptions) +void FossilClient::view(const FilePath &source, const QString &id, const QStringList &extraOptions) { - const FilePath fPath = FilePath::fromString(source); - const FilePath workingDirectory = fPath.isFile() ? fPath.absolutePath() : fPath; + const FilePath workingDirectory = source.isFile() ? source.absolutePath() : source; const RevisionInfo revisionInfo = synchronousRevisionQuery(workingDirectory, id); const QStringList args{"diff", "--from", revisionInfo.parentId, "--to", revisionInfo.id, "-v"}; @@ -935,7 +934,7 @@ void FossilClient::log(const FilePath &workingDir, const QStringList &files, const Id kind = vcsEditorKind(LogCommand); const QString id = VcsBaseEditor::getTitleId(workingDir, files); const QString title = vcsEditorTitle(vcsCmdString, id); - const QString source = VcsBaseEditor::getSource(workingDir, files); + const FilePath source = VcsBaseEditor::getSource(workingDir, files); VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, VcsBaseEditor::getCodec(source), vcsCmdString.toLatin1().constData(), id); @@ -988,7 +987,7 @@ void FossilClient::logCurrentFile(const FilePath &workingDir, const QStringList const Id kind = vcsEditorKind(LogCommand); const QString id = VcsBaseEditor::getTitleId(workingDir, files); const QString title = vcsEditorTitle(vcsCmdString, id); - const QString source = VcsBaseEditor::getSource(workingDir, files); + const FilePath source = VcsBaseEditor::getSource(workingDir, files); VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source, VcsBaseEditor::getCodec(source), vcsCmdString.toLatin1().constData(), id); diff --git a/plugins/fossil/fossilclient.h b/plugins/fossil/fossilclient.h index e2ed6a8a351..37d32468e94 100644 --- a/plugins/fossil/fossilclient.h +++ b/plugins/fossil/fossilclient.h @@ -112,7 +112,7 @@ public: unsigned int binaryVersion() const; QString binaryVersionString() const; SupportedFeatures supportedFeatures() const; - void view(const QString &source, const QString &id, const QStringList &extraOptions = {}) final; + void view(const Utils::FilePath &source, const QString &id, const QStringList &extraOptions = {}) final; private: static QList branchListFromOutput(const QString &output, diff --git a/plugins/fossil/fossileditor.cpp b/plugins/fossil/fossileditor.cpp index 92145b7ac78..a3f95390ac5 100644 --- a/plugins/fossil/fossileditor.cpp +++ b/plugins/fossil/fossileditor.cpp @@ -83,7 +83,7 @@ QString FossilEditorWidget::decorateVersion(const QString &revision) const static const int shortChangesetIdSize(10); static const int maxTextSize(120); - const Utils::FilePath workingDirectory = Utils::FilePath::fromString(source()).parentDir(); + const Utils::FilePath workingDirectory = source().parentDir(); const FossilClient *client = FossilPlugin::client(); const RevisionInfo revisionInfo = client->synchronousRevisionQuery(workingDirectory, revision, true); @@ -102,7 +102,7 @@ QString FossilEditorWidget::decorateVersion(const QString &revision) const QStringList FossilEditorWidget::annotationPreviousVersions(const QString &revision) const { - const Utils::FilePath workingDirectory = Utils::FilePath::fromString(source()).parentDir(); + const Utils::FilePath workingDirectory = source().parentDir(); const FossilClient *client = FossilPlugin::client(); const RevisionInfo revisionInfo = client->synchronousRevisionQuery(workingDirectory, revision); if (revisionInfo.parentId.isEmpty()) diff --git a/plugins/fossil/fossilplugin.cpp b/plugins/fossil/fossilplugin.cpp index 007e02afc96..e6b0a829a50 100644 --- a/plugins/fossil/fossilplugin.cpp +++ b/plugins/fossil/fossilplugin.cpp @@ -963,7 +963,7 @@ void FossilPluginPrivate::vcsAnnotate(const FilePath &filePath, int line) void FossilPluginPrivate::vcsDescribe(const FilePath &source, const QString &id) { - m_client.view(source.toString(), id); + m_client.view(source, id); } VcsCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QString &sourceUrl, From 62e0b4052f34cbc6064e64893b18a266f3dc2f18 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 27 Jan 2023 03:32:13 +0100 Subject: [PATCH 111/133] Remove unneeded includes of utils/runextensions.h BTW, spotted some other unused includes marked with yellow. Change-Id: I364e4b6fae73a2be2cfd3a63c1100be4a91aa49a Reviewed-by: Eike Ziller --- src/plugins/android/androidconfigurations.cpp | 1 - src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp | 1 - src/plugins/beautifier/beautifierplugin.cpp | 1 - src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp | 1 - .../compilationdatabaseproject.cpp | 1 - src/plugins/cppeditor/cppeditordocument.cpp | 1 - src/plugins/perfprofiler/perftimelinemodelmanager.h | 1 - src/plugins/projectexplorer/buildmanager.cpp | 1 - src/plugins/projectexplorer/buildstep.cpp | 2 -- src/plugins/projectexplorer/treescanner.cpp | 3 --- src/plugins/qmldesigner/assetexporterplugin/assetexporter.cpp | 2 -- src/plugins/qmljstools/qmljsmodelmanager.cpp | 3 +-- src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp | 2 -- src/plugins/qtsupport/baseqtversion.cpp | 1 - src/plugins/qtsupport/qtoptionspage.cpp | 1 - .../texteditor/codeassist/documentcontentcompletion.cpp | 1 - 16 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index 611f7bba5c4..5477bf14bfe 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #include diff --git a/src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp b/src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp index f3479428c60..1cff800ed1f 100644 --- a/src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp +++ b/src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp @@ -7,7 +7,6 @@ #include -#include #include #include diff --git a/src/plugins/beautifier/beautifierplugin.cpp b/src/plugins/beautifier/beautifierplugin.cpp index 9e0b3f49e88..76db40daeab 100644 --- a/src/plugins/beautifier/beautifierplugin.cpp +++ b/src/plugins/beautifier/beautifierplugin.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include diff --git a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp index cc7e41ba421..687758bb0ae 100644 --- a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp +++ b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp index d53c50b5fa2..bf61ee848dd 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include diff --git a/src/plugins/cppeditor/cppeditordocument.cpp b/src/plugins/cppeditor/cppeditordocument.cpp index 239c3230d1e..7db63ec7afb 100644 --- a/src/plugins/cppeditor/cppeditordocument.cpp +++ b/src/plugins/cppeditor/cppeditordocument.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include diff --git a/src/plugins/perfprofiler/perftimelinemodelmanager.h b/src/plugins/perfprofiler/perftimelinemodelmanager.h index 384cc66b825..8b7b9c1c8fc 100644 --- a/src/plugins/perfprofiler/perftimelinemodelmanager.h +++ b/src/plugins/perfprofiler/perftimelinemodelmanager.h @@ -8,7 +8,6 @@ #include #include -#include #include #include diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp index 228e575ddda..4a78ccfd0f4 100644 --- a/src/plugins/projectexplorer/buildmanager.cpp +++ b/src/plugins/projectexplorer/buildmanager.cpp @@ -31,7 +31,6 @@ #include #include -#include #include #include diff --git a/src/plugins/projectexplorer/buildstep.cpp b/src/plugins/projectexplorer/buildstep.cpp index 101eb9546e4..f3889a693ea 100644 --- a/src/plugins/projectexplorer/buildstep.cpp +++ b/src/plugins/projectexplorer/buildstep.cpp @@ -9,7 +9,6 @@ #include "deployconfiguration.h" #include "kitinformation.h" #include "project.h" -#include "projectexplorer.h" #include "projectexplorerconstants.h" #include "sanitizerparser.h" #include "target.h" @@ -19,7 +18,6 @@ #include #include #include -#include #include #include diff --git a/src/plugins/projectexplorer/treescanner.cpp b/src/plugins/projectexplorer/treescanner.cpp index 1fcf47a504f..abcc66c3cc3 100644 --- a/src/plugins/projectexplorer/treescanner.cpp +++ b/src/plugins/projectexplorer/treescanner.cpp @@ -3,15 +3,12 @@ #include "treescanner.h" -#include "projectexplorerconstants.h" #include "projectnodeshelper.h" #include "projecttree.h" #include #include -#include - #include #include #include diff --git a/src/plugins/qmldesigner/assetexporterplugin/assetexporter.cpp b/src/plugins/qmldesigner/assetexporterplugin/assetexporter.cpp index 9ac68629eab..d9167049a56 100644 --- a/src/plugins/qmldesigner/assetexporterplugin/assetexporter.cpp +++ b/src/plugins/qmldesigner/assetexporterplugin/assetexporter.cpp @@ -1,7 +1,6 @@ // Copyright (C) 2020 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "assetexporter.h" -#include "assetexportpluginconstants.h" #include "componentexporter.h" #include "exportnotification.h" @@ -14,7 +13,6 @@ #include "coreplugin/editormanager/editormanager.h" #include "utils/qtcassert.h" #include "utils/runextensions.h" -#include "variantproperty.h" #include "projectexplorer/session.h" #include "projectexplorer/project.h" diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 2338b08ba1e..da1d82b73d0 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -38,13 +38,12 @@ #include #include #include -#include +#include #include #include #include #include #include -#include #include using namespace Utils; diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp index 5caeb257bde..9817b84240e 100644 --- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp @@ -1,7 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#include "qmlprofilerconstants.h" #include "qmlprofilerdetailsrewriter.h" #include "qmlprofilermodelmanager.h" #include "qmlprofilernotesmodel.h" @@ -10,7 +9,6 @@ #include #include -#include #include #include diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 1ab85fe137c..6b1d64600f4 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp index 2854648549f..0cf089823ab 100644 --- a/src/plugins/qtsupport/qtoptionspage.cpp +++ b/src/plugins/qtsupport/qtoptionspage.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/src/plugins/texteditor/codeassist/documentcontentcompletion.cpp b/src/plugins/texteditor/codeassist/documentcontentcompletion.cpp index 162cba12d18..44506678e02 100644 --- a/src/plugins/texteditor/codeassist/documentcontentcompletion.cpp +++ b/src/plugins/texteditor/codeassist/documentcontentcompletion.cpp @@ -13,7 +13,6 @@ #include "../texteditorsettings.h" #include -#include #include #include From 3a62e6d7f2bbaf1214a7df40584ae9a97fea5d38 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 27 Jan 2023 14:08:37 +0100 Subject: [PATCH 112/133] ClangTools: reduce priority of clangtool processes Fixes: QTCREATORBUG-28719 Change-Id: I93e1db6e2494068a61fd0a877a0ef42aa0b11ae9 Reviewed-by: Jarek Kobus --- src/plugins/clangtools/clangtoolrunner.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/clangtools/clangtoolrunner.cpp b/src/plugins/clangtools/clangtoolrunner.cpp index bb48621c2f0..4c2a908a789 100644 --- a/src/plugins/clangtools/clangtoolrunner.cpp +++ b/src/plugins/clangtools/clangtoolrunner.cpp @@ -144,6 +144,7 @@ TaskItem clangToolTask(const AnalyzeInputData &input, const auto onProcessSetup = [=](QtcProcess &process) { process.setEnvironment(input.environment); process.setUseCtrlCStub(true); + process.setLowPriority(); process.setWorkingDirectory(input.outputDirPath); // Current clang-cl puts log file into working dir. const ClangToolStorage *data = storage.activeStorage(); From 6b11e1d5729167a62fb77b17251a65b126ff5c0f Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 26 Jan 2023 19:06:02 +0100 Subject: [PATCH 113/133] TaskTree: Revamp tests Get rid of std::bind. Enclose each data tag of processTree inside its own block, so that "root" and "log" names are unique within each block. This makes each block look like a pattern with filled data up. Introduce TestData structure, so that it's harder now to mix the order of test data in new rows. Introduce some enums instead of bools to make more meaning on the returned data. Change-Id: Iffe49cf1c7f912378467ab9f9c1256003dba7b9c Reviewed-by: hjk --- tests/auto/utils/tasktree/tst_tasktree.cpp | 1065 +++++++++++--------- 1 file changed, 568 insertions(+), 497 deletions(-) diff --git a/tests/auto/utils/tasktree/tst_tasktree.cpp b/tests/auto/utils/tasktree/tst_tasktree.cpp index 4680c5e745c..d1c44912240 100644 --- a/tests/auto/utils/tasktree/tst_tasktree.cpp +++ b/tests/auto/utils/tasktree/tst_tasktree.cpp @@ -10,12 +10,45 @@ #include -#include -#include - using namespace Utils; using namespace Utils::Tasking; +enum class Handler { + Setup, + Done, + Error, + GroupSetup, + GroupDone, + GroupError +}; + +using Log = QList>; + +struct CustomStorage +{ + CustomStorage() { ++s_count; } + ~CustomStorage() { --s_count; } + Log m_log; + static int instanceCount() { return s_count; } +private: + static int s_count; +}; + +int CustomStorage::s_count = 0; +static const char s_processIdProperty[] = "__processId"; + +enum class OnStart { Running, NotRunning }; +enum class OnDone { Success, Failure }; + +struct TestData { + TreeStorage storage; + Group root; + Log expectedLog; + int taskCount = 0; + OnStart onStart = OnStart::Running; + OnDone onDone = OnDone::Success; +}; + class tst_TaskTree : public QObject { Q_OBJECT @@ -37,8 +70,8 @@ private: void tst_TaskTree::initTestCase() { - Utils::TemporaryDirectory::setMasterTemporaryDirectory(QDir::tempPath() + "/" - + Core::Constants::IDE_CASED_ID + "-XXXXXX"); + TemporaryDirectory::setMasterTemporaryDirectory(QDir::tempPath() + "/" + + Core::Constants::IDE_CASED_ID + "-XXXXXX"); const QString libExecPath(qApp->applicationDirPath() + '/' + QLatin1String(TEST_RELATIVE_LIBEXEC_PATH)); LauncherInterface::setPathToLauncher(libExecPath); @@ -48,7 +81,7 @@ void tst_TaskTree::initTestCase() void tst_TaskTree::cleanupTestCase() { - Utils::Singleton::deleteAll(); + Singleton::deleteAll(); } void tst_TaskTree::validConstructs() @@ -80,7 +113,7 @@ void tst_TaskTree::validConstructs() Group { parallel, Process([](QtcProcess &) {}, [](const QtcProcess &) {}), - OnGroupDone([] {}), + OnGroupDone([] {}) } }, process, @@ -89,42 +122,9 @@ void tst_TaskTree::validConstructs() }; } -static const char s_processIdProperty[] = "__processId"; - -enum class Handler { - Setup, - Done, - Error, - GroupSetup, - GroupDone, - GroupError -}; - -using Log = QList>; - -struct CustomStorage -{ - CustomStorage() { ++s_count; } - ~CustomStorage() { --s_count; } - Log m_log; - static int instanceCount() { return s_count; } -private: - static int s_count; -}; - -int CustomStorage::s_count = 0; - - void tst_TaskTree::processTree_data() { - using namespace std::placeholders; - - QTest::addColumn("root"); - QTest::addColumn>("storage"); - QTest::addColumn("expectedLog"); - QTest::addColumn("runningAfterStart"); - QTest::addColumn("success"); - QTest::addColumn("taskCount"); + QTest::addColumn("testData"); TreeStorage storage; @@ -134,14 +134,21 @@ void tst_TaskTree::processTree_data() process.setProperty(s_processIdProperty, processId); storage->m_log.append({processId, Handler::Setup}); }; - const auto setupProcess = [setupProcessHelper](QtcProcess &process, int processId) { - setupProcessHelper(process, {"-return", "0"}, processId); + const auto setupProcess = [setupProcessHelper](int processId) { + return [=](QtcProcess &process) { + setupProcessHelper(process, {"-return", "0"}, processId); + }; }; - const auto setupCrashProcess = [setupProcessHelper](QtcProcess &process, int processId) { - setupProcessHelper(process, {"-crash"}, processId); + const auto setupCrashProcess = [setupProcessHelper](int processId) { + return [=](QtcProcess &process) { + setupProcessHelper(process, {"-crash"}, processId); + }; }; - const auto readResultAnonymous = [storage](const QtcProcess &) { - storage->m_log.append({-1, Handler::Done}); + const auto setupDynamicProcess = [setupProcessHelper](int processId, TaskAction action) { + return [=](QtcProcess &process) { + setupProcessHelper(process, {"-return", "0"}, processId); + return action; + }; }; const auto readResult = [storage](const QtcProcess &process) { const int processId = process.property(s_processIdProperty).toInt(); @@ -151,481 +158,543 @@ void tst_TaskTree::processTree_data() const int processId = process.property(s_processIdProperty).toInt(); storage->m_log.append({processId, Handler::Error}); }; - const auto groupSetup = [storage](int processId) { - storage->m_log.append({processId, Handler::GroupSetup}); + const auto groupSetup = [storage](int groupId) { + return [=] { storage->m_log.append({groupId, Handler::GroupSetup}); }; }; - const auto groupDone = [storage](int processId) { - storage->m_log.append({processId, Handler::GroupDone}); + const auto groupDone = [storage](int groupId) { + return [=] { storage->m_log.append({groupId, Handler::GroupDone}); }; }; - const auto rootDone = [storage] { - storage->m_log.append({-1, Handler::GroupDone}); + const auto groupError = [storage](int groupId) { + return [=] { storage->m_log.append({groupId, Handler::GroupError}); }; }; - const auto rootError = [storage] { - storage->m_log.append({-1, Handler::GroupError}); - }; - const auto setupDynamicProcess = [storage, setupProcess](QtcProcess &process, int processId, - TaskAction action) { - setupProcess(process, processId); - return action; - }; - - const Group emptyRoot { - Storage(storage), - OnGroupDone(rootDone) - }; - const Log emptyLog{{-1, Handler::GroupDone}}; - QTest::newRow("Empty") << emptyRoot << storage << emptyLog << false << true << 0; - - const Group dynamicTaskDoneRoot { - Storage(storage), - Process(std::bind(setupDynamicProcess, _1, 1, TaskAction::StopWithDone), readResult, readError), - Process(std::bind(setupDynamicProcess, _1, 2, TaskAction::StopWithDone), readResult, readError) - }; - const Log dynamicTaskDoneLog{{1, Handler::Setup}, - {2, Handler::Setup}}; - QTest::newRow("DynamicTaskDone") << dynamicTaskDoneRoot << storage << dynamicTaskDoneLog - << false << true << 2; - - const Group dynamicTaskErrorRoot { - Storage(storage), - Process(std::bind(setupDynamicProcess, _1, 1, TaskAction::StopWithError), readResult, readError), - Process(std::bind(setupDynamicProcess, _1, 2, TaskAction::StopWithError), readResult, readError) - }; - const Log dynamicTaskErrorLog{{1, Handler::Setup}}; - QTest::newRow("DynamicTaskError") << dynamicTaskErrorRoot << storage << dynamicTaskErrorLog - << false << false << 2; - - const Group dynamicMixedRoot { - Storage(storage), - Process(std::bind(setupDynamicProcess, _1, 1, TaskAction::Continue), readResult, readError), - Process(std::bind(setupDynamicProcess, _1, 2, TaskAction::Continue), readResult, readError), - Process(std::bind(setupDynamicProcess, _1, 3, TaskAction::StopWithError), readResult, readError), - Process(std::bind(setupDynamicProcess, _1, 4, TaskAction::Continue), readResult, readError) - }; - const Log dynamicMixedLog{{1, Handler::Setup}, - {1, Handler::Done}, - {2, Handler::Setup}, - {2, Handler::Done}, - {3, Handler::Setup}}; - QTest::newRow("DynamicMixed") << dynamicMixedRoot << storage << dynamicMixedLog - << true << false << 4; - - const Group dynamicParallelRoot { - parallel, - Storage(storage), - Process(std::bind(setupDynamicProcess, _1, 1, TaskAction::Continue), readResult, readError), - Process(std::bind(setupDynamicProcess, _1, 2, TaskAction::Continue), readResult, readError), - Process(std::bind(setupDynamicProcess, _1, 3, TaskAction::StopWithError), readResult, readError), - Process(std::bind(setupDynamicProcess, _1, 4, TaskAction::Continue), readResult, readError) - }; - const Log dynamicParallelLog{{1, Handler::Setup}, - {2, Handler::Setup}, - {3, Handler::Setup}, - {1, Handler::Error}, - {2, Handler::Error}}; - QTest::newRow("DynamicParallel") << dynamicParallelRoot << storage << dynamicParallelLog - << false << false << 4; - - const Group dynamicParallelGroupRoot { - parallel, - Storage(storage), - Process(std::bind(setupDynamicProcess, _1, 1, TaskAction::Continue), readResult, readError), - Process(std::bind(setupDynamicProcess, _1, 2, TaskAction::Continue), readResult, readError), - Group { - Process(std::bind(setupDynamicProcess, _1, 3, TaskAction::StopWithError), readResult, readError) - }, - Process(std::bind(setupDynamicProcess, _1, 4, TaskAction::Continue), readResult, readError) - }; - const Log dynamicParallelGroupLog{{1, Handler::Setup}, - {2, Handler::Setup}, - {3, Handler::Setup}, - {1, Handler::Error}, - {2, Handler::Error}}; - QTest::newRow("DynamicParallelGroup") << dynamicParallelGroupRoot << storage - << dynamicParallelGroupLog << false << false << 4; - - const Group dynamicParallelGroupSetupRoot { - parallel, - Storage(storage), - Process(std::bind(setupDynamicProcess, _1, 1, TaskAction::Continue), readResult, readError), - Process(std::bind(setupDynamicProcess, _1, 2, TaskAction::Continue), readResult, readError), - Group { - OnGroupSetup([storage] { storage->m_log.append({0, Handler::GroupSetup}); - return TaskAction::StopWithError; }), - Process(std::bind(setupDynamicProcess, _1, 3, TaskAction::Continue), readResult, readError) - }, - Process(std::bind(setupDynamicProcess, _1, 4, TaskAction::Continue), readResult, readError) - }; - const Log dynamicParallelGroupSetupLog{{1, Handler::Setup}, - {2, Handler::Setup}, - {0, Handler::GroupSetup}, - {1, Handler::Error}, - {2, Handler::Error}}; - QTest::newRow("DynamicParallelGroupSetup") << dynamicParallelGroupSetupRoot << storage - << dynamicParallelGroupSetupLog << false << false << 4; - - const Group nestedRoot { - Storage(storage), - Group { - Group { - Group { - Group { - Group { - Process(std::bind(setupProcess, _1, 5), readResult), - OnGroupSetup(std::bind(groupSetup, 5)), - OnGroupDone(std::bind(groupDone, 5)) - }, - OnGroupSetup(std::bind(groupSetup, 4)), - OnGroupDone(std::bind(groupDone, 4)) - }, - OnGroupSetup(std::bind(groupSetup, 3)), - OnGroupDone(std::bind(groupDone, 3)) - }, - OnGroupSetup(std::bind(groupSetup, 2)), - OnGroupDone(std::bind(groupDone, 2)) - }, - OnGroupSetup(std::bind(groupSetup, 1)), - OnGroupDone(std::bind(groupDone, 1)) - }, - OnGroupDone(rootDone) - }; - const Log nestedLog{{1, Handler::GroupSetup}, - {2, Handler::GroupSetup}, - {3, Handler::GroupSetup}, - {4, Handler::GroupSetup}, - {5, Handler::GroupSetup}, - {5, Handler::Setup}, - {5, Handler::Done}, - {5, Handler::GroupDone}, - {4, Handler::GroupDone}, - {3, Handler::GroupDone}, - {2, Handler::GroupDone}, - {1, Handler::GroupDone}, - {-1, Handler::GroupDone}}; - QTest::newRow("Nested") << nestedRoot << storage << nestedLog << true << true << 1; - - const Group parallelRoot { - Storage(storage), - parallel, - Process(std::bind(setupProcess, _1, 1), readResultAnonymous), - Process(std::bind(setupProcess, _1, 2), readResultAnonymous), - Process(std::bind(setupProcess, _1, 3), readResultAnonymous), - Process(std::bind(setupProcess, _1, 4), readResultAnonymous), - Process(std::bind(setupProcess, _1, 5), readResultAnonymous), - OnGroupDone(rootDone) - }; - const Log parallelLog{{1, Handler::Setup}, // Setup order is determined in parallel mode - {2, Handler::Setup}, - {3, Handler::Setup}, - {4, Handler::Setup}, - {5, Handler::Setup}, - {-1, Handler::Done}, // Done order isn't determined in parallel mode - {-1, Handler::Done}, - {-1, Handler::Done}, - {-1, Handler::Done}, - {-1, Handler::Done}, - {-1, Handler::GroupDone}}; // Done handlers may come in different order - QTest::newRow("Parallel") << parallelRoot << storage << parallelLog << true << true << 5; - - const Group sequentialRoot { - Storage(storage), - Process(std::bind(setupProcess, _1, 1), readResult), - Process(std::bind(setupProcess, _1, 2), readResult), - Process(std::bind(setupProcess, _1, 3), readResult), - Process(std::bind(setupProcess, _1, 4), readResult), - Process(std::bind(setupProcess, _1, 5), readResult), - OnGroupDone(rootDone) - }; - const Group sequentialEncapsulatedRoot { - Storage(storage), - Group { - Process(std::bind(setupProcess, _1, 1), readResult) - }, - Group { - Process(std::bind(setupProcess, _1, 2), readResult) - }, - Group { - Process(std::bind(setupProcess, _1, 3), readResult) - }, - Group { - Process(std::bind(setupProcess, _1, 4), readResult) - }, - Group { - Process(std::bind(setupProcess, _1, 5), readResult) - }, - OnGroupDone(rootDone) - }; - auto setupSubTree = [=](TaskTree &taskTree) { - const Group nestedRoot { - Storage(storage), - Process(std::bind(setupProcess, _1, 2), readResult), - Process(std::bind(setupProcess, _1, 3), readResult), - Process(std::bind(setupProcess, _1, 4), readResult), - }; - taskTree.setupRoot(nestedRoot); - CustomStorage *activeStorage = storage.activeStorage(); - auto collectSubLog = [activeStorage](CustomStorage *subTreeStorage){ - activeStorage->m_log += subTreeStorage->m_log; - }; - taskTree.onStorageDone(storage, collectSubLog); - }; - const Group sequentialSubTreeRoot { - Storage(storage), - Process(std::bind(setupProcess, _1, 1), readResult), - Tree(setupSubTree), - Process(std::bind(setupProcess, _1, 5), readResult), - OnGroupDone(rootDone) - }; - const Log sequentialLog{{1, Handler::Setup}, - {1, Handler::Done}, - {2, Handler::Setup}, - {2, Handler::Done}, - {3, Handler::Setup}, - {3, Handler::Done}, - {4, Handler::Setup}, - {4, Handler::Done}, - {5, Handler::Setup}, - {5, Handler::Done}, - {-1, Handler::GroupDone}}; - QTest::newRow("Sequential") << sequentialRoot << storage << sequentialLog << true << true << 5; - QTest::newRow("SequentialEncapsulated") << sequentialEncapsulatedRoot << storage - << sequentialLog << true << true << 5; - QTest::newRow("SequentialSubTree") << sequentialSubTreeRoot << storage << sequentialLog - << true << true << 3; // We don't inspect subtrees - - const Group sequentialNestedRoot { - Storage(storage), - Group { - Process(std::bind(setupProcess, _1, 1), readResult), - Group { - Process(std::bind(setupProcess, _1, 2), readResult), - Group { - Process(std::bind(setupProcess, _1, 3), readResult), - Group { - Process(std::bind(setupProcess, _1, 4), readResult), - Group { - Process(std::bind(setupProcess, _1, 5), readResult), - OnGroupDone(std::bind(groupDone, 5)) - }, - OnGroupDone(std::bind(groupDone, 4)) - }, - OnGroupDone(std::bind(groupDone, 3)) - }, - OnGroupDone(std::bind(groupDone, 2)) - }, - OnGroupDone(std::bind(groupDone, 1)) - }, - OnGroupDone(rootDone) - }; - const Log sequentialNestedLog{{1, Handler::Setup}, - {1, Handler::Done}, - {2, Handler::Setup}, - {2, Handler::Done}, - {3, Handler::Setup}, - {3, Handler::Done}, - {4, Handler::Setup}, - {4, Handler::Done}, - {5, Handler::Setup}, - {5, Handler::Done}, - {5, Handler::GroupDone}, - {4, Handler::GroupDone}, - {3, Handler::GroupDone}, - {2, Handler::GroupDone}, - {1, Handler::GroupDone}, - {-1, Handler::GroupDone}}; - QTest::newRow("SequentialNested") << sequentialNestedRoot << storage << sequentialNestedLog - << true << true << 5; - - const Group sequentialErrorRoot { - Storage(storage), - Process(std::bind(setupProcess, _1, 1), readResult), - Process(std::bind(setupProcess, _1, 2), readResult), - Process(std::bind(setupCrashProcess, _1, 3), readResult, readError), - Process(std::bind(setupProcess, _1, 4), readResult), - Process(std::bind(setupProcess, _1, 5), readResult), - OnGroupDone(rootDone), - OnGroupError(rootError) - }; - const Log sequentialErrorLog{{1, Handler::Setup}, - {1, Handler::Done}, - {2, Handler::Setup}, - {2, Handler::Done}, - {3, Handler::Setup}, - {3, Handler::Error}, - {-1, Handler::GroupError}}; - QTest::newRow("SequentialError") << sequentialErrorRoot << storage << sequentialErrorLog - << true << false << 5; const auto constructSimpleSequence = [=](const Workflow &policy) { return Group { Storage(storage), policy, - Process(std::bind(setupProcess, _1, 1), readResult), - Process(std::bind(setupCrashProcess, _1, 2), readResult, readError), - Process(std::bind(setupProcess, _1, 3), readResult), - OnGroupDone(rootDone), - OnGroupError(rootError) + Process(setupProcess(1), readResult), + Process(setupCrashProcess(2), readResult, readError), + Process(setupProcess(3), readResult), + OnGroupDone(groupDone(0)), + OnGroupError(groupError(0)) }; }; - - const Group stopOnErrorRoot = constructSimpleSequence(stopOnError); - const Log stopOnErrorLog{{1, Handler::Setup}, - {1, Handler::Done}, - {2, Handler::Setup}, - {2, Handler::Error}, - {-1, Handler::GroupError}}; - QTest::newRow("StopOnError") << stopOnErrorRoot << storage << stopOnErrorLog << true << false << 3; - - const Group continueOnErrorRoot = constructSimpleSequence(continueOnError); - const Log continueOnErrorLog{{1, Handler::Setup}, - {1, Handler::Done}, - {2, Handler::Setup}, - {2, Handler::Error}, - {3, Handler::Setup}, - {3, Handler::Done}, - {-1, Handler::GroupError}}; - QTest::newRow("ContinueOnError") << continueOnErrorRoot << storage << continueOnErrorLog - << true << false << 3; - - const Group stopOnDoneRoot = constructSimpleSequence(stopOnDone); - const Log stopOnDoneLog{{1, Handler::Setup}, - {1, Handler::Done}, - {-1, Handler::GroupDone}}; - QTest::newRow("StopOnDone") << stopOnDoneRoot << storage << stopOnDoneLog - << true << true << 3; - - const Group continueOnDoneRoot = constructSimpleSequence(continueOnDone); - const Log continueOnDoneLog{{1, Handler::Setup}, - {1, Handler::Done}, - {2, Handler::Setup}, - {2, Handler::Error}, - {3, Handler::Setup}, - {3, Handler::Done}, - {-1, Handler::GroupDone}}; - QTest::newRow("ContinueOnDone") << continueOnDoneRoot << storage << continueOnDoneLog - << true << true << 3; - - const Group optionalRoot { - Storage(storage), - optional, - Process(std::bind(setupCrashProcess, _1, 1), readResult, readError), - Process(std::bind(setupCrashProcess, _1, 2), readResult, readError), - OnGroupDone(rootDone), - OnGroupError(rootError) - }; - const Log optionalLog{{1, Handler::Setup}, - {1, Handler::Error}, - {2, Handler::Setup}, - {2, Handler::Error}, - {-1, Handler::GroupDone}}; - QTest::newRow("Optional") << optionalRoot << storage << optionalLog << true << true << 2; - - const auto stopWithDoneSetup = [] { return TaskAction::StopWithDone; }; - const auto stopWithErrorSetup = [] { return TaskAction::StopWithError; }; - const auto continueSetup = [] { return TaskAction::Continue; }; - const auto constructDynamicSetup = [=](const OnGroupSetup &dynamicSetup) { + const auto constructDynamicHierarchy = [=](TaskAction taskAction) { return Group { Storage(storage), Group { - Process(std::bind(setupProcess, _1, 1), readResult) + Process(setupProcess(1), readResult) }, Group { - dynamicSetup, - Process(std::bind(setupProcess, _1, 2), readResult), - Process(std::bind(setupProcess, _1, 3), readResult), - Process(std::bind(setupProcess, _1, 4), readResult) + OnGroupSetup([=] { return taskAction; }), + Process(setupProcess(2), readResult), + Process(setupProcess(3), readResult), + Process(setupProcess(4), readResult) }, - OnGroupDone(rootDone), - OnGroupError(rootError) + OnGroupDone(groupDone(0)), + OnGroupError(groupError(0)) }; }; - const Group dynamicSetupDoneRoot = constructDynamicSetup({stopWithDoneSetup}); - const Log dynamicSetupDoneLog{{1, Handler::Setup}, - {1, Handler::Done}, - {-1, Handler::GroupDone}}; - QTest::newRow("DynamicSetupDone") << dynamicSetupDoneRoot << storage << dynamicSetupDoneLog - << true << true << 4; - const Group dynamicSetupErrorRoot = constructDynamicSetup({stopWithErrorSetup}); - const Log dynamicSetupErrorLog{{1, Handler::Setup}, - {1, Handler::Done}, - {-1, Handler::GroupError}}; - QTest::newRow("DynamicSetupError") << dynamicSetupErrorRoot << storage << dynamicSetupErrorLog - << true << false << 4; + { + const Group root { + Storage(storage), + OnGroupDone(groupDone(0)) + }; + const Log log {{0, Handler::GroupDone}}; + QTest::newRow("Empty") + << TestData{storage, root, log, 0, OnStart::NotRunning, OnDone::Success}; + } - const Group dynamicSetupContinueRoot = constructDynamicSetup({continueSetup}); - const Log dynamicSetupContinueLog{{1, Handler::Setup}, - {1, Handler::Done}, - {2, Handler::Setup}, - {2, Handler::Done}, - {3, Handler::Setup}, - {3, Handler::Done}, - {4, Handler::Setup}, - {4, Handler::Done}, - {-1, Handler::GroupDone}}; - QTest::newRow("DynamicSetupContinue") << dynamicSetupContinueRoot << storage - << dynamicSetupContinueLog << true << true << 4; + { + const Group root { + Storage(storage), + Process(setupDynamicProcess(1, TaskAction::StopWithDone), readResult, readError), + Process(setupDynamicProcess(2, TaskAction::StopWithDone), readResult, readError) + }; + const Log log {{1, Handler::Setup}, {2, Handler::Setup}}; + QTest::newRow("DynamicTaskDone") + << TestData{storage, root, log, 2, OnStart::NotRunning, OnDone::Success}; + } - const Group nestedParallelRoot { - ParallelLimit(2), - Storage(storage), - Group { - Storage(TreeStorage()), - OnGroupSetup(std::bind(groupSetup, 1)), + { + const Group root { + Storage(storage), + Process(setupDynamicProcess(1, TaskAction::StopWithError), readResult, readError), + Process(setupDynamicProcess(2, TaskAction::StopWithError), readResult, readError) + }; + const Log log {{1, Handler::Setup}}; + QTest::newRow("DynamicTaskError") + << TestData{storage, root, log, 2, OnStart::NotRunning, OnDone::Failure}; + } + + { + const Group root { + Storage(storage), + Process(setupDynamicProcess(1, TaskAction::Continue), readResult, readError), + Process(setupDynamicProcess(2, TaskAction::Continue), readResult, readError), + Process(setupDynamicProcess(3, TaskAction::StopWithError), readResult, readError), + Process(setupDynamicProcess(4, TaskAction::Continue), readResult, readError) + }; + const Log log { + {1, Handler::Setup}, + {1, Handler::Done}, + {2, Handler::Setup}, + {2, Handler::Done}, + {3, Handler::Setup} + }; + QTest::newRow("DynamicMixed") + << TestData{storage, root, log, 4, OnStart::Running, OnDone::Failure}; + } + + { + const Group root { + parallel, + Storage(storage), + Process(setupDynamicProcess(1, TaskAction::Continue), readResult, readError), + Process(setupDynamicProcess(2, TaskAction::Continue), readResult, readError), + Process(setupDynamicProcess(3, TaskAction::StopWithError), readResult, readError), + Process(setupDynamicProcess(4, TaskAction::Continue), readResult, readError) + }; + const Log log { + {1, Handler::Setup}, + {2, Handler::Setup}, + {3, Handler::Setup}, + {1, Handler::Error}, + {2, Handler::Error} + }; + QTest::newRow("DynamicParallel") + << TestData{storage, root, log, 4, OnStart::NotRunning, OnDone::Failure}; + } + + { + const Group root { + parallel, + Storage(storage), + Process(setupDynamicProcess(1, TaskAction::Continue), readResult, readError), + Process(setupDynamicProcess(2, TaskAction::Continue), readResult, readError), Group { - parallel, - Process(std::bind(setupProcess, _1, 1)), - } - }, - Group { - Storage(TreeStorage()), - OnGroupSetup(std::bind(groupSetup, 2)), + Process(setupDynamicProcess(3, TaskAction::StopWithError), readResult, readError) + }, + Process(setupDynamicProcess(4, TaskAction::Continue), readResult, readError) + }; + const Log log { + {1, Handler::Setup}, + {2, Handler::Setup}, + {3, Handler::Setup}, + {1, Handler::Error}, + {2, Handler::Error} + }; + QTest::newRow("DynamicParallelGroup") + << TestData{storage, root, log, 4, OnStart::NotRunning, OnDone::Failure}; + } + + { + const Group root { + parallel, + Storage(storage), + Process(setupDynamicProcess(1, TaskAction::Continue), readResult, readError), + Process(setupDynamicProcess(2, TaskAction::Continue), readResult, readError), Group { - parallel, - Process(std::bind(setupProcess, _1, 2)), - } - }, - Group { - Storage(TreeStorage()), - OnGroupSetup(std::bind(groupSetup, 3)), + OnGroupSetup([storage] { + storage->m_log.append({0, Handler::GroupSetup}); + return TaskAction::StopWithError; + }), + Process(setupDynamicProcess(3, TaskAction::Continue), readResult, readError) + }, + Process(setupDynamicProcess(4, TaskAction::Continue), readResult, readError) + }; + const Log log { + {1, Handler::Setup}, + {2, Handler::Setup}, + {0, Handler::GroupSetup}, + {1, Handler::Error}, + {2, Handler::Error} + }; + QTest::newRow("DynamicParallelGroupSetup") + << TestData{storage, root, log, 4, OnStart::NotRunning, OnDone::Failure}; + } + + { + const Group root { + Storage(storage), Group { - parallel, - Process(std::bind(setupProcess, _1, 3)), - } - }, - Group { - Storage(TreeStorage()), - OnGroupSetup(std::bind(groupSetup, 4)), + Group { + Group { + Group { + Group { + Process(setupProcess(5), readResult, readError), + OnGroupSetup(groupSetup(5)), + OnGroupDone(groupDone(5)) + }, + OnGroupSetup(groupSetup(4)), + OnGroupDone(groupDone(4)) + }, + OnGroupSetup(groupSetup(3)), + OnGroupDone(groupDone(3)) + }, + OnGroupSetup(groupSetup(2)), + OnGroupDone(groupDone(2)) + }, + OnGroupSetup(groupSetup(1)), + OnGroupDone(groupDone(1)) + }, + OnGroupDone(groupDone(0)) + }; + const Log log { + {1, Handler::GroupSetup}, + {2, Handler::GroupSetup}, + {3, Handler::GroupSetup}, + {4, Handler::GroupSetup}, + {5, Handler::GroupSetup}, + {5, Handler::Setup}, + {5, Handler::Done}, + {5, Handler::GroupDone}, + {4, Handler::GroupDone}, + {3, Handler::GroupDone}, + {2, Handler::GroupDone}, + {1, Handler::GroupDone}, + {0, Handler::GroupDone} + }; + QTest::newRow("Nested") + << TestData{storage, root, log, 1, OnStart::Running, OnDone::Success}; + } + + { + const auto readResultAnonymous = [=](const QtcProcess &) { + storage->m_log.append({0, Handler::Done}); + }; + const Group root { + Storage(storage), + parallel, + Process(setupProcess(1), readResultAnonymous), + Process(setupProcess(2), readResultAnonymous), + Process(setupProcess(3), readResultAnonymous), + Process(setupProcess(4), readResultAnonymous), + Process(setupProcess(5), readResultAnonymous), + OnGroupDone(groupDone(0)) + }; + const Log log { + {1, Handler::Setup}, // Setup order is determined in parallel mode + {2, Handler::Setup}, + {3, Handler::Setup}, + {4, Handler::Setup}, + {5, Handler::Setup}, + {0, Handler::Done}, // Done order isn't determined in parallel mode + {0, Handler::Done}, + {0, Handler::Done}, + {0, Handler::Done}, + {0, Handler::Done}, + {0, Handler::GroupDone} + }; + QTest::newRow("Parallel") + << TestData{storage, root, log, 5, OnStart::Running, OnDone::Success}; + } + + { + auto setupSubTree = [=](TaskTree &taskTree) { + const Group nestedRoot { + Storage(storage), + Process(setupProcess(2), readResult), + Process(setupProcess(3), readResult), + Process(setupProcess(4), readResult) + }; + taskTree.setupRoot(nestedRoot); + CustomStorage *activeStorage = storage.activeStorage(); + auto collectSubLog = [activeStorage](CustomStorage *subTreeStorage){ + activeStorage->m_log += subTreeStorage->m_log; + }; + taskTree.onStorageDone(storage, collectSubLog); + }; + const Group root1 { + Storage(storage), + Process(setupProcess(1), readResult), + Process(setupProcess(2), readResult), + Process(setupProcess(3), readResult), + Process(setupProcess(4), readResult), + Process(setupProcess(5), readResult), + OnGroupDone(groupDone(0)) + }; + const Group root2 { + Storage(storage), + Group { Process(setupProcess(1), readResult) }, + Group { Process(setupProcess(2), readResult) }, + Group { Process(setupProcess(3), readResult) }, + Group { Process(setupProcess(4), readResult) }, + Group { Process(setupProcess(5), readResult) }, + OnGroupDone(groupDone(0)) + }; + const Group root3 { + Storage(storage), + Process(setupProcess(1), readResult), + Tree(setupSubTree), + Process(setupProcess(5), readResult), + OnGroupDone(groupDone(0)) + }; + const Log log { + {1, Handler::Setup}, + {1, Handler::Done}, + {2, Handler::Setup}, + {2, Handler::Done}, + {3, Handler::Setup}, + {3, Handler::Done}, + {4, Handler::Setup}, + {4, Handler::Done}, + {5, Handler::Setup}, + {5, Handler::Done}, + {0, Handler::GroupDone} + }; + QTest::newRow("Sequential") + << TestData{storage, root1, log, 5, OnStart::Running, OnDone::Success}; + QTest::newRow("SequentialEncapsulated") + << TestData{storage, root2, log, 5, OnStart::Running, OnDone::Success}; + QTest::newRow("SequentialSubTree") // We don't inspect subtrees, so taskCount is 3, not 5. + << TestData{storage, root3, log, 3, OnStart::Running, OnDone::Success}; + } + + { + const Group root { + Storage(storage), Group { - parallel, - Process(std::bind(setupProcess, _1, 4)), + Process(setupProcess(1), readResult), + Group { + Process(setupProcess(2), readResult), + Group { + Process(setupProcess(3), readResult), + Group { + Process(setupProcess(4), readResult), + Group { + Process(setupProcess(5), readResult), + OnGroupDone(groupDone(5)) + }, + OnGroupDone(groupDone(4)) + }, + OnGroupDone(groupDone(3)) + }, + OnGroupDone(groupDone(2)) + }, + OnGroupDone(groupDone(1)) + }, + OnGroupDone(groupDone(0)) + }; + const Log log { + {1, Handler::Setup}, + {1, Handler::Done}, + {2, Handler::Setup}, + {2, Handler::Done}, + {3, Handler::Setup}, + {3, Handler::Done}, + {4, Handler::Setup}, + {4, Handler::Done}, + {5, Handler::Setup}, + {5, Handler::Done}, + {5, Handler::GroupDone}, + {4, Handler::GroupDone}, + {3, Handler::GroupDone}, + {2, Handler::GroupDone}, + {1, Handler::GroupDone}, + {0, Handler::GroupDone} + }; + QTest::newRow("SequentialNested") + << TestData{storage, root, log, 5, OnStart::Running, OnDone::Success}; + } + + { + const Group root { + Storage(storage), + Process(setupProcess(1), readResult), + Process(setupProcess(2), readResult), + Process(setupCrashProcess(3), readResult, readError), + Process(setupProcess(4), readResult), + Process(setupProcess(5), readResult), + OnGroupDone(groupDone(0)), + OnGroupError(groupError(0)) + }; + const Log log { + {1, Handler::Setup}, + {1, Handler::Done}, + {2, Handler::Setup}, + {2, Handler::Done}, + {3, Handler::Setup}, + {3, Handler::Error}, + {0, Handler::GroupError} + }; + QTest::newRow("SequentialError") + << TestData{storage, root, log, 5, OnStart::Running, OnDone::Failure}; + } + + { + const Group root = constructSimpleSequence(stopOnError); + const Log log { + {1, Handler::Setup}, + {1, Handler::Done}, + {2, Handler::Setup}, + {2, Handler::Error}, + {0, Handler::GroupError} + }; + QTest::newRow("StopOnError") + << TestData{storage, root, log, 3, OnStart::Running, OnDone::Failure}; + } + + { + const Group root = constructSimpleSequence(continueOnError); + const Log log { + {1, Handler::Setup}, + {1, Handler::Done}, + {2, Handler::Setup}, + {2, Handler::Error}, + {3, Handler::Setup}, + {3, Handler::Done}, + {0, Handler::GroupError} + }; + QTest::newRow("ContinueOnError") + << TestData{storage, root, log, 3, OnStart::Running, OnDone::Failure}; + } + + { + const Group root = constructSimpleSequence(stopOnDone); + const Log log { + {1, Handler::Setup}, + {1, Handler::Done}, + {0, Handler::GroupDone} + }; + QTest::newRow("StopOnDone") + << TestData{storage, root, log, 3, OnStart::Running, OnDone::Success}; + } + + { + const Group root = constructSimpleSequence(continueOnDone); + const Log log { + {1, Handler::Setup}, + {1, Handler::Done}, + {2, Handler::Setup}, + {2, Handler::Error}, + {3, Handler::Setup}, + {3, Handler::Done}, + {0, Handler::GroupDone} + }; + QTest::newRow("ContinueOnDone") + << TestData{storage, root, log, 3, OnStart::Running, OnDone::Success}; + } + + { + const Group root { + Storage(storage), + optional, + Process(setupCrashProcess(1), readResult, readError), + Process(setupCrashProcess(2), readResult, readError), + OnGroupDone(groupDone(0)), + OnGroupError(groupError(0)) + }; + const Log log { + {1, Handler::Setup}, + {1, Handler::Error}, + {2, Handler::Setup}, + {2, Handler::Error}, + {0, Handler::GroupDone} + }; + QTest::newRow("Optional") + << TestData{storage, root, log, 2, OnStart::Running, OnDone::Success}; + } + + { + const Group root = constructDynamicHierarchy(TaskAction::StopWithDone); + const Log log { + {1, Handler::Setup}, + {1, Handler::Done}, + {0, Handler::GroupDone} + }; + QTest::newRow("DynamicSetupDone") + << TestData{storage, root, log, 4, OnStart::Running, OnDone::Success}; + } + + { + const Group root = constructDynamicHierarchy(TaskAction::StopWithError); + const Log log { + {1, Handler::Setup}, + {1, Handler::Done}, + {0, Handler::GroupError} + }; + QTest::newRow("DynamicSetupError") + << TestData{storage, root, log, 4, OnStart::Running, OnDone::Failure}; + } + + { + const Group root = constructDynamicHierarchy(TaskAction::Continue); + const Log log { + {1, Handler::Setup}, + {1, Handler::Done}, + {2, Handler::Setup}, + {2, Handler::Done}, + {3, Handler::Setup}, + {3, Handler::Done}, + {4, Handler::Setup}, + {4, Handler::Done}, + {0, Handler::GroupDone} + }; + QTest::newRow("DynamicSetupContinue") + << TestData{storage, root, log, 4, OnStart::Running, OnDone::Success}; + } + + { + const Group root { + ParallelLimit(2), + Storage(storage), + Group { + Storage(TreeStorage()), + OnGroupSetup(groupSetup(1)), + Group { + parallel, + Process(setupProcess(1)) + } + }, + Group { + Storage(TreeStorage()), + OnGroupSetup(groupSetup(2)), + Group { + parallel, + Process(setupProcess(2)) + } + }, + Group { + Storage(TreeStorage()), + OnGroupSetup(groupSetup(3)), + Group { + parallel, + Process(setupProcess(3)) + } + }, + Group { + Storage(TreeStorage()), + OnGroupSetup(groupSetup(4)), + Group { + parallel, + Process(setupProcess(4)) + } } - }, - }; - const Log nestedParallelLog{{1, Handler::GroupSetup}, - {1, Handler::Setup}, - {2, Handler::GroupSetup}, - {2, Handler::Setup}, - {3, Handler::GroupSetup}, - {3, Handler::Setup}, - {4, Handler::GroupSetup}, - {4, Handler::Setup}}; - QTest::newRow("NestedParallel") << nestedParallelRoot << storage << nestedParallelLog - << true << true << 4; + }; + const Log log { + {1, Handler::GroupSetup}, + {1, Handler::Setup}, + {2, Handler::GroupSetup}, + {2, Handler::Setup}, + {3, Handler::GroupSetup}, + {3, Handler::Setup}, + {4, Handler::GroupSetup}, + {4, Handler::Setup} + }; + QTest::newRow("NestedParallel") + << TestData{storage, root, log, 4, OnStart::Running, OnDone::Success}; + } } void tst_TaskTree::processTree() { - QFETCH(Group, root); - QFETCH(TreeStorage, storage); - QFETCH(Log, expectedLog); - QFETCH(bool, runningAfterStart); - QFETCH(bool, success); - QFETCH(int, taskCount); + QFETCH(TestData, testData); QEventLoop eventLoop; - TaskTree taskTree(root); - QCOMPARE(taskTree.taskCount(), taskCount); + TaskTree taskTree(testData.root); + QCOMPARE(taskTree.taskCount(), testData.taskCount); int doneCount = 0; int errorCount = 0; connect(&taskTree, &TaskTree::done, this, [&doneCount, &eventLoop] { @@ -640,11 +709,12 @@ void tst_TaskTree::processTree() auto collectLog = [&actualLog](CustomStorage *storage){ actualLog = storage->m_log; }; - taskTree.onStorageDone(storage, collectLog); + taskTree.onStorageDone(testData.storage, collectLog); taskTree.start(); - QCOMPARE(taskTree.isRunning(), runningAfterStart); + const bool expectRunning = testData.onStart == OnStart::Running; + QCOMPARE(taskTree.isRunning(), expectRunning); - if (runningAfterStart) { + if (expectRunning) { QTimer timer; bool timedOut = false; connect(&timer, &QTimer::timeout, &eventLoop, [&eventLoop, &timedOut] { @@ -659,12 +729,13 @@ void tst_TaskTree::processTree() QCOMPARE(taskTree.isRunning(), false); } - QCOMPARE(taskTree.progressValue(), taskCount); - QCOMPARE(actualLog, expectedLog); + QCOMPARE(taskTree.progressValue(), testData.taskCount); + QCOMPARE(actualLog, testData.expectedLog); QCOMPARE(CustomStorage::instanceCount(), 0); - const int expectedDoneCount = success ? 1 : 0; - const int expectedErrorCount = success ? 0 : 1; + const bool expectSuccess = testData.onDone == OnDone::Success; + const int expectedDoneCount = expectSuccess ? 1 : 0; + const int expectedErrorCount = expectSuccess ? 0 : 1; QCOMPARE(doneCount, expectedDoneCount); QCOMPARE(errorCount, expectedErrorCount); } From 5bcb24cb7115c2efe08fb512dc9d5ae7c174a792 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 24 Jan 2023 21:04:59 +0100 Subject: [PATCH 114/133] TaskTree: Fix continuation when synchronous stop appeared It may potentially crash when continuation unwinds on synchronous stop. It's a similar fix to 567216bb491b336d4a002f6ebf7589d88d514751, this time it fixes the continuation when not directly coming from TaskTree::start(). The follow up commit adds a test for crashing case. Change-Id: Idd936e42b567ff4bddab717267c62f0104bf3b62 Reviewed-by: hjk --- src/libs/utils/tasktree.cpp | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/libs/utils/tasktree.cpp b/src/libs/utils/tasktree.cpp index 2c1887ea41e..9b72dc58006 100644 --- a/src/libs/utils/tasktree.cpp +++ b/src/libs/utils/tasktree.cpp @@ -154,9 +154,10 @@ public: int currentLimit() const; TaskAction childDone(bool success); void groupDone(bool success); + void treeDone(bool success); void invokeEndHandler(bool success); - void resetSuccessBit(); - void updateSuccessBit(bool success); + void resetSuccessBit(); // only on start + void updateSuccessBit(bool success); // only on childDone void createStorages(); void deleteStorages(); @@ -233,11 +234,7 @@ public: QTC_ASSERT(m_storages.contains(it.key()), qWarning("The registered storage doesn't " "exist in task tree. Its handlers will never be called.")); } - const TaskAction action = m_root->start(); - if (action == TaskAction::StopWithDone) - emitDone(); - else if (action == TaskAction::StopWithError) - emitError(); + m_root->start(); } void stop() { QTC_ASSERT(m_root, return); @@ -366,17 +363,17 @@ TaskAction TaskContainer::start() const bool success = groupAction == TaskAction::StopWithDone; m_taskTreePrivate->advanceProgress(m_taskCount); invokeEndHandler(success); + groupDone(success); return groupAction; } resetSuccessBit(); - - GuardLocker locker(m_startGuard); return startChildren(0); } TaskAction TaskContainer::startChildren(int nextChild) { + GuardLocker locker(m_startGuard); const int childCount = m_children.size(); for (int i = nextChild; i < childCount; ++i) { const int limit = currentLimit(); @@ -396,6 +393,7 @@ TaskAction TaskContainer::startChildren(int nextChild) for (int j = i + 1; j < limit; ++j) skippedTaskCount += m_children.at(j)->taskCount(); m_taskTreePrivate->advanceProgress(skippedTaskCount); + treeDone(finalizeAction == TaskAction::StopWithDone); return finalizeAction; } @@ -458,13 +456,19 @@ TaskAction TaskContainer::childDone(bool success) void TaskContainer::groupDone(bool success) { - if (isStarting()) - return; - if (m_parentContainer) { - m_parentContainer->childDone(success); + if (!m_parentContainer->isStarting()) + m_parentContainer->childDone(success); return; } + if (!isStarting()) + treeDone(success); +} + +void TaskContainer::treeDone(bool success) +{ + if (m_parentContainer) + return; if (success) m_taskTreePrivate->emitDone(); else From 0f19fd6d0d6dab11e7a9e2aa32509420fdcc8ea5 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 27 Jan 2023 13:36:44 +0100 Subject: [PATCH 115/133] TaskTree: Add tests for proper continuation unwinding Change-Id: I79a077277328033b99fab6b2503621f3209c63be Reviewed-by: hjk --- tests/auto/utils/tasktree/tst_tasktree.cpp | 205 ++++++++++++++++++++- 1 file changed, 203 insertions(+), 2 deletions(-) diff --git a/tests/auto/utils/tasktree/tst_tasktree.cpp b/tests/auto/utils/tasktree/tst_tasktree.cpp index d1c44912240..f37f345590a 100644 --- a/tests/auto/utils/tasktree/tst_tasktree.cpp +++ b/tests/auto/utils/tasktree/tst_tasktree.cpp @@ -636,6 +636,119 @@ void tst_TaskTree::processTree_data() << TestData{storage, root, log, 4, OnStart::Running, OnDone::Success}; } + { + const Group root { + ParallelLimit(2), + Storage(storage), + Group { + OnGroupSetup(groupSetup(1)), + Process(setupProcess(1)) + }, + Group { + OnGroupSetup(groupSetup(2)), + Process(setupProcess(2)) + }, + Group { + OnGroupSetup(groupSetup(3)), + Process(setupProcess(3)) + }, + Group { + OnGroupSetup(groupSetup(4)), + Process(setupProcess(4)) + } + }; + const Log log { + {1, Handler::GroupSetup}, + {1, Handler::Setup}, + {2, Handler::GroupSetup}, + {2, Handler::Setup}, + {3, Handler::GroupSetup}, + {3, Handler::Setup}, + {4, Handler::GroupSetup}, + {4, Handler::Setup} + }; + QTest::newRow("NestedParallel") + << TestData{storage, root, log, 4, OnStart::Running, OnDone::Success}; + } + + { + const Group root { + ParallelLimit(2), + Storage(storage), + Group { + OnGroupSetup(groupSetup(1)), + Process(setupProcess(1)) + }, + Group { + OnGroupSetup(groupSetup(2)), + Process(setupProcess(2)) + }, + Group { + OnGroupSetup(groupSetup(3)), + Process(setupDynamicProcess(3, TaskAction::StopWithDone)) + }, + Group { + OnGroupSetup(groupSetup(4)), + Process(setupProcess(4)) + }, + Group { + OnGroupSetup(groupSetup(5)), + Process(setupProcess(5)) + } + }; + const Log log { + {1, Handler::GroupSetup}, + {1, Handler::Setup}, + {2, Handler::GroupSetup}, + {2, Handler::Setup}, + {3, Handler::GroupSetup}, + {3, Handler::Setup}, + {4, Handler::GroupSetup}, + {4, Handler::Setup}, + {5, Handler::GroupSetup}, + {5, Handler::Setup} + }; + QTest::newRow("NestedParallelDone") + << TestData{storage, root, log, 5, OnStart::Running, OnDone::Success}; + } + + { + const Group root { + ParallelLimit(2), + Storage(storage), + Group { + OnGroupSetup(groupSetup(1)), + Process(setupProcess(1)) + }, + Group { + OnGroupSetup(groupSetup(2)), + Process(setupProcess(2)) + }, + Group { + OnGroupSetup(groupSetup(3)), + Process(setupDynamicProcess(3, TaskAction::StopWithError)) + }, + Group { + OnGroupSetup(groupSetup(4)), + Process(setupProcess(4)) + }, + Group { + OnGroupSetup(groupSetup(5)), + Process(setupProcess(5)) + } + }; + const Log log { + {1, Handler::GroupSetup}, + {1, Handler::Setup}, + {2, Handler::GroupSetup}, + {2, Handler::Setup}, + {3, Handler::GroupSetup}, + {3, Handler::Setup} + }; + QTest::newRow("NestedParallelError") + << TestData{storage, root, log, 5, OnStart::Running, OnDone::Failure}; + } + { const Group root { ParallelLimit(2), @@ -683,8 +796,96 @@ void tst_TaskTree::processTree_data() {4, Handler::GroupSetup}, {4, Handler::Setup} }; - QTest::newRow("NestedParallel") - << TestData{storage, root, log, 4, OnStart::Running, OnDone::Success}; + QTest::newRow("DeeplyNestedParallel") + << TestData{storage, root, log, 4, OnStart::Running, OnDone::Success}; + } + + { + const Group root { + ParallelLimit(2), + Storage(storage), + Group { + Storage(TreeStorage()), + OnGroupSetup(groupSetup(1)), + Group { Process(setupProcess(1)) } + }, + Group { + Storage(TreeStorage()), + OnGroupSetup(groupSetup(2)), + Group { Process(setupProcess(2)) } + }, + Group { + Storage(TreeStorage()), + OnGroupSetup(groupSetup(3)), + Group { Process(setupDynamicProcess(3, TaskAction::StopWithDone)) } + }, + Group { + Storage(TreeStorage()), + OnGroupSetup(groupSetup(4)), + Group { Process(setupProcess(4)) } + }, + Group { + Storage(TreeStorage()), + OnGroupSetup(groupSetup(5)), + Group { Process(setupProcess(5)) } + } + }; + const Log log { + {1, Handler::GroupSetup}, + {1, Handler::Setup}, + {2, Handler::GroupSetup}, + {2, Handler::Setup}, + {3, Handler::GroupSetup}, + {3, Handler::Setup}, + {4, Handler::GroupSetup}, + {4, Handler::Setup}, + {5, Handler::GroupSetup}, + {5, Handler::Setup} + }; + QTest::newRow("DeeplyNestedParallelDone") + << TestData{storage, root, log, 5, OnStart::Running, OnDone::Success}; + } + + { + const Group root { + ParallelLimit(2), + Storage(storage), + Group { + Storage(TreeStorage()), + OnGroupSetup(groupSetup(1)), + Group { Process(setupProcess(1)) } + }, + Group { + Storage(TreeStorage()), + OnGroupSetup(groupSetup(2)), + Group { Process(setupProcess(2)) } + }, + Group { + Storage(TreeStorage()), + OnGroupSetup(groupSetup(3)), + Group { Process(setupDynamicProcess(3, TaskAction::StopWithError)) } + }, + Group { + Storage(TreeStorage()), + OnGroupSetup(groupSetup(4)), + Group { Process(setupProcess(4)) } + }, + Group { + Storage(TreeStorage()), + OnGroupSetup(groupSetup(5)), + Group { Process(setupProcess(5)) } + } + }; + const Log log { + {1, Handler::GroupSetup}, + {1, Handler::Setup}, + {2, Handler::GroupSetup}, + {2, Handler::Setup}, + {3, Handler::GroupSetup}, + {3, Handler::Setup} + }; + QTest::newRow("DeeplyNestedParallelError") + << TestData{storage, root, log, 5, OnStart::Running, OnDone::Failure}; } } From e95c1d3c148dcfa59764a6a49588cbb3fee9ca68 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 27 Jan 2023 17:12:33 +0100 Subject: [PATCH 116/133] CPlusPlus: Fix tools build Change-Id: I330990338b65b19436c908cea08a5280f40e6770 Reviewed-by: hjk --- src/tools/cplusplus-ast2png/cplusplus-ast2png.cpp | 3 ++- src/tools/cplusplus-frontend/cplusplus-frontend.cpp | 4 +++- src/tools/cplusplus-mkvisitor/cplusplus-mkvisitor.cpp | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/tools/cplusplus-ast2png/cplusplus-ast2png.cpp b/src/tools/cplusplus-ast2png/cplusplus-ast2png.cpp index 45934b4f5b6..36fb7533e55 100644 --- a/src/tools/cplusplus-ast2png/cplusplus-ast2png.cpp +++ b/src/tools/cplusplus-ast2png/cplusplus-ast2png.cpp @@ -17,6 +17,7 @@ #include #include +#include #include "utils.h" @@ -425,7 +426,7 @@ static Document::Ptr parse(const QString &fileName, const QByteArray &source, if (verbose) std::cout << "Parsing as " << qPrintable(parseModeToString(parseMode)) << "..."; - Document::Ptr doc = Document::create(fileName); + Document::Ptr doc = Document::create(Utils::FilePath::fromString(fileName)); doc->control()->setDiagnosticClient(errorHandler); doc->setUtf8Source(source); const bool parsed = doc->parse(parseMode); diff --git a/src/tools/cplusplus-frontend/cplusplus-frontend.cpp b/src/tools/cplusplus-frontend/cplusplus-frontend.cpp index 92a319e86aa..467bb8ffa11 100644 --- a/src/tools/cplusplus-frontend/cplusplus-frontend.cpp +++ b/src/tools/cplusplus-frontend/cplusplus-frontend.cpp @@ -14,6 +14,8 @@ #include #include +#include + #include "utils.h" #include @@ -74,7 +76,7 @@ int main(int argc, char *argv[]) const QByteArray source = file.readAll(); file.close(); - Document::Ptr doc = Document::create(fileName); + Document::Ptr doc = Document::create(Utils::FilePath::fromString(fileName)); doc->control()->setDiagnosticClient(0); doc->setUtf8Source(source); doc->parse(); diff --git a/src/tools/cplusplus-mkvisitor/cplusplus-mkvisitor.cpp b/src/tools/cplusplus-mkvisitor/cplusplus-mkvisitor.cpp index 1d1b5b1bcd2..253c85a6331 100644 --- a/src/tools/cplusplus-mkvisitor/cplusplus-mkvisitor.cpp +++ b/src/tools/cplusplus-mkvisitor/cplusplus-mkvisitor.cpp @@ -18,6 +18,8 @@ #include #include +#include + #include "utils.h" #include @@ -450,7 +452,7 @@ int main(int argc, char *argv[]) const QByteArray source = file.readAll(); file.close(); - Document::Ptr doc = Document::create(fileName); + Document::Ptr doc = Document::create(Utils::FilePath::fromString(fileName)); //doc->control()->setDiagnosticClient(0); doc->setUtf8Source(source); doc->parse(); From e3f6eca25d6899ece962c6e4c97860d5fd8f230c Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 26 Jan 2023 12:53:56 +0100 Subject: [PATCH 117/133] Utils: Move some code from QtcProcess to its only user This is not really nice/up-to-date either, but I'd rather follow up on the user side. Change-Id: I426fea3251b8984aea19788a16e574dccc3d057d Reviewed-by: Jarek Kobus --- src/libs/utils/qtcprocess.cpp | 77 ---------------------- src/libs/utils/qtcprocess.h | 7 +- src/plugins/qtsupport/externaleditors.cpp | 79 ++++++++++++++++++++++- 3 files changed, 80 insertions(+), 83 deletions(-) diff --git a/src/libs/utils/qtcprocess.cpp b/src/libs/utils/qtcprocess.cpp index 25e40fad26a..547e03e3c2b 100644 --- a/src/libs/utils/qtcprocess.cpp +++ b/src/libs/utils/qtcprocess.cpp @@ -1348,83 +1348,6 @@ QString QtcProcess::errorString() const // Path utilities -// Locate a binary in a directory, applying all kinds of -// extensions the operating system supports. -static QString checkBinary(const QDir &dir, const QString &binary) -{ - // naive UNIX approach - const QFileInfo info(dir.filePath(binary)); - if (info.isFile() && info.isExecutable()) - return info.absoluteFilePath(); - - // Does the OS have some weird extension concept or does the - // binary have a 3 letter extension? - if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost()) - return {}; - const int dotIndex = binary.lastIndexOf(QLatin1Char('.')); - if (dotIndex != -1 && dotIndex == binary.size() - 4) - return {}; - - switch (HostOsInfo::hostOs()) { - case OsTypeLinux: - case OsTypeOtherUnix: - case OsTypeOther: - break; - case OsTypeWindows: { - static const char *windowsExtensions[] = {".cmd", ".bat", ".exe", ".com"}; - // Check the Windows extensions using the order - const int windowsExtensionCount = sizeof(windowsExtensions)/sizeof(const char*); - for (int e = 0; e < windowsExtensionCount; e ++) { - const QFileInfo windowsBinary(dir.filePath(binary + QLatin1String(windowsExtensions[e]))); - if (windowsBinary.isFile() && windowsBinary.isExecutable()) - return windowsBinary.absoluteFilePath(); - } - } - break; - case OsTypeMac: { - // Check for Mac app folders - const QFileInfo appFolder(dir.filePath(binary + QLatin1String(".app"))); - if (appFolder.isDir()) { - QString macBinaryPath = appFolder.absoluteFilePath(); - macBinaryPath += QLatin1String("/Contents/MacOS/"); - macBinaryPath += binary; - const QFileInfo macBinary(macBinaryPath); - if (macBinary.isFile() && macBinary.isExecutable()) - return macBinary.absoluteFilePath(); - } - } - break; - } - return {}; -} - -QString QtcProcess::locateBinary(const QString &path, const QString &binary) -{ - // Absolute file? - const QFileInfo absInfo(binary); - if (absInfo.isAbsolute()) - return checkBinary(absInfo.dir(), absInfo.fileName()); - - // Windows finds binaries in the current directory - if (HostOsInfo::isWindowsHost()) { - const QString currentDirBinary = checkBinary(QDir::current(), binary); - if (!currentDirBinary.isEmpty()) - return currentDirBinary; - } - - const QStringList paths = path.split(HostOsInfo::pathListSeparator()); - if (paths.empty()) - return {}; - const QStringList::const_iterator cend = paths.constEnd(); - for (QStringList::const_iterator it = paths.constBegin(); it != cend; ++it) { - const QDir dir(*it); - const QString rc = checkBinary(dir, binary); - if (!rc.isEmpty()) - return rc; - } - return {}; -} - Environment QtcProcess::systemEnvironmentForBinary(const FilePath &filePath) { if (filePath.needsDevice()) { diff --git a/src/libs/utils/qtcprocess.h b/src/libs/utils/qtcprocess.h index ae99bd666c2..0451c0cd046 100644 --- a/src/libs/utils/qtcprocess.h +++ b/src/libs/utils/qtcprocess.h @@ -127,11 +127,8 @@ public: // These (or some of them) may be potentially moved outside of the class. // For some we may aggregate in another public utils class (or subclass of QtcProcess)? - // TODO: How below 2 methods relate to QtcProcess? - // Action: move/merge them somewhere else, FilePath::searchInPath() ? - // Helpers to find binaries. Do not use it for other path variables - // and file types. - static QString locateBinary(const QString &path, const QString &binary); + // TODO: How below method relates to QtcProcess? + // Action: move/merge it somewhere else static QString normalizeNewlines(const QString &text); // TODO: Unused currently? Should it serve as a compartment for contrary of remoteEnvironment? diff --git a/src/plugins/qtsupport/externaleditors.cpp b/src/plugins/qtsupport/externaleditors.cpp index 001e017ea1d..afff6a0b77f 100644 --- a/src/plugins/qtsupport/externaleditors.cpp +++ b/src/plugins/qtsupport/externaleditors.cpp @@ -39,6 +39,83 @@ struct Tr { Q_DECLARE_TR_FUNCTIONS(::QmakeProjectManager) }; +// Locate a binary in a directory, applying all kinds of +// extensions the operating system supports. +static QString checkBinary(const QDir &dir, const QString &binary) +{ + // naive UNIX approach + const QFileInfo info(dir.filePath(binary)); + if (info.isFile() && info.isExecutable()) + return info.absoluteFilePath(); + + // Does the OS have some weird extension concept or does the + // binary have a 3 letter extension? + if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost()) + return {}; + const int dotIndex = binary.lastIndexOf(QLatin1Char('.')); + if (dotIndex != -1 && dotIndex == binary.size() - 4) + return {}; + + switch (HostOsInfo::hostOs()) { + case OsTypeLinux: + case OsTypeOtherUnix: + case OsTypeOther: + break; + case OsTypeWindows: { + static const char *windowsExtensions[] = {".cmd", ".bat", ".exe", ".com"}; + // Check the Windows extensions using the order + const int windowsExtensionCount = sizeof(windowsExtensions)/sizeof(const char*); + for (int e = 0; e < windowsExtensionCount; e ++) { + const QFileInfo windowsBinary(dir.filePath(binary + QLatin1String(windowsExtensions[e]))); + if (windowsBinary.isFile() && windowsBinary.isExecutable()) + return windowsBinary.absoluteFilePath(); + } + } + break; + case OsTypeMac: { + // Check for Mac app folders + const QFileInfo appFolder(dir.filePath(binary + QLatin1String(".app"))); + if (appFolder.isDir()) { + QString macBinaryPath = appFolder.absoluteFilePath(); + macBinaryPath += QLatin1String("/Contents/MacOS/"); + macBinaryPath += binary; + const QFileInfo macBinary(macBinaryPath); + if (macBinary.isFile() && macBinary.isExecutable()) + return macBinary.absoluteFilePath(); + } + } + break; + } + return {}; +} + +static QString locateBinary(const QString &path, const QString &binary) +{ + // Absolute file? + const QFileInfo absInfo(binary); + if (absInfo.isAbsolute()) + return checkBinary(absInfo.dir(), absInfo.fileName()); + + // Windows finds binaries in the current directory + if (HostOsInfo::isWindowsHost()) { + const QString currentDirBinary = checkBinary(QDir::current(), binary); + if (!currentDirBinary.isEmpty()) + return currentDirBinary; + } + + const QStringList paths = path.split(HostOsInfo::pathListSeparator()); + if (paths.empty()) + return {}; + const QStringList::const_iterator cend = paths.constEnd(); + for (QStringList::const_iterator it = paths.constBegin(); it != cend; ++it) { + const QDir dir(*it); + const QString rc = checkBinary(dir, binary); + if (!rc.isEmpty()) + return rc; + } + return {}; +} + static QString msgStartFailed(const QString &binary, QStringList arguments) { arguments.push_front(binary); @@ -122,7 +199,7 @@ static bool getEditorLaunchData(const CommandForQtVersion &commandForQtVersion, // fallback if (data->binary.isEmpty()) { const QString path = qtcEnvironmentVariable("PATH"); - data->binary = QtcProcess::locateBinary(path, commandForQtVersion(nullptr)); + data->binary = locateBinary(path, commandForQtVersion(nullptr)); } if (data->binary.isEmpty()) { From b05ec7dc3c604a9e04a912cbb73b98c3702b5f8f Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 30 Jan 2023 09:58:37 +0200 Subject: [PATCH 118/133] AutoTest: Avoid pass by value Reported by Coverity. Change-Id: Ic0ec726ab4ec1ed96b7f4ca95a6e7dc462baeda2 Reviewed-by: Jarek Kobus Reviewed-by: Christian Stenger --- src/plugins/autotest/testresultspane.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/autotest/testresultspane.cpp b/src/plugins/autotest/testresultspane.cpp index aacd12adcff..32dd8425cbe 100644 --- a/src/plugins/autotest/testresultspane.cpp +++ b/src/plugins/autotest/testresultspane.cpp @@ -609,7 +609,7 @@ void TestResultsPane::onCustomContextMenuRequested(const QPoint &pos) QAction *action = new QAction(Tr::tr("Copy"), &menu); action->setShortcut(QKeySequence(QKeySequence::Copy)); action->setEnabled(resultsAvailable && clicked.isValid()); - connect(action, &QAction::triggered, this, [this, clicked] { + connect(action, &QAction::triggered, this, [this, &clicked] { onCopyItemTriggered(clicked); }); menu.addAction(action); @@ -627,14 +627,14 @@ void TestResultsPane::onCustomContextMenuRequested(const QPoint &pos) const auto correlatingItem = (enabled && clicked.isValid()) ? clicked.findTestTreeItem() : nullptr; action = new QAction(Tr::tr("Run This Test"), &menu); action->setEnabled(correlatingItem && correlatingItem->canProvideTestConfiguration()); - connect(action, &QAction::triggered, this, [this, clicked] { + connect(action, &QAction::triggered, this, [this, &clicked] { onRunThisTestTriggered(TestRunMode::Run, clicked); }); menu.addAction(action); action = new QAction(Tr::tr("Run This Test Without Deployment"), &menu); action->setEnabled(correlatingItem && correlatingItem->canProvideTestConfiguration()); - connect(action, &QAction::triggered, this, [this, clicked] { + connect(action, &QAction::triggered, this, [this, &clicked] { onRunThisTestTriggered(TestRunMode::RunWithoutDeploy, clicked); }); menu.addAction(action); @@ -648,14 +648,14 @@ void TestResultsPane::onCustomContextMenuRequested(const QPoint &pos) } } action->setEnabled(debugEnabled); - connect(action, &QAction::triggered, this, [this, clicked] { + connect(action, &QAction::triggered, this, [this, &clicked] { onRunThisTestTriggered(TestRunMode::Debug, clicked); }); menu.addAction(action); action = new QAction(Tr::tr("Debug This Test Without Deployment"), &menu); action->setEnabled(debugEnabled); - connect(action, &QAction::triggered, this, [this, clicked] { + connect(action, &QAction::triggered, this, [this, &clicked] { onRunThisTestTriggered(TestRunMode::DebugWithoutDeploy, clicked); }); menu.addAction(action); From 61fab0b73602f30a4ae7a2c09c7c1d1422160863 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Mon, 30 Jan 2023 11:46:32 +0100 Subject: [PATCH 119/133] Git: Fix instant blame text encoding Fixes: QTCREATORBUG-28728 Change-Id: I875488badc84b664eaa1223b37657dcb417157de Reviewed-by: David Schulz Reviewed-by: Reviewed-by: Orgad Shaneh --- src/plugins/git/gitplugin.cpp | 3 ++- src/plugins/vcsbase/vcsbaseclient.cpp | 3 ++- src/plugins/vcsbase/vcsbaseclient.h | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 62296994816..5fec91b58d6 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -1581,9 +1581,10 @@ void GitPluginPrivate::instantBlame() const CommitInfo info = parseBlameOutput(output.split('\n'), filePath, m_author); m_blameMark.reset(new BlameMark(filePath, line, info)); }; + QTextCodec *codec = GitClient::instance()->encoding(workingDirectory, "i18n.commitEncoding"); GitClient::instance()->vcsExecWithHandler(workingDirectory, {"blame", "-p", "-L", lineString, "--", filePath.toString()}, - this, commandHandler, RunFlags::NoOutput); + this, commandHandler, RunFlags::NoOutput, codec); } void GitPluginPrivate::stopInstantBlame() diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index 3ec9763f0c4..d8dc91a888e 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -157,10 +157,11 @@ void VcsBaseClientImpl::vcsExecWithHandler(const FilePath &workingDirectory, const QStringList &arguments, const QObject *context, const CommandHandler &handler, - RunFlags additionalFlags) const + RunFlags additionalFlags, QTextCodec *codec) const { VcsCommand *command = createCommand(workingDirectory); command->addFlags(additionalFlags); + command->setCodec(codec); command->addJob({vcsBinary(), arguments}, vcsTimeoutS()); if (handler) { const QObject *actualContext = context ? context : this; diff --git a/src/plugins/vcsbase/vcsbaseclient.h b/src/plugins/vcsbase/vcsbaseclient.h index 87908f1f812..6703495c37f 100644 --- a/src/plugins/vcsbase/vcsbaseclient.h +++ b/src/plugins/vcsbase/vcsbaseclient.h @@ -83,7 +83,8 @@ public: const QStringList &arguments, const QObject *context, const CommandHandler &handler, - RunFlags additionalFlags = RunFlags::None) const; + RunFlags additionalFlags = RunFlags::None, + QTextCodec *codec = nullptr) const; void vcsExec(const Utils::FilePath &workingDirectory, const QStringList &arguments, RunFlags additionalFlags = RunFlags::None) const; From 0a30b8aa26283b97431deebd0b2816bf5eb3e5af Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Mon, 30 Jan 2023 12:08:35 +0100 Subject: [PATCH 120/133] QmlProjectManager: Fix Qt Quick UI Prototype wizard Fix the path to the main.qml template. Remove all Qt version quirks, since "Qt Quick Application" project wizards are for Qt 6 from now on. Amends: 4e0b4fcc924c919a6d16d2e6096ff63c2be00cfc Fixes: QTCREATORBUG-28722 Change-Id: I338f52f215afc8591fadb12c2ad3ca58d32ec7c7 Reviewed-by: Christian Stenger --- .../projects/qtquickuiprototype/wizard.json | 73 +------------------ 1 file changed, 3 insertions(+), 70 deletions(-) diff --git a/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json index ac45450734c..150db157efc 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json @@ -9,17 +9,12 @@ "icon": "qtquickuiprototype.png", "iconKind": "Themed", "enabled": "%{JS: value('Plugins').indexOf('QmlProjectManager') >= 0}", - "featuresRequired": [ "QtSupport.Wizards.FeatureQtQuickProject", "QtSupport.Wizards.FeatureQt" ], + "featuresRequired": [ "QtSupport.Wizards.FeatureQtQuickProject", "QtSupport.Wizards.FeatureQtQuick.6" ], "options": [ { "key": "QmlProjectFileName", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qmlproject')}" }, - { "key": "IsQt6", "value": "%{JS: value('QtVersion').IsQt6}" }, { "key": "MainQmlFileName", "value": "%{JS: Util.fileName(value('ProjectName'), 'qml')}" }, - { "key": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" }, - { "key": "QtQuickWindowVersion", "value": "%{JS: value('QtVersion').QtQuickWindowVersion}" }, - { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: value('QtVersion').QtQuickVirtualKeyboardImport}" }, - { "key": "QtQuickFeature", "value": "%{JS: (value('QtQuickVersion')=='') ? 'QtSupport.Wizards.FeatureQtQuick.6' : 'QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}'}" }, { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" } ], @@ -36,68 +31,6 @@ "typeId": "Fields", "data": [ - { - "name": "QtVersion", - "trDisplayName": "Minimum required Qt version:", - "type": "ComboBox", - "data": - { - "index": 1, - "items": - [ - { - "trKey": "Qt 6", - "value": - { - "QtQuickVersion": "", - "QtQuickWindowVersion": "", - "QtQuickVirtualKeyboardImport": "", - "IsQt6": true - } - }, - { - "trKey": "Qt 5.15", - "value": - { - "QtQuickVersion": "2.15", - "QtQuickWindowVersion": "2.15", - "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.15", - "IsQt6": false - } - }, - { - "trKey": "Qt 5.14", - "value": - { - "QtQuickVersion": "2.14", - "QtQuickWindowVersion": "2.14", - "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.14", - "IsQt6": false - } - }, - { - "trKey": "Qt 5.13", - "value": - { - "QtQuickVersion": "2.13", - "QtQuickWindowVersion": "2.13", - "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4", - "IsQt6": false - } - }, - { - "trKey": "Qt 5.12", - "value": - { - "QtQuickVersion": "2.12", - "QtQuickWindowVersion": "2.12", - "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4", - "IsQt6": false - } - } - ] - } - }, { "name": "UseVirtualKeyboard", "trDisplayName": "Use Qt Virtual Keyboard", @@ -116,7 +49,7 @@ "enabled": "%{JS: ! %{IsSubproject}}", "data": { "projectFilePath": "%{QmlProjectFileName}", - "requiredFeatures": [ "QtSupport.Wizards.FeatureQt", "%{QtQuickFeature}" ] + "requiredFeatures": [ "QtSupport.Wizards.FeatureQtQuickProject", "QtSupport.Wizards.FeatureQtQuick.6" ] } }, { @@ -137,7 +70,7 @@ "openAsProject": true }, { - "source": "../qtquickapplication/empty/main.qml.tpl", + "source": "../qtquickapplication/main.qml.tpl", "target": "%{ProjectDirectory}/%{MainQmlFileName}", "openInEditor": true }, From 3c51f499ac3d6bd39a0ef8e1e8e1e8be9bd649d3 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 30 Jan 2023 09:03:36 +0100 Subject: [PATCH 121/133] Squish: Fix perspective handling We always expect a perspective mode when starting the squishserver. Fixes writing the server configuration which worked coincidentally before as it had been still in Query mode but broke when separating runner and server into own classes. Change-Id: Ia2a986fb0f10bd2b3125916d3113f850db7f156a Reviewed-by: David Schulz --- src/plugins/squish/squishperspective.cpp | 1 + src/plugins/squish/squishperspective.h | 2 +- src/plugins/squish/squishtools.cpp | 9 ++++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plugins/squish/squishperspective.cpp b/src/plugins/squish/squishperspective.cpp index 85e2aadb37e..fca93ce35db 100644 --- a/src/plugins/squish/squishperspective.cpp +++ b/src/plugins/squish/squishperspective.cpp @@ -396,6 +396,7 @@ void SquishPerspective::setPerspectiveMode(PerspectiveMode mode) m_stepOutAction->setEnabled(true); m_stopAction->setEnabled(true); break; + case Configuring: case Querying: case NoMode: m_pausePlayAction->setIcon(iconForType(IconType::Pause)); diff --git a/src/plugins/squish/squishperspective.h b/src/plugins/squish/squishperspective.h index 0ef31a790c6..1e5c4aa515f 100644 --- a/src/plugins/squish/squishperspective.h +++ b/src/plugins/squish/squishperspective.h @@ -30,7 +30,7 @@ class SquishPerspective : public Utils::Perspective { Q_OBJECT public: - enum PerspectiveMode { NoMode, Interrupted, Running, Recording, Querying }; + enum PerspectiveMode { NoMode, Interrupted, Running, Recording, Querying, Configuring }; SquishPerspective(); void initPerspective(); diff --git a/src/plugins/squish/squishtools.cpp b/src/plugins/squish/squishtools.cpp index ca4340e5ec4..b821fc034ce 100644 --- a/src/plugins/squish/squishtools.cpp +++ b/src/plugins/squish/squishtools.cpp @@ -297,6 +297,7 @@ void SquishTools::writeServerSettingsChanges(const QList &changes) return; } m_serverConfigChanges = changes; + m_perspective.setPerspectiveMode(SquishPerspective::Configuring); startSquishServer(ServerConfigChangeRequested); } @@ -363,10 +364,12 @@ void SquishTools::onServerStopped() } m_serverConfigChanges.removeFirst(); - if (!m_serverConfigChanges.isEmpty()) + if (!m_serverConfigChanges.isEmpty()) { startSquishServer(ServerConfigChangeRequested); - else - emit configChangesWritten(); + return; + } + emit configChangesWritten(); + m_perspective.setPerspectiveMode(SquishPerspective::NoMode); } else if (m_request == ServerStopRequested) { m_request = None; if (m_perspective.perspectiveMode() == SquishPerspective::Running) From 2afe3a6ff2da5daeb59f6c89c9718527ecdc0375 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 30 Jan 2023 10:34:49 +0100 Subject: [PATCH 122/133] Squish: Fix object map handling Always assume UTF8 content. Fixes unicode handling of object names. Kind of amend b55c10f189f50. Change-Id: I5259ebed6e7eb142408ee8645fed4b0ab1460d19 Reviewed-by: David Schulz --- src/plugins/squish/objectsmapdocument.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/squish/objectsmapdocument.cpp b/src/plugins/squish/objectsmapdocument.cpp index 23036dd6d72..eb7266ddc43 100644 --- a/src/plugins/squish/objectsmapdocument.cpp +++ b/src/plugins/squish/objectsmapdocument.cpp @@ -103,7 +103,7 @@ bool ObjectsMapDocument::buildObjectsMapTree(const QByteArray &contents) continue; const int tabPosition = line.indexOf(kPropertySeparator); - const QString objectName = QLatin1String(line.left(tabPosition).trimmed()); + const QString objectName = QString::fromUtf8(line.left(tabPosition).trimmed()); if (!objectName.startsWith(ObjectsMapTreeItem::COLON)) { qDeleteAll(itemForName); return false; From 7cd4c295c71c7aca2db7ef5a76272f86a51fc2ae Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 30 Jan 2023 09:45:11 +0200 Subject: [PATCH 123/133] CppEditor: Initialize member in GetterSetterRefactoringHelper Reported by Coverity. Change-Id: I0b6a1a36a33fe9b1cd81d2b314c80f42054d3d11 Reviewed-by: Christian Kandeler --- src/plugins/cppeditor/cppquickfixes.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index da2bf677f10..3dae225cea3 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -3475,7 +3475,6 @@ public: } bool hasSourceFile() const { return m_headerFile != m_sourceFile; } - bool isHeaderHeaderFile() const { return m_isHeaderHeaderFile; } protected: void insertAndIndent(const RefactoringFilePtr &file, @@ -3671,6 +3670,7 @@ protected: const CppRefactoringChanges m_changes; const InsertionPointLocator m_locator; const CppRefactoringFilePtr m_headerFile; + bool m_isHeaderHeaderFile = false; // the "header" (where the class is defined) can be a source file const CppRefactoringFilePtr m_sourceFile; CppQuickFixSettings *const m_settings = CppQuickFixProjectsSettings::getQuickFixSettings( ProjectExplorer::ProjectTree::currentProject()); @@ -3683,7 +3683,6 @@ private: InsertionLocation m_sourceFileInsertionPoint; QString m_sourceFileCode; QMap m_headerFileCode; - bool m_isHeaderHeaderFile; // the "header" (where the class is defined) can be a source file }; class GenerateGetterSetterOp : public CppQuickFixOperation @@ -9018,7 +9017,7 @@ private: addSourceFileCode(implCode); } else if (constructorLocation == CppQuickFixSettings::FunctionLocation::OutsideClass) { - if (isHeaderHeaderFile()) + if (m_isHeaderHeaderFile) implCode.prepend("inline "); insertAndIndent(m_headerFile, implLoc, implCode); } From 86ffc29239ec891e307b2c5865ce56c53841e388 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Mon, 30 Jan 2023 13:52:30 +0100 Subject: [PATCH 124/133] Git: Avoid passing strings to resolve text encodings Therefore, merge the code of codecFor() and encoding() to avoid further mis-usage. Change-Id: I086e4ace6c791d16f43f14c423b6529ad199c456 Reviewed-by: Orgad Shaneh --- src/plugins/git/gitclient.cpp | 50 +++++++++++++++++++---------------- src/plugins/git/gitclient.h | 8 +++--- src/plugins/git/giteditor.cpp | 3 +-- src/plugins/git/gitplugin.cpp | 2 +- 4 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 932dde44406..395ce703eca 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -322,7 +322,7 @@ ShowController::ShowController(IDocument *document, const QString &id) }; const auto setupDescription = [this, id](QtcProcess &process) { - process.setCodec(m_instance->encoding(workingDirectory(), "i18n.commitEncoding")); + process.setCodec(m_instance->encoding(GitClient::EncodingCommit, workingDirectory())); setupCommand(process, {"show", "-s", noColorOption, showFormatC, id}); VcsOutputWindow::appendCommand(process.workingDirectory(), process.commandLine()); setDescription(Tr::tr("Waiting for data...")); @@ -821,13 +821,27 @@ FilePaths GitClient::unmanagedFiles(const FilePaths &filePaths) const return res; } -QTextCodec *GitClient::codecFor(GitClient::CodecType codecType, const FilePath &source) const +QTextCodec *GitClient::encoding(GitClient::EncodingType encodingType, const FilePath &source) const { - if (codecType == CodecSource) - return source.isFile() ? VcsBaseEditor::getCodec(source) : encoding(source, "gui.encoding"); - if (codecType == CodecLogOutput) - return encoding(source, "i18n.logOutputEncoding"); - return nullptr; + auto codec = [this](const FilePath &workingDirectory, const QString &configVar) { + const QString codecName = readConfigValue(workingDirectory, configVar).trimmed(); + // Set default commit encoding to 'UTF-8', when it's not set, + // to solve displaying error of commit log with non-latin characters. + if (codecName.isEmpty()) + return QTextCodec::codecForName("UTF-8"); + return QTextCodec::codecForName(codecName.toUtf8()); + }; + + switch (encodingType) { + case EncodingSource: + return source.isFile() ? VcsBaseEditor::getCodec(source) : codec(source, "gui.encoding"); + case EncodingLogOutput: + return codec(source, "i18n.logOutputEncoding"); + case EncodingCommit: + return codec(source, "i18n.commitEncoding"); + default: + return nullptr; + } } void GitClient::chunkActionsRequested(DiffEditor::DiffEditorController *controller, @@ -1057,7 +1071,7 @@ void GitClient::log(const FilePath &workingDirectory, const QString &fileName, const FilePath sourceFile = VcsBaseEditor::getSource(workingDir, fileName); GitEditorWidget *editor = static_cast( createVcsEditor(editorId, title, sourceFile, - codecFor(CodecLogOutput), "logTitle", msgArg)); + encoding(EncodingLogOutput), "logTitle", msgArg)); VcsBaseEditorConfig *argWidget = editor->editorConfig(); if (!argWidget) { argWidget = new GitLogArgumentsWidget(settings(), !fileName.isEmpty(), editor); @@ -1112,7 +1126,7 @@ void GitClient::reflog(const FilePath &workingDirectory, const QString &ref) // Creating document might change the referenced workingDirectory. Store a copy and use it. const FilePath workingDir = workingDirectory; GitEditorWidget *editor = static_cast( - createVcsEditor(editorId, title, workingDir, codecFor(CodecLogOutput), + createVcsEditor(editorId, title, workingDir, encoding(EncodingLogOutput), "reflogRepository", workingDir.toString())); VcsBaseEditorConfig *argWidget = editor->editorConfig(); if (!argWidget) { @@ -1225,7 +1239,7 @@ void GitClient::annotate(const Utils::FilePath &workingDir, const QString &file, const FilePath sourceFile = VcsBaseEditor::getSource(workingDir, file); VcsBaseEditorWidget *editor = createVcsEditor(editorId, title, sourceFile, - codecFor(CodecSource, sourceFile), "blameFileName", id); + encoding(EncodingSource, sourceFile), "blameFileName", id); VcsBaseEditorConfig *argWidget = editor->editorConfig(); if (!argWidget) { argWidget = new GitBlameArgumentsWidget(settings(), editor->toolBar()); @@ -1403,7 +1417,7 @@ bool GitClient::synchronousLog(const FilePath &workingDirectory, const QStringLi allArguments.append(arguments); const CommandResult result = vcsSynchronousExec(workingDirectory, allArguments, flags, - vcsTimeoutS(), encoding(workingDirectory, "i18n.logOutputEncoding")); + vcsTimeoutS(), encoding(EncodingLogOutput, workingDirectory)); if (result.result() == ProcessResult::FinishedWithSuccess) { *output = result.cleanedStdOut(); return true; @@ -2566,16 +2580,6 @@ FilePath GitClient::vcsBinary() const return binary; } -QTextCodec *GitClient::encoding(const FilePath &workingDirectory, const QString &configVar) const -{ - const QString codecName = readConfigValue(workingDirectory, configVar).trimmed(); - // Set default commit encoding to 'UTF-8', when it's not set, - // to solve displaying error of commit log with non-latin characters. - if (codecName.isEmpty()) - return QTextCodec::codecForName("UTF-8"); - return QTextCodec::codecForName(codecName.toUtf8()); -} - // returns first line from log and removes it static QByteArray shiftLogLine(QByteArray &logText) { @@ -2709,7 +2713,7 @@ bool GitClient::getCommitData(const FilePath &workingDirectory, } } - commitData.commitEncoding = encoding(workingDirectory, "i18n.commitEncoding"); + commitData.commitEncoding = encoding(EncodingCommit, workingDirectory); // Get the commit template or the last commit message switch (commitData.commitType) { @@ -3124,7 +3128,7 @@ void GitClient::subversionLog(const FilePath &workingDirectory) const const QString title = Tr::tr("Git SVN Log"); const Id editorId = Git::Constants::GIT_SVN_LOG_EDITOR_ID; const FilePath sourceFile = VcsBaseEditor::getSource(workingDirectory, QStringList()); - VcsBaseEditorWidget *editor = createVcsEditor(editorId, title, sourceFile, codecFor(CodecNone), + VcsBaseEditorWidget *editor = createVcsEditor(editorId, title, sourceFile, encoding(EncodingDefault), "svnLog", sourceFile.toString()); editor->setWorkingDirectory(workingDirectory); vcsExecWithEditor(workingDirectory, arguments, editor); diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index 51f07f9b759..2dfd6ddaaa1 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -284,7 +284,6 @@ public: void setConfigValue(const Utils::FilePath &workingDirectory, const QString &configVar, const QString &value) const; - QTextCodec *encoding(const Utils::FilePath &workingDirectory, const QString &configVar) const; bool readDataFromCommit(const Utils::FilePath &repoDirectory, const QString &commit, CommitData &commitData, QString *errorMessage = nullptr, QString *commitTemplate = nullptr); @@ -345,6 +344,10 @@ public: const Utils::FilePath &path, ShowEditor showSetting = ShowEditor::Always); Author getAuthor(const Utils::FilePath &workingDirectory); + + enum EncodingType { EncodingSource, EncodingLogOutput, EncodingCommit, EncodingDefault }; + QTextCodec *encoding(EncodingType encodingType, const Utils::FilePath &source = {}) const; + private: void finishSubmoduleUpdate(); void chunkActionsRequested(DiffEditor::DiffEditorController *controller, @@ -354,9 +357,6 @@ private: void stage(DiffEditor::DiffEditorController *diffController, const QString &patch, bool revert) const; - enum CodecType { CodecSource, CodecLogOutput, CodecNone }; - QTextCodec *codecFor(CodecType codecType, const Utils::FilePath &source = {}) const; - void requestReload(const QString &documentId, const Utils::FilePath &source, const QString &title, const Utils::FilePath &workingDirectory, std::function factory) const; diff --git a/src/plugins/git/giteditor.cpp b/src/plugins/git/giteditor.cpp index b0793461319..7f73842cb02 100644 --- a/src/plugins/git/giteditor.cpp +++ b/src/plugins/git/giteditor.cpp @@ -274,8 +274,7 @@ void GitEditorWidget::aboutToOpen(const FilePath &filePath, const FilePath &real || editorId == Git::Constants::GIT_REBASE_EDITOR_ID) { const FilePath gitPath = filePath.absolutePath(); setSource(gitPath); - textDocument()->setCodec( - GitClient::instance()->encoding(gitPath, "i18n.commitEncoding")); + textDocument()->setCodec(GitClient::instance()->encoding(GitClient::EncodingCommit, gitPath)); } } diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 5fec91b58d6..25c7febadb1 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -1581,7 +1581,7 @@ void GitPluginPrivate::instantBlame() const CommitInfo info = parseBlameOutput(output.split('\n'), filePath, m_author); m_blameMark.reset(new BlameMark(filePath, line, info)); }; - QTextCodec *codec = GitClient::instance()->encoding(workingDirectory, "i18n.commitEncoding"); + QTextCodec *codec = GitClient::instance()->encoding(GitClient::EncodingCommit, workingDirectory); GitClient::instance()->vcsExecWithHandler(workingDirectory, {"blame", "-p", "-L", lineString, "--", filePath.toString()}, this, commandHandler, RunFlags::NoOutput, codec); From fa2ea6fd97c9e34b317f71550388c3f97aa18601 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Mon, 30 Jan 2023 11:12:10 +0100 Subject: [PATCH 125/133] QtQuickApplication template: Support more modern API (Re)add a way to select the minimum supported Qt version. If it is >= 6.4, connect to QQmlApplicationEngine::objectCreationFailed instead of objectCreated, getting rid of the status check. Moreover, if we have Qt >= 6.4, also use qt_standard_project_setup instead of manually enabling AUTOMOC. That is available since 6.3, but no need to clutter the version selection list with too many entries. If only 6.5 or higher is required, put the QML files under AUTO_RESOURCE_PREFIX, and use loadFromModule instead of load. Unconditionally rename main.qml to Main.qml, which is necessary for loadFromModule to work, and making this conditional on the used Qt version is more trouble than it is worth. For qbs, we do not yet put the files under the auto resource prefix, so do not use loadFromModule there. Fixes: QTBUG-47996 Change-Id: Ib8ca375c2316b58eecf54009d36fc9f7dac7c1f4 Reviewed-by: Reviewed-by: Alessandro Portale --- .../projects/qtquickapplication/CMakeLists.txt | 16 ++++++++++++++-- .../{main.qml.tpl => Main.qml.tpl} | 0 .../projects/qtquickapplication/main.cpp | 14 +++++++++++++- .../projects/qtquickapplication/tmpl.qbs | 2 +- .../projects/qtquickapplication/wizard.json | 18 ++++++++++++++++-- 5 files changed, 44 insertions(+), 6 deletions(-) rename share/qtcreator/templates/wizards/projects/qtquickapplication/{main.qml.tpl => Main.qml.tpl} (100%) diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt index d5725099e15..63e2498dff2 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt @@ -2,10 +2,22 @@ cmake_minimum_required(VERSION 3.16) project(%{ProjectName} VERSION 0.1 LANGUAGES CXX) +@if !%{HasQSPSetup} set(CMAKE_AUTOMOC ON) +@endif set(CMAKE_CXX_STANDARD_REQUIRED ON) -find_package(Qt6 6.2 REQUIRED COMPONENTS Quick) +find_package(Qt6 %{MinimumSupportedQtVersion} REQUIRED COMPONENTS Quick) + +@if %{HasQSPSetup} +@if %{UsesAutoResourcePrefix} +qt_standard_project_setup( + MIN_VERSION 6.5 +) +@else +qt_standard_project_setup() +@endif +@endif qt_add_executable(%{TargetName} main.cpp @@ -14,7 +26,7 @@ qt_add_executable(%{TargetName} qt_add_qml_module(%{TargetName} URI %{ProjectName} VERSION 1.0 - QML_FILES main.qml + QML_FILES Main.qml ) set_target_properties(%{TargetName} PROPERTIES diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/main.qml.tpl b/share/qtcreator/templates/wizards/projects/qtquickapplication/Main.qml.tpl similarity index 100% rename from share/qtcreator/templates/wizards/projects/qtquickapplication/main.qml.tpl rename to share/qtcreator/templates/wizards/projects/qtquickapplication/Main.qml.tpl diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/main.cpp b/share/qtcreator/templates/wizards/projects/qtquickapplication/main.cpp index bdfd80e1c35..155667fb122 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/main.cpp +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/main.cpp @@ -10,13 +10,25 @@ int main(int argc, char *argv[]) QGuiApplication app(argc, argv); QQmlApplicationEngine engine; - const QUrl url(u"qrc:/%{JS: value('ProjectName')}/main.qml"_qs); +@if !%{HasLoadFromModule} + const QUrl url(u"qrc:/%{JS: value('ProjectName')}/Main.qml"_qs); +@endif +@if %{HasFailureSignal} + QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed, + &app, []() { QCoreApplication::exit(-1); }, + Qt::QueuedConnection); +@else QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) { if (!obj && url == objUrl) QCoreApplication::exit(-1); }, Qt::QueuedConnection); +@endif +@if %{HasLoadFromModule} + engine.loadFromModule("%{JS: value('ProjectName')}", "Main"); +@else engine.load(url); +@endif return app.exec(); } diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/tmpl.qbs b/share/qtcreator/templates/wizards/projects/qtquickapplication/tmpl.qbs index 3c5b8127cc9..050ace84150 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/tmpl.qbs +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/tmpl.qbs @@ -16,6 +16,6 @@ CppApplication { Group { Qt.core.resourcePrefix: "%{ProjectName}/" fileTags: ["qt.qml.qml", "qt.core.resource_data"] - files: ["main.qml"] + files: ["Main.qml"] } } diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/wizard.json index 885a8487e31..88d63e19f9a 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/wizard.json @@ -17,6 +17,10 @@ { "key": "MainCppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src') }" }, { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0 }" }, { "key": "TargetName", "value": "%{JS: 'app' + value('ProjectName') }" }, + { "key": "HasQSPSetup", "value": "%{JS: value('MinimumSupportedQtVersion') > '6.2' }"}, + { "key": "HasFailureSignal", "value": "%{JS: value('MinimumSupportedQtVersion') > '6.3' }"}, + { "key": "UsesAutoResourcePrefix", "value": "%{JS: value('MinimumSupportedQtVersion') > '6.4' && value('BuildSystem') === 'cmake' }"}, + { "key": "HasLoadFromModule", "value": "%{JS: value('MinimumSupportedQtVersion') > '6.4' && value('UsesAutoResourcePrefix') }"}, { "key": "QdsWizardPath", "value": "%{IDE:ResourcePath}/qmldesigner/studio_templates/projects" }, { "key": "QdsProjectStyle", "value": "%{JS: value('BuildSystem') === 'cmake' ? %{QdsProjectStyleInput} : false }" }, { "key": "NoQdsProjectStyle", "value": "%{JS: !%{QdsProjectStyle} }" }, @@ -104,6 +108,16 @@ { "checked": "%{UseVirtualKeyboardByDefault}" } + }, + { + "name": "MinimumSupportedQtVersion", + "trDisplayName": "The minimum version of Qt you want to build the application for", + "type": "ComboBox", + "data": + { + "items": [ "6.2", "6.4", "6.5" ], + "index": 1 + } } ] }, @@ -146,8 +160,8 @@ "condition": "%{NoQdsProjectStyle}" }, { - "source": "main.qml.tpl", - "target": "main.qml", + "source": "Main.qml.tpl", + "target": "Main.qml", "openInEditor": true, "condition": "%{NoQdsProjectStyle}" }, From 7dc1e2031f7381500292d98f9acff6e9a33cfbf4 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 30 Jan 2023 09:51:11 +0200 Subject: [PATCH 126/133] MarketPlace: Avoid needless copy Reported by Coverity. Change-Id: Ied6f7f6cd8cf295ea39ee813e38cf19585c9dcc2 Reviewed-by: Christian Stenger --- src/plugins/marketplace/productlistmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/marketplace/productlistmodel.cpp b/src/plugins/marketplace/productlistmodel.cpp index e4f7e12edce..cdfb8d79e5f 100644 --- a/src/plugins/marketplace/productlistmodel.cpp +++ b/src/plugins/marketplace/productlistmodel.cpp @@ -173,7 +173,7 @@ void SectionedProducts::onFetchSingleCollectionFinished(QNetworkReply *reply) product->handle = handle; const QJsonArray tags = obj.value("tags").toArray(); - for (auto val : tags) + for (const auto &val : tags) product->tags.append(val.toString()); const auto images = obj.value("images").toArray(); From ad5460e5f5e3806a19c79ffd0a46db4432093dab Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 30 Jan 2023 09:50:05 +0100 Subject: [PATCH 127/133] Squish: Fix cancel handling Remove canceling as state as it never had been used for real. Keep the canceled state instead of overwriting it with finished. Canceled has internally anyhow the same meaning as finished, but we need the information whether the process had been canceled or not to handle secondary runners like the recorder correctly. Fixes canceling a run or a record. Change-Id: I20ff6bc1b1d0b969c19940f763411e26149b3d16 Reviewed-by: David Schulz --- src/plugins/squish/squishconstants.h | 3 +-- src/plugins/squish/squishrunnerprocess.cpp | 1 - src/plugins/squish/squishrunnerprocess.h | 2 +- src/plugins/squish/squishtools.cpp | 20 ++++++++++---------- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/plugins/squish/squishconstants.h b/src/plugins/squish/squishconstants.h index 45d35c27b49..cd495c68562 100644 --- a/src/plugins/squish/squishconstants.h +++ b/src/plugins/squish/squishconstants.h @@ -29,10 +29,9 @@ enum class RunnerState { RunRequested, Interrupted, InterruptRequested, - Canceling, - Canceled, CancelRequested, CancelRequestedWhileInterrupted, + Canceled, Finished }; diff --git a/src/plugins/squish/squishrunnerprocess.cpp b/src/plugins/squish/squishrunnerprocess.cpp index be7d3f7d75c..3fa6474e269 100644 --- a/src/plugins/squish/squishrunnerprocess.cpp +++ b/src/plugins/squish/squishrunnerprocess.cpp @@ -143,7 +143,6 @@ static QString cmdToString(SquishRunnerProcess::RunnerCommand cmd) case SquishRunnerProcess::Exit: return "exit\n"; case SquishRunnerProcess::Next: return "next\n"; case SquishRunnerProcess::PrintVariables: return "print variables\n"; - case SquishRunnerProcess::Quit: return "quit\n"; case SquishRunnerProcess::Return: return "return\n"; case SquishRunnerProcess::Step: return "step\n"; } diff --git a/src/plugins/squish/squishrunnerprocess.h b/src/plugins/squish/squishrunnerprocess.h index f3e85ca08af..b3200eb89d9 100644 --- a/src/plugins/squish/squishrunnerprocess.h +++ b/src/plugins/squish/squishrunnerprocess.h @@ -15,7 +15,7 @@ class SquishRunnerProcess : public SquishProcessBase { Q_OBJECT public: - enum RunnerCommand { Continue, EndRecord, Exit, Next, PrintVariables, Quit, Return, Step }; + enum RunnerCommand { Continue, EndRecord, Exit, Next, PrintVariables, Return, Step }; enum RunnerMode { Run, StartAut, QueryServer, Record }; enum RunnerError { InvalidSocket, MappedAutMissing }; diff --git a/src/plugins/squish/squishtools.cpp b/src/plugins/squish/squishtools.cpp index b821fc034ce..107a3c6bfab 100644 --- a/src/plugins/squish/squishtools.cpp +++ b/src/plugins/squish/squishtools.cpp @@ -50,10 +50,9 @@ static QString runnerStateName(RunnerState state) case RunnerState::RunRequested: return "RunRequested"; case RunnerState::Interrupted: return "Interrupted"; case RunnerState::InterruptRequested: return "InterruptedRequested"; - case RunnerState::Canceling: return "Canceling"; - case RunnerState::Canceled: return "Canceled"; case RunnerState::CancelRequested: return "CancelRequested"; case RunnerState::CancelRequestedWhileInterrupted: return "CancelRequestedWhileInterrupted"; + case RunnerState::Canceled: return "Canceled"; case RunnerState::Finished: return "Finished"; } return "ThouShallNotBeHere"; @@ -606,7 +605,7 @@ void SquishTools::setupAndStartRecorder() void SquishTools::stopRecorder() { QTC_ASSERT(m_secondaryRunner && m_secondaryRunner->isRunning(), return); - if (m_squishRunnerState == RunnerState::CancelRequested) { + if (m_squishRunnerState == RunnerState::Canceled) { qCDebug(LOG) << "Stopping recorder (exit)"; m_secondaryRunner->writeCommand(SquishRunnerProcess::Exit); } else { @@ -666,7 +665,12 @@ void SquishTools::onRunnerFinished() { qCDebug(LOG) << "Runner finished"; if (!m_shutdownInitiated) { - logAndChangeRunnerState(RunnerState::Finished); + if (m_squishRunnerState == RunnerState::CancelRequested + || m_squishRunnerState == RunnerState::CancelRequestedWhileInterrupted) { + logAndChangeRunnerState(RunnerState::Canceled); + } else { + logAndChangeRunnerState(RunnerState::Finished); + } if (m_request == RunTestRequested) m_perspective.updateStatus(Tr::tr("Test run finished.")); else if (m_request == RecordTestRequested) @@ -817,8 +821,8 @@ void SquishTools::handlePrompt(const QString &fileName, int line, int column) break; case RunnerState::CancelRequested: case RunnerState::CancelRequestedWhileInterrupted: + logAndChangeRunnerState(RunnerState::Canceled); stopRecorder(); - logAndChangeRunnerState(RunnerState::Canceling); break; case RunnerState::Canceled: QTC_CHECK(false); @@ -849,13 +853,9 @@ void SquishTools::handlePrompt(const QString &fileName, int line, int column) } case RunnerState::CancelRequested: case RunnerState::CancelRequestedWhileInterrupted: + logAndChangeRunnerState(RunnerState::Canceled); m_primaryRunner->writeCommand(SquishRunnerProcess::Exit); clearLocationMarker(); - logAndChangeRunnerState(RunnerState::Canceling); - break; - case RunnerState::Canceling: - m_primaryRunner->writeCommand(SquishRunnerProcess::Quit); - logAndChangeRunnerState(RunnerState::Canceled); break; case RunnerState::Canceled: QTC_CHECK(false); From 97002f934fa0b97711aea91f54e1aa45af15d123 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 31 Jan 2023 09:09:34 +0100 Subject: [PATCH 128/133] QmlProjectManager: Fix the "Qt Quick UI Prototype" wizard The wizard uses the the same main.qml.tpl template as the "Qt Quick Application" wizard. That file was renamed to Main.qml.tpl. Change-Id: I7978cd2a09da7aa70a75f9cc5cb6e7b6dcdff058 Reviewed-by: Fabian Kosmale --- .../templates/wizards/projects/qtquickuiprototype/wizard.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json index 150db157efc..aba8309365b 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json @@ -70,7 +70,7 @@ "openAsProject": true }, { - "source": "../qtquickapplication/main.qml.tpl", + "source": "../qtquickapplication/Main.qml.tpl", "target": "%{ProjectDirectory}/%{MainQmlFileName}", "openInEditor": true }, From 50ee70fcee8ca129665039062064eec67ff7c4e9 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 27 Jan 2023 17:12:00 +0100 Subject: [PATCH 129/133] RemoteLinux: Remove AbstractRemoteLinuxDeployService::setDevice Unused now. Change-Id: I53ec97026e49435d1ca84b4f925e82c233853a8f Reviewed-by: Qt CI Bot Reviewed-by: Christian Kandeler --- src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp | 5 ----- src/plugins/remotelinux/abstractremotelinuxdeploystep.h | 3 +-- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp b/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp index 270b95eb229..7e7e3d9a19a 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp +++ b/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp @@ -96,11 +96,6 @@ void AbstractRemoteLinuxDeployService::setTarget(Target *target) d->deviceConfiguration = DeviceKitAspect::device(kit()); } -void AbstractRemoteLinuxDeployService::setDevice(const IDevice::ConstPtr &device) -{ - d->deviceConfiguration = device; -} - void AbstractRemoteLinuxDeployService::start() { QTC_ASSERT(!d->m_taskTree, return); diff --git a/src/plugins/remotelinux/abstractremotelinuxdeploystep.h b/src/plugins/remotelinux/abstractremotelinuxdeploystep.h index 258d4b9e7f9..67855064bb0 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeploystep.h +++ b/src/plugins/remotelinux/abstractremotelinuxdeploystep.h @@ -83,8 +83,7 @@ public: ~AbstractRemoteLinuxDeployService() override; void setTarget(ProjectExplorer::Target *bc); - // Only use setDevice() as fallback if no target is available - void setDevice(const ProjectExplorer::IDeviceConstPtr &device); + void start(); void stop(); From e20bdfae4de90401a518135bc22958549dceda66 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 31 Jan 2023 08:11:29 +0100 Subject: [PATCH 130/133] ClangFormat: Adapt to changes in LLVM 16 Change-Id: Ia4a2cf21e351095609d8858f1f9355c6607470f3 Reviewed-by: Christian Kandeler --- src/plugins/clangformat/clangformatbaseindenter.cpp | 4 ++++ src/plugins/clangformat/clangformatutils.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/plugins/clangformat/clangformatbaseindenter.cpp b/src/plugins/clangformat/clangformatbaseindenter.cpp index d61cbf2f1a8..fc08158d2d1 100644 --- a/src/plugins/clangformat/clangformatbaseindenter.cpp +++ b/src/plugins/clangformat/clangformatbaseindenter.cpp @@ -38,7 +38,11 @@ void adjustFormatStyleForLineBreak(clang::format::FormatStyle &style, #else style.SortIncludes = false; #endif +#if LLVM_VERSION_MAJOR >= 16 + style.SortUsingDeclarations = clang::format::FormatStyle::SUD_Never; +#else style.SortUsingDeclarations = false; +#endif // This is a separate pass, don't do it unless it's the full formatting. style.FixNamespaceComments = false; diff --git a/src/plugins/clangformat/clangformatutils.cpp b/src/plugins/clangformat/clangformatutils.cpp index c7eb900fed5..d1d6bee684b 100644 --- a/src/plugins/clangformat/clangformatutils.cpp +++ b/src/plugins/clangformat/clangformatutils.cpp @@ -151,7 +151,11 @@ clang::format::FormatStyle qtcStyle() #else style.SortIncludes = true; #endif +#if LLVM_VERSION_MAJOR >= 16 + style.SortUsingDeclarations = FormatStyle::SUD_Lexicographic; +#else style.SortUsingDeclarations = true; +#endif style.SpaceAfterCStyleCast = true; style.SpaceAfterTemplateKeyword = false; style.SpaceBeforeAssignmentOperators = true; From 6c8afcde88d25ea889492d4bf0725e449fa7efc5 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 18 Jan 2023 14:23:23 +0100 Subject: [PATCH 131/133] Core: Make access to remote terminal easier in code By re-routing through device hooks. Now basically a FilePath is sufficient as a handle. Change-Id: I0ee43c35096ada12114d50476d5156a6c1de1e70 Reviewed-by: Christian Stenger --- src/libs/utils/filepath.h | 1 + src/plugins/coreplugin/coreplugin.cpp | 8 +-- .../editormanager/editormanager.cpp | 3 +- src/plugins/coreplugin/fileutils.cpp | 72 +------------------ src/plugins/coreplugin/fileutils.h | 1 - .../devicesupport/desktopdevice.cpp | 68 +++++++++++++++++- .../devicesupport/devicemanager.cpp | 6 ++ 7 files changed, 81 insertions(+), 78 deletions(-) diff --git a/src/libs/utils/filepath.h b/src/libs/utils/filepath.h index dfc4af4108a..41aaf7dcccb 100644 --- a/src/libs/utils/filepath.h +++ b/src/libs/utils/filepath.h @@ -283,6 +283,7 @@ public: std::function environment; std::function isSameDevice; std::function(const FilePath &)> localSource; + std::function openTerminal; }; } // Utils diff --git a/src/plugins/coreplugin/coreplugin.cpp b/src/plugins/coreplugin/coreplugin.cpp index e406f5b7a9a..b02a47d4f0e 100644 --- a/src/plugins/coreplugin/coreplugin.cpp +++ b/src/plugins/coreplugin/coreplugin.cpp @@ -347,19 +347,19 @@ void CorePlugin::addToPathChooserContextMenu(Utils::PathChooser *pathChooser, QM QList actions = menu->actions(); QAction *firstAction = actions.isEmpty() ? nullptr : actions.first(); - if (QDir().exists(pathChooser->filePath().toString())) { - auto *showInGraphicalShell = new QAction(Core::FileUtils::msgGraphicalShellAction(), menu); + if (pathChooser->filePath().exists()) { + auto showInGraphicalShell = new QAction(FileUtils::msgGraphicalShellAction(), menu); connect(showInGraphicalShell, &QAction::triggered, pathChooser, [pathChooser] { Core::FileUtils::showInGraphicalShell(pathChooser, pathChooser->filePath()); }); menu->insertAction(firstAction, showInGraphicalShell); - auto *showInTerminal = new QAction(Core::FileUtils::msgTerminalHereAction(), menu); + auto showInTerminal = new QAction(FileUtils::msgTerminalHereAction(), menu); connect(showInTerminal, &QAction::triggered, pathChooser, [pathChooser] { if (pathChooser->openTerminalHandler()) pathChooser->openTerminalHandler()(); else - FileUtils::openTerminal(pathChooser->filePath()); + FileUtils::openTerminal(pathChooser->filePath(), {}); }); menu->insertAction(firstAction, showInTerminal); diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 4128cbdc0d7..2953a833b70 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -2618,7 +2619,7 @@ void EditorManagerPrivate::openTerminal() { if (!d->m_contextMenuEntry || d->m_contextMenuEntry->filePath().isEmpty()) return; - FileUtils::openTerminal(d->m_contextMenuEntry->filePath().parentDir()); + FileUtils::openTerminal(d->m_contextMenuEntry->filePath().parentDir(), {}); } void EditorManagerPrivate::findInDirectory() diff --git a/src/plugins/coreplugin/fileutils.cpp b/src/plugins/coreplugin/fileutils.cpp index 3525d602a6b..05aeb219b2e 100644 --- a/src/plugins/coreplugin/fileutils.cpp +++ b/src/plugins/coreplugin/fileutils.cpp @@ -32,15 +32,6 @@ #include #include -#ifdef Q_OS_WIN - -#include -#include -#include - -#endif - - using namespace Utils; namespace Core { @@ -111,69 +102,10 @@ void FileUtils::showInFileSystemView(const FilePath &path) navWidget->syncWithFilePath(path); } -static void startTerminalEmulator(const QString &workingDir, const Environment &env) -{ -#ifdef Q_OS_WIN - STARTUPINFO si; - ZeroMemory(&si, sizeof(si)); - si.cb = sizeof(si); - - PROCESS_INFORMATION pinfo; - ZeroMemory(&pinfo, sizeof(pinfo)); - - static const auto quoteWinCommand = [](const QString &program) { - const QChar doubleQuote = QLatin1Char('"'); - - // add the program as the first arg ... it works better - QString programName = program; - programName.replace(QLatin1Char('/'), QLatin1Char('\\')); - if (!programName.startsWith(doubleQuote) && !programName.endsWith(doubleQuote) - && programName.contains(QLatin1Char(' '))) { - programName.prepend(doubleQuote); - programName.append(doubleQuote); - } - return programName; - }; - const QString cmdLine = quoteWinCommand(qtcEnvironmentVariable("COMSPEC")); - // cmdLine is assumed to be detached - - // https://blogs.msdn.microsoft.com/oldnewthing/20090601-00/?p=18083 - - const QString totalEnvironment = env.toStringList().join(QChar(QChar::Null)) + QChar(QChar::Null); - LPVOID envPtr = (env != Environment::systemEnvironment()) - ? (WCHAR *)(totalEnvironment.utf16()) : nullptr; - - const bool success = CreateProcessW(0, (WCHAR *)cmdLine.utf16(), - 0, 0, FALSE, CREATE_NEW_CONSOLE | CREATE_UNICODE_ENVIRONMENT, - envPtr, workingDir.isEmpty() ? 0 : (WCHAR *)workingDir.utf16(), - &si, &pinfo); - - if (success) { - CloseHandle(pinfo.hThread); - CloseHandle(pinfo.hProcess); - } -#else - const TerminalCommand term = TerminalCommand::terminalEmulator(); - QProcess process; - process.setProgram(term.command); - process.setArguments(ProcessArgs::splitArgs(term.openArgs)); - process.setProcessEnvironment(env.toProcessEnvironment()); - process.setWorkingDirectory(workingDir); - process.startDetached(); -#endif -} - -void FileUtils::openTerminal(const FilePath &path) -{ - openTerminal(path, Environment::systemEnvironment()); -} - void FileUtils::openTerminal(const FilePath &path, const Environment &env) { - const QFileInfo fileInfo = path.toFileInfo(); - const QString workingDir = QDir::toNativeSeparators(fileInfo.isDir() ? - fileInfo.absoluteFilePath() : - fileInfo.absolutePath()); - startTerminalEmulator(workingDir, env); + QTC_ASSERT(DeviceFileHooks::instance().openTerminal, return); + DeviceFileHooks::instance().openTerminal(path, env); } QString FileUtils::msgFindInDirectory() diff --git a/src/plugins/coreplugin/fileutils.h b/src/plugins/coreplugin/fileutils.h index f54f890d7ec..2b5c65c800d 100644 --- a/src/plugins/coreplugin/fileutils.h +++ b/src/plugins/coreplugin/fileutils.h @@ -22,7 +22,6 @@ struct CORE_EXPORT FileUtils // Helpers for common directory browser options. static void showInGraphicalShell(QWidget *parent, const Utils::FilePath &path); static void showInFileSystemView(const Utils::FilePath &path); - static void openTerminal(const Utils::FilePath &path); static void openTerminal(const Utils::FilePath &path, const Utils::Environment &env); static QString msgFindInDirectory(); static QString msgFileSystemAction(); diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp index 097f175d664..57984a6b11c 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp @@ -17,16 +17,74 @@ #include #include #include +#include #include #include #include +#ifdef Q_OS_WIN +#include +#include +#include +#endif + using namespace ProjectExplorer::Constants; using namespace Utils; namespace ProjectExplorer { +static void startTerminalEmulator(const QString &workingDir, const Environment &env) +{ +#ifdef Q_OS_WIN + STARTUPINFO si; + ZeroMemory(&si, sizeof(si)); + si.cb = sizeof(si); + + PROCESS_INFORMATION pinfo; + ZeroMemory(&pinfo, sizeof(pinfo)); + + static const auto quoteWinCommand = [](const QString &program) { + const QChar doubleQuote = QLatin1Char('"'); + + // add the program as the first arg ... it works better + QString programName = program; + programName.replace(QLatin1Char('/'), QLatin1Char('\\')); + if (!programName.startsWith(doubleQuote) && !programName.endsWith(doubleQuote) + && programName.contains(QLatin1Char(' '))) { + programName.prepend(doubleQuote); + programName.append(doubleQuote); + } + return programName; + }; + const QString cmdLine = quoteWinCommand(qtcEnvironmentVariable("COMSPEC")); + // cmdLine is assumed to be detached - + // https://blogs.msdn.microsoft.com/oldnewthing/20090601-00/?p=18083 + + const QString totalEnvironment = env.toStringList().join(QChar(QChar::Null)) + QChar(QChar::Null); + LPVOID envPtr = (env != Environment::systemEnvironment()) + ? (WCHAR *)(totalEnvironment.utf16()) : nullptr; + + const bool success = CreateProcessW(0, (WCHAR *)cmdLine.utf16(), + 0, 0, FALSE, CREATE_NEW_CONSOLE | CREATE_UNICODE_ENVIRONMENT, + envPtr, workingDir.isEmpty() ? 0 : (WCHAR *)workingDir.utf16(), + &si, &pinfo); + + if (success) { + CloseHandle(pinfo.hThread); + CloseHandle(pinfo.hProcess); + } +#else + const TerminalCommand term = TerminalCommand::terminalEmulator(); + QProcess process; + process.setProgram(term.command); + process.setArguments(ProcessArgs::splitArgs(term.openArgs)); + process.setProcessEnvironment(env.toProcessEnvironment()); + process.setWorkingDirectory(workingDir); + process.startDetached(); +#endif +} + DesktopDevice::DesktopDevice() { setFileAccess(DesktopDeviceFileAccess::instance()); @@ -43,8 +101,14 @@ DesktopDevice::DesktopDevice() const QString portRange = QString::fromLatin1("%1-%2").arg(DESKTOP_PORT_START).arg(DESKTOP_PORT_END); setFreePorts(Utils::PortList::fromString(portRange)); - setOpenTerminal([](const Environment &env, const FilePath &workingDir) { - Core::FileUtils::openTerminal(workingDir, env); + + setOpenTerminal([](const Environment &env, const FilePath &path) { + const QFileInfo fileInfo = path.toFileInfo(); + const QString workingDir = QDir::toNativeSeparators(fileInfo.isDir() ? + fileInfo.absoluteFilePath() : + fileInfo.absolutePath()); + const Environment realEnv = env.hasChanges() ? env : Environment::systemEnvironment(); + startTerminalEmulator(workingDir, realEnv); }); } diff --git a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp index e6ecfe4659b..9f8e0594fd8 100644 --- a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp @@ -436,6 +436,12 @@ DeviceManager::DeviceManager(bool isInstance) : d(std::make_uniqueensureReachable(other); }; + deviceHooks.openTerminal = [](const FilePath &filePath, const Environment &env) { + auto device = DeviceManager::deviceForPath(filePath); + QTC_ASSERT(device, return); + device->openTerminal(env, filePath); + }; + DeviceProcessHooks processHooks; processHooks.processImplHook = [](const FilePath &filePath) -> ProcessInterface * { From c5ea7560271334ab51379c96abbcebd542b6d312 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Tue, 31 Jan 2023 16:02:41 +0100 Subject: [PATCH 132/133] Doc: Integrate Fossil docs to the manual Now that the plugin has been moved to the qtcreator repository. Change-Id: Iacf6c58765a10f5ad574688dc7ad917f6a705a14 Reviewed-by: Orgad Shaneh --- doc/qtcreator/src/qtcreator-toc.qdoc | 1 + .../src/vcs/creator-only/creator-vcs-cvs.qdoc | 2 +- .../vcs/creator-only/creator-vcs-fossil.qdoc | 52 +++++-------------- .../src/vcs/creator-only/creator-vcs.qdoc | 17 +++--- doc/qtcreator/src/vcs/creator-vcs-git.qdoc | 2 +- 5 files changed, 23 insertions(+), 51 deletions(-) diff --git a/doc/qtcreator/src/qtcreator-toc.qdoc b/doc/qtcreator/src/qtcreator-toc.qdoc index 62fbde3516e..f24a85857d1 100644 --- a/doc/qtcreator/src/qtcreator-toc.qdoc +++ b/doc/qtcreator/src/qtcreator-toc.qdoc @@ -46,6 +46,7 @@ \li \l{Using Bazaar} \li \l{Using ClearCase} \li \l{Using CVS} + \li \l{Using Fossil} \li \l{Using Git} \li \l{Using GitLab} \li \l{Using Mercurial} diff --git a/doc/qtcreator/src/vcs/creator-only/creator-vcs-cvs.qdoc b/doc/qtcreator/src/vcs/creator-only/creator-vcs-cvs.qdoc index 540972e83dd..53e7fc604ed 100644 --- a/doc/qtcreator/src/vcs/creator-only/creator-vcs-cvs.qdoc +++ b/doc/qtcreator/src/vcs/creator-only/creator-vcs-cvs.qdoc @@ -10,7 +10,7 @@ /*! \previouspage creator-vcs-clearcase.html \page creator-vcs-cvs.html - \nextpage creator-vcs-git.html + \nextpage creator-vcs-fossil.html \title Using CVS diff --git a/doc/qtcreator/src/vcs/creator-only/creator-vcs-fossil.qdoc b/doc/qtcreator/src/vcs/creator-only/creator-vcs-fossil.qdoc index 87dddffc514..6148a58076b 100644 --- a/doc/qtcreator/src/vcs/creator-only/creator-vcs-fossil.qdoc +++ b/doc/qtcreator/src/vcs/creator-only/creator-vcs-fossil.qdoc @@ -1,38 +1,12 @@ -/**************************************************************************** -** -** Copyright (c) 2018 Artur Shepilko -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -// ********************************************************************** -// NOTE: the sections are not ordered by their logical order to avoid -// reshuffling the file each time the index order changes (i.e., often). -// Run the fixnavi.pl script to adjust the links to the index order. -// ********************************************************************** +// Copyright (C) 2018 Artur Shepilko +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page creator-vcs-fossil.html + \previouspage creator-vcs-cvs.html + \nextpage creator-vcs-git.html - \title Qt Creator Fossil Plugin Manual + \title Using Fossil Fossil is an open source distributed version control system, designed and developed by the creator of SQLite. A stand-alone Fossil executable @@ -52,14 +26,17 @@ \li Create or designate a directory to store local Fossil repositories and remote clones. For example: \c ~/fossils/qt. - \li Configure \uicontrol {Version Control Options} for the Fossil plugin - to use the designated directory as - \uicontrol {Local Repositories Default path}. + \li Select \uicontrol Edit > \uicontrol Preferences > + \uicontrol {Version Control} > \uicontrol Fossil, and set the + designated directory in the \uicontrol {Default path} field. \endlist - Now Fossil should become available as a VCS choice to create new local - repositories, as well as a choice in \uicontrol {New File or Project} to - clone a remote Fossil repository. + To create a local Fossil repository, select \uicontrol Tools > + \uicontrol Fossil > \uicontrol {Create Repository}. + + To clone a remote Fossil repository, select \uicontrol File > + \uicontrol {New Project} > \uicontrol {Import Project} > + \uicontrol {Fossil Clone}. \section1 Additional Fossil Functions @@ -85,5 +62,4 @@ \li \uicontrol Settings \li Configure the settings of the local repository. \endtable - */ diff --git a/doc/qtcreator/src/vcs/creator-only/creator-vcs.qdoc b/doc/qtcreator/src/vcs/creator-only/creator-vcs.qdoc index c935dfbc2d0..3631b4023a5 100644 --- a/doc/qtcreator/src/vcs/creator-only/creator-vcs.qdoc +++ b/doc/qtcreator/src/vcs/creator-only/creator-vcs.qdoc @@ -37,14 +37,12 @@ \li \l{http://www.nongnu.org/cvs/} \li \row - \li \l{https://doc.qt.io/qtcreator/creator-vcs-fossil.html}{Fossil} + \li \l{Using Fossil}{Fossil} \li \l{https://fossil-scm.org/index.html/doc/trunk/www/index.wiki} - \li To use Fossil, you need to build the Fossil plugin from - \l{https://code.qt.io/cgit/qt-creator/plugin-fossil-scm.git/} - {sources}, and install Fossil as described in - \l{https://doc.qt.io/qtcreator/creator-vcs-fossil.html} - {Qt Creator Fossil Plugin Manual}. - \row + \li Disabled by default. To enable the plugin, select + \uicontrol Help > \uicontrol {About Plugins} > + \uicontrol {Version Control} > \uicontrol Fossil. + \row \li \l{Using Git}{Git} \li \l{http://git-scm.com/} \li Git version 1.9.0, or later @@ -66,8 +64,6 @@ Disabled by default. To enable the plugin, select \uicontrol Help > \uicontrol {About Plugins} > \uicontrol {Version Control} > \uicontrol Perforce. - Then select \uicontrol {Restart Now} to restart \QC - and load the plugin. \row \li \l{Using Subversion}{Subversion} \li \l{http://subversion.apache.org/} @@ -103,8 +99,7 @@ \li \l{Using Bazaar} \li \l{Using ClearCase} \li \l{Using CVS} - \li \l{https://doc.qt.io/qtcreator/creator-vcs-fossil.html} - {Qt Creator Fossil Plugin Manual} + \li \l{Using Fossil} \li \l{Using Git} \li \l{Using GitLab} \li \l{Using Mercurial} diff --git a/doc/qtcreator/src/vcs/creator-vcs-git.qdoc b/doc/qtcreator/src/vcs/creator-vcs-git.qdoc index 21da4da3f04..1acf233eb0b 100644 --- a/doc/qtcreator/src/vcs/creator-vcs-git.qdoc +++ b/doc/qtcreator/src/vcs/creator-vcs-git.qdoc @@ -13,7 +13,7 @@ \previouspage studio-developer-topics.html \nextpage studio-porting-projects.html \else - \previouspage creator-vcs-cvs.html + \previouspage creator-vcs-fossil.html \nextpage creator-vcs-gitlab.html \endif From 4bfdfc2fbc535f3ca7508a7a7c95356b8c528d08 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 30 Jan 2023 09:46:20 +0200 Subject: [PATCH 133/133] ProjectExplorer: Fix potential division by zero Reported by Coverity. Change-Id: Ie11625afc862bd7918d5b9bffd73e6726adaac0f Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/abstractprocessstep.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/abstractprocessstep.cpp b/src/plugins/projectexplorer/abstractprocessstep.cpp index 08d58117c68..c838458aa5d 100644 --- a/src/plugins/projectexplorer/abstractprocessstep.cpp +++ b/src/plugins/projectexplorer/abstractprocessstep.cpp @@ -246,7 +246,7 @@ void AbstractProcessStep::runTaskTree(const Tasking::Group &recipe) d->m_taskTree.reset(new TaskTree(recipe)); connect(d->m_taskTree.get(), &TaskTree::progressValueChanged, this, [this](int value) { - emit progress(qRound(double(value) * 100 / d->m_taskTree->progressMaximum()), {}); + emit progress(qRound(double(value) * 100 / std::max(d->m_taskTree->progressMaximum(), 1)), {}); }); connect(d->m_taskTree.get(), &TaskTree::done, this, [this] { emit finished(true);