Fossil: Import from super repo

git-subtree-dir: src
git-subtree-mainline: e20bdfae4d
git-subtree-split: c8b9e4504e

Change-Id: Id0c0ed8c57739cba2b0a7431f40f8c07fcab493d
This commit is contained in:
Orgad Shaneh
2023-01-31 10:15:32 +02:00
37 changed files with 5290 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
/****************************************************************************
**
** 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.
// **********************************************************************
/*!
\page creator-vcs-fossil.html
\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
contains a source control management engine, web interface, issue tracker,
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 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 Version Control Systems}, 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
*/

View File

@@ -45,6 +45,7 @@ add_subdirectory(cvs)
add_subdirectory(designer)
add_subdirectory(docker)
add_subdirectory(fakevim)
add_subdirectory(fossil)
add_subdirectory(genericprojectmanager)
add_subdirectory(git)
add_subdirectory(mercurial)

View File

@@ -0,0 +1,22 @@
add_qtc_plugin(Fossil
PLUGIN_DEPENDS
Core TextEditor ProjectExplorer VcsBase
SOURCES
annotationhighlighter.cpp annotationhighlighter.h
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
fossileditor.cpp fossileditor.h
fossilplugin.cpp fossilplugin.h
fossilsettings.cpp fossilsettings.h
pullorpushdialog.cpp pullorpushdialog.h pullorpushdialog.ui
revertdialog.ui
revisioninfo.h
wizard/fossiljsextension.cpp wizard/fossiljsextension.h
)

View File

@@ -0,0 +1,20 @@
{
\"Name\" : \"Fossil\",
\"Version\" : \"$$QTCREATOR_VERSION\",
\"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\",
\"DisabledByDefault\" : true,
\"Vendor\" : \"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.\",
\"\",
\"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
}

View File

@@ -0,0 +1,51 @@
/****************************************************************************
**
** 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 "annotationhighlighter.h"
#include "constants.h"
#include <utils/qtcassert.h>
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 {};
}
} // namespace Internal
} // namespace Fossil

View File

@@ -0,0 +1,46 @@
/****************************************************************************
**
** 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 <vcsbase/baseannotationhighlighter.h>
#include <QRegularExpression>
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

View File

@@ -0,0 +1,52 @@
/****************************************************************************
**
** 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 <QString>
namespace Fossil {
namespace Internal {
class BranchInfo
{
public:
enum BranchFlag {
Current = 0x01,
Closed = 0x02,
Private = 0x04
};
Q_DECLARE_FLAGS(BranchFlags, BranchFlag)
bool isCurrent() const { return flags.testFlag(Current); }
QString name;
BranchFlags flags;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(BranchInfo::BranchFlags)
} // namespace Internal
} // namespace Fossil

View File

@@ -0,0 +1,88 @@
/****************************************************************************
**
** 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"
#include "commiteditor.h"
#include "constants.h"
#include "fossilcommitwidget.h"
#include <coreplugin/idocument.h>
#include <vcsbase/submitfilemodel.h>
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
namespace Fossil {
namespace Internal {
CommitEditor::CommitEditor() :
VcsBase::VcsBaseSubmitEditor(new FossilCommitWidget)
{
document()->setPreferredDisplayName(tr("Commit Editor"));
}
FossilCommitWidget *CommitEditor::commitWidget()
{
return static_cast<FossilCommitWidget *>(widget());
}
void CommitEditor::setFields(const Utils::FilePath &repositoryRoot, const BranchInfo &branch,
const QStringList &tags, const QString &userName,
const QList<VcsBase::VcsBaseClient::StatusItem> &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 &) {
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<VcsBase::VcsBaseClient::StatusItem> 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

View File

@@ -0,0 +1,57 @@
/****************************************************************************
**
** 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 <vcsbase/vcsbaseclient.h>
#include <vcsbase/vcsbasesubmiteditor.h>
namespace VcsBase { class SubmitFileModel; }
namespace Fossil {
namespace Internal {
class BranchInfo;
class FossilCommitWidget;
class CommitEditor : public VcsBase::VcsBaseSubmitEditor
{
Q_OBJECT
public:
CommitEditor();
void setFields(const Utils::FilePath &repositoryRoot, const BranchInfo &branch,
const QStringList &tags, const QString &userName,
const QList<VcsBase::VcsBaseClient::StatusItem> &repoStatus);
FossilCommitWidget *commitWidget();
private:
VcsBase::SubmitFileModel *m_fileModel = nullptr;
};
} // namespace Internal
} // namespace Fossil

View File

@@ -0,0 +1,98 @@
/****************************************************************************
**
** 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 "configuredialog.h"
#include "ui_configuredialog.h"
#include "fossilsettings.h"
#include <utils/pathchooser.h>
#include <QDir>
namespace Fossil {
namespace Internal {
class ConfigureDialogPrivate {
public:
RepositorySettings settings() const
{
return {m_ui.userLineEdit->text().trimmed(),
m_ui.sslIdentityFilePathChooser->filePath().toString(),
m_ui.disableAutosyncCheckBox->isChecked()
? RepositorySettings::AutosyncOff : RepositorySettings::AutosyncOn};
}
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

View File

@@ -0,0 +1,55 @@
/****************************************************************************
**
** 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 <QDialog>
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

View File

@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Fossil::Internal::ConfigureDialog</class>
<widget class="QDialog" name="Fossil::Internal::ConfigureDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>385</width>
<height>202</height>
</rect>
</property>
<property name="windowTitle">
<string>Configure Repository</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="repoUserGroupBox">
<property name="title">
<string>Repository User</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="userLabel">
<property name="text">
<string>User:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="userLineEdit">
<property name="toolTip">
<string>Existing user to become an author of changes made to the repository.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="repoSettingsGroupBox">
<property name="title">
<string>Repository Settings</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="sslIdentityFileLabel">
<property name="text">
<string>SSL/TLS identity:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="sslIdentityFilePathChooser" native="true">
<property name="toolTip">
<string>SSL/TLS client identity key to use if requested by the server.</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="disableAutosyncCheckBox">
<property name="toolTip">
<string>Disable automatic pull prior to commit or update and automatic push after commit or tag or branch creation.</string>
</property>
<property name="text">
<string>Disable auto-sync</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
<slots>
<signal>editingFinished()</signal>
<signal>browsingFinished()</signal>
</slots>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Fossil::Internal::ConfigureDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Fossil::Internal::ConfigureDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -0,0 +1,111 @@
/****************************************************************************
**
** 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 <QtGlobal>
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";
// 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

View File

@@ -0,0 +1,39 @@
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",
"fossilplugin.cpp", "fossilplugin.h",
"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.h",
"configuredialog.cpp", "configuredialog.h", "configuredialog.ui",
"revisioninfo.h",
"fossil.qrc",
"revertdialog.ui",
"fossilcommitpanel.ui",
]
Group {
name: "Wizards"
prefix: "wizard/"
files: [
"fossiljsextension.h", "fossiljsextension.cpp",
]
}
}

View File

@@ -0,0 +1,7 @@
<RCC>
<qresource prefix="/fossil">
<file>wizard/projects/vcs/icon.png</file>
<file>wizard/projects/vcs/icon@2x.png</file>
<file>wizard/projects/vcs/wizard.json</file>
</qresource>
</RCC>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,138 @@
/****************************************************************************
**
** 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 "fossilsettings.h"
#include "branchinfo.h"
#include "revisioninfo.h"
#include <vcsbase/vcsbaseclient.h>
#include <QList>
namespace Fossil {
namespace Internal {
class FossilSettings;
class FossilPluginPrivate;
class FossilClient : public VcsBase::VcsBaseClient
{
Q_OBJECT
public:
enum SupportedFeature {
AnnotateBlameFeature = 0x2,
TimelineWidthFeature = 0x4,
DiffIgnoreWhiteSpaceFeature = 0x8,
TimelinePathFeature = 0x10,
AnnotateRevisionFeature = 0x20,
InfoHashFeature = 0x40,
AllSupportedFeatures = // | all defined features
AnnotateBlameFeature
| TimelineWidthFeature
| DiffIgnoreWhiteSpaceFeature
| TimelinePathFeature
| AnnotateRevisionFeature
| InfoHashFeature
};
Q_DECLARE_FLAGS(SupportedFeatures, SupportedFeature)
static unsigned makeVersionNumber(int major, int minor, int patch);
static QString makeVersionString(unsigned version);
explicit FossilClient(FossilSettings *settings);
FossilSettings &settings() const;
unsigned int synchronousBinaryVersion() const;
BranchInfo synchronousCurrentBranch(const Utils::FilePath &workingDirectory);
QList<BranchInfo> synchronousBranchQuery(const Utils::FilePath &workingDirectory);
RevisionInfo synchronousRevisionQuery(const Utils::FilePath &workingDirectory,
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 = {}, bool isGlobal = false);
bool synchronousConfigureRepository(const Utils::FilePath &workingDirectory,
const RepositorySettings &newSettings,
const RepositorySettings &currentSettings = {});
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 = {}) 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 = {}) 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,
const std::function<void(Utils::CommandLine &)> &addAuthOptions = {}) final;
void logCurrentFile(const Utils::FilePath &workingDir, const QStringList &files = {},
const QStringList &extraOptions = {},
bool enableAnnotationContextMenu = false,
const std::function<void(Utils::CommandLine &)> &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 = {},
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 Utils::FilePath &source, const QString &id, const QStringList &extraOptions = {}) final;
private:
static QList<BranchInfo> branchListFromOutput(const QString &output,
const BranchInfo::BranchFlags defaultFlags = {});
static QStringList parseRevisionCommentLine(const QString &commentLine);
QString sanitizeFossilOutput(const QString &output) const;
QString vcsCommandString(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);
VcsBase::VcsBaseEditorConfig *createLogCurrentFileEditor(VcsBase::VcsBaseEditorWidget *editor);
VcsBase::VcsBaseEditorConfig *createLogEditor(VcsBase::VcsBaseEditorWidget *editor);
friend class FossilPluginPrivate;
FossilSettings *m_settings = nullptr;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(FossilClient::SupportedFeatures)
} // namespace Internal
} // namespace Fossil

View File

@@ -0,0 +1,177 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Fossil::Internal::FossilCommitPanel</class>
<widget class="QWidget" name="Fossil::Internal::FossilCommitPanel">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>374</width>
<height>270</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="infoGroup">
<property name="title">
<string>Current Information</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="1" column="0">
<widget class="QLabel" name="localRootLabel">
<property name="text">
<string>Local root:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="localRootLineEdit">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="currentBranchLabel">
<property name="text">
<string>Branch:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="currentBranchLineEdit">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="currentTagsLabel">
<property name="text">
<string>Tags:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="currentTagsLineEdit">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="editGroup">
<property name="title">
<string>Commit Information</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="branchLabel">
<property name="text">
<string>New branch:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="branchLineEdit"/>
</item>
<item row="0" column="2">
<widget class="QLabel" name="invalidBranchLabel">
<property name="minimumSize">
<size>
<width>50</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>:/projectexplorer/images/compile_error.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QCheckBox" name="isPrivateCheckBox">
<property name="toolTip">
<string>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.</string>
</property>
<property name="text">
<string>Private</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="tagsLabel">
<property name="text">
<string>Tags:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="tagsLineEdit">
<property name="toolTip">
<string>Tag names to apply; comma-separated.</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="authorLabel">
<property name="text">
<string>Author:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="authorLineEdit"/>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>160</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,163 @@
/****************************************************************************
**
** 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 "fossilcommitwidget.h"
#include "branchinfo.h"
#include <texteditor/texteditorsettings.h>
#include <texteditor/fontsettings.h>
#include <texteditor/texteditorconstants.h>
#include <utils/completingtextedit.h>
#include <utils/filepath.h>
#include <utils/qtcassert.h>
#include <QDir>
#include <QRegularExpression>
#include <QSyntaxHighlighter>
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 Utils::FilePath &repoPath, const BranchInfo &branch,
const QStringList &tags, const QString &userName)
{
m_commitPanelUi.localRootLineEdit->setText(repoPath.toUserOutput());
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
{
return m_commitPanelUi.branchLineEdit->text().trimmed();
}
QStringList FossilCommitWidget::tags() const
{
QString tagsText = m_commitPanelUi.tagsLineEdit->text().trimmed();
if (tagsText.isEmpty())
return {};
return tagsText.replace(',', ' ').split(' ', Qt::SkipEmptyParts);
}
QString FossilCommitWidget::committer() const
{
return m_commitPanelUi.authorLineEdit->text();
}
bool FossilCommitWidget::isPrivateOptionEnabled() const
{
return m_commitPanelUi.isPrivateCheckBox->isChecked();
}
bool FossilCommitWidget::canSubmit(QString *whyNot) const
{
QString message = cleanupDescription(descriptionText()).trimmed();
if (m_commitPanelUi.invalidBranchLabel->isVisible() || message.isEmpty()) {
if (whyNot)
*whyNot = tr("Message check failed.");
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

View File

@@ -0,0 +1,77 @@
/****************************************************************************
**
** 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 "ui_fossilcommitpanel.h"
#include <vcsbase/submiteditorwidget.h>
QT_BEGIN_NAMESPACE
class QValidator;
QT_END_NAMESPACE
namespace Utils { class FilePath; }
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 Utils::FilePath &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(QString *whyNot = nullptr) const;
private slots:
void branchChanged();
private:
bool isValidBranch() const;
QWidget *m_commitPanel;
Ui::FossilCommitPanel m_commitPanelUi;
QValidator *m_branchValidator;
};
} // namespace Internal
} // namespace Fossil

View File

@@ -0,0 +1,123 @@
/****************************************************************************
**
** 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 "fossileditor.h"
#include "annotationhighlighter.h"
#include "constants.h"
#include "fossilplugin.h"
#include "fossilclient.h"
#include <utils/qtcassert.h>
#include <QRegularExpression>
#include <QTextCursor>
namespace Fossil {
namespace Internal {
class FossilEditorWidgetPrivate
{
public:
FossilEditorWidgetPrivate() :
m_exactChangesetId(Constants::CHANGESET_ID_EXACT)
{
QTC_ASSERT(m_exactChangesetId.isValid(), return);
}
const QRegularExpression m_exactChangesetId;
};
FossilEditorWidget::FossilEditorWidget() :
d(new FossilEditorWidgetPrivate)
{
setAnnotateRevisionTextFormat(tr("&Annotate %1"));
setAnnotatePreviousRevisionTextFormat(tr("Annotate &Parent Revision %1"));
setDiffFilePattern(Constants::DIFFFILE_ID_EXACT);
setLogEntryPattern("^.*\\[([0-9a-f]{5,40})\\]");
setAnnotationEntryPattern(QString("^") + Constants::CHANGESET_ID + " ");
}
FossilEditorWidget::~FossilEditorWidget()
{
delete d;
}
QString FossilEditorWidget::changeUnderCursor(const QTextCursor &cursorIn) const
{
QTextCursor cursor = cursorIn;
cursor.select(QTextCursor::WordUnderCursor);
if (cursor.hasSelection()) {
const QString change = cursor.selectedText();
const QRegularExpressionMatch exactChangesetIdMatch = d->m_exactChangesetId.match(change);
if (exactChangesetIdMatch.hasMatch())
return change;
}
return {};
}
QString FossilEditorWidget::decorateVersion(const QString &revision) const
{
static const int shortChangesetIdSize(10);
static const int maxTextSize(120);
const Utils::FilePath workingDirectory = source().parentDir();
const FossilClient *client = FossilPlugin::client();
const 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
{
const Utils::FilePath workingDirectory = source().parentDir();
const FossilClient *client = FossilPlugin::client();
const RevisionInfo revisionInfo = client->synchronousRevisionQuery(workingDirectory, revision);
if (revisionInfo.parentId.isEmpty())
return {};
QStringList revisions{revisionInfo.parentId};
revisions.append(revisionInfo.mergeParentIds);
return revisions;
}
VcsBase::BaseAnnotationHighlighter *FossilEditorWidget::createAnnotationHighlighter(
const QSet<QString> &changes) const
{
return new FossilAnnotationHighlighter(changes);
}
} // namespace Internal
} // namespace Fossil

View File

@@ -0,0 +1,54 @@
/****************************************************************************
**
** 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 <vcsbase/vcsbaseeditor.h>
namespace Fossil {
namespace Internal {
class FossilEditorWidgetPrivate;
class FossilEditorWidget final : public VcsBase::VcsBaseEditorWidget
{
Q_OBJECT
public:
FossilEditorWidget();
~FossilEditorWidget() final;
private:
QString changeUnderCursor(const QTextCursor &cursor) const final;
QString decorateVersion(const QString &revision) const final;
QStringList annotationPreviousVersions(const QString &revision) const final;
VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(
const QSet<QString> &changes) const final;
FossilEditorWidgetPrivate *d;
};
} // namespace Internal
} // namespace Fossil

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,62 @@
/****************************************************************************
**
** 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 "fossilsettings.h"
#include <vcsbase/vcsbaseclient.h>
#include <vcsbase/vcsbaseplugin.h>
#include <coreplugin/icontext.h>
namespace Fossil {
namespace Internal {
class FossilClient;
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;
public:
static const FossilSettings &settings();
static FossilClient *client();
#ifdef WITH_TESTS
private slots:
void testDiffFileResolving_data();
void testDiffFileResolving();
void testLogResolving();
#endif
};
} // namespace Internal
} // namespace Fossil

View File

@@ -0,0 +1,197 @@
/****************************************************************************
**
** 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 "fossilsettings.h"
#include "constants.h"
#include <coreplugin/icore.h>
#include <utils/layoutbuilder.h>
#include <utils/pathchooser.h>
#include <vcsbase/vcsbaseconstants.h>
using namespace Utils;
namespace Fossil {
namespace Internal {
FossilSettings::FossilSettings()
{
setSettingsGroup(Constants::FOSSIL);
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."));
};
// OptionsPage
class OptionsPageWidget final : public Core::IOptionsPageWidget
{
Q_DECLARE_TR_FUNCTIONS(Fossil::Internal::OptionsPageWidget)
public:
OptionsPageWidget(const std::function<void()> &onApply, FossilSettings *settings);
void apply() final;
private:
const std::function<void()> m_onApply;
FossilSettings *m_settings;
};
void OptionsPageWidget::apply()
{
if (!m_settings->isDirty())
return;
m_settings->apply();
m_onApply();
}
OptionsPageWidget::OptionsPageWidget(const std::function<void()> &onApply, FossilSettings *settings) :
m_onApply(onApply),
m_settings(settings)
{
FossilSettings &s = *m_settings;
using namespace Layouting;
Column {
Group {
title(tr("Configuration")),
Row { s.binaryPath }
},
Group {
title(tr("Local Repositories")),
Row { s.defaultRepoPath }
},
Group {
title(tr("User")),
Form {
s.userName, br,
s.sslIdentityFile
}
},
Group {
title(tr("Miscellaneous")),
Column {
Row {
s.logCount,
s.timelineWidth,
s.timeout,
st
},
s.disableAutosync
},
},
st
}.attachTo(this);
}
OptionsPage::OptionsPage(const std::function<void()> &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

View File

@@ -0,0 +1,75 @@
/****************************************************************************
**
** 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 <coreplugin/dialogs/ioptionspage.h>
#include <vcsbase/vcsbaseclientsettings.h>
namespace Fossil {
namespace Internal {
class FossilSettings : public VcsBase::VcsBaseSettings
{
public:
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();
};
struct RepositorySettings
{
enum AutosyncMode {AutosyncOff, AutosyncOn, AutosyncPullOnly};
QString user;
QString sslIdentityFile;
AutosyncMode autosync = AutosyncOn;
};
inline bool operator==(const RepositorySettings &lh, const RepositorySettings &rh)
{
return (lh.user == rh.user &&
lh.sslIdentityFile == rh.sslIdentityFile &&
lh.autosync == rh.autosync);
}
class OptionsPage : public Core::IOptionsPage
{
public:
OptionsPage(const std::function<void()> &onApply, FossilSettings *settings);
};
} // namespace Internal
} // namespace Fossil

View File

@@ -0,0 +1,110 @@
/****************************************************************************
**
** 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 "pullorpushdialog.h"
#include "ui_pullorpushdialog.h"
#include "constants.h"
#include <utils/qtcassert.h>
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->filePath().toString();
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(Utils::FilePath::fromString(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

View File

@@ -0,0 +1,66 @@
/****************************************************************************
**
** 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 <QDialog>
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

View File

@@ -0,0 +1,235 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Fossil::Internal::PullOrPushDialog</class>
<widget class="QDialog" name="Fossil::Internal::PullOrPushDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>477</width>
<height>268</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Remote Location</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QRadioButton" name="defaultButton">
<property name="text">
<string>Default location</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="localButton">
<property name="text">
<string>Local filesystem:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Utils::PathChooser" name="localPathChooser" native="true">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="urlButton">
<property name="toolTip">
<string>For example: https://[user[:pass]@]host[:port]/[path]</string>
</property>
<property name="text">
<string>Specify URL:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="urlLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>For example: https://[user[:pass]@]host[:port]/[path]</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Options</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="rememberCheckBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Remember specified location as default</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="privateCheckBox">
<property name="toolTip">
<string>Allow transfer of private branches.</string>
</property>
<property name="text">
<string>Include private branches</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>4</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
<slots>
<signal>editingFinished()</signal>
<signal>browsingFinished()</signal>
</slots>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Fossil::Internal::PullOrPushDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>257</x>
<y>177</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Fossil::Internal::PullOrPushDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>325</x>
<y>177</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>urlButton</sender>
<signal>toggled(bool)</signal>
<receiver>urlLineEdit</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>80</x>
<y>121</y>
</hint>
<hint type="destinationlabel">
<x>332</x>
<y>123</y>
</hint>
</hints>
</connection>
<connection>
<sender>localButton</sender>
<signal>toggled(bool)</signal>
<receiver>localPathChooser</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>112</x>
<y>81</y>
</hint>
<hint type="destinationlabel">
<x>346</x>
<y>81</y>
</hint>
</hints>
</connection>
<connection>
<sender>urlButton</sender>
<signal>toggled(bool)</signal>
<receiver>rememberCheckBox</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>71</x>
<y>92</y>
</hint>
<hint type="destinationlabel">
<x>163</x>
<y>153</y>
</hint>
</hints>
</connection>
<connection>
<sender>localButton</sender>
<signal>toggled(bool)</signal>
<receiver>rememberCheckBox</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>71</x>
<y>67</y>
</hint>
<hint type="destinationlabel">
<x>163</x>
<y>153</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Fossil::Internal::RevertDialog</class>
<widget class="QDialog" name="Fossil::Internal::RevertDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>120</height>
</rect>
</property>
<property name="windowTitle">
<string>Revert</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Specify a revision other than the default?</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<widget class="QWidget" name="formLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>361</width>
<height>31</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="revisionLabel">
<property name="toolTip">
<string>Checkout revision, can also be a branch or a tag name.</string>
</property>
<property name="text">
<string>Revision:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="revisionLineEdit">
<property name="toolTip">
<string>Checkout revision, can also be a branch or a tag name.</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Fossil::Internal::RevertDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Fossil::Internal::RevertDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -0,0 +1,45 @@
/****************************************************************************
**
** 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 <QString>
#include <QStringList>
namespace Fossil {
namespace Internal {
class RevisionInfo
{
public:
const QString id;
const QString parentId;
const QStringList mergeParentIds;
const QString commentMsg;
const QString committer;
};
} // namespace Internal
} // namespace Fossil

View File

@@ -0,0 +1,122 @@
/****************************************************************************
**
** 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 "fossiljsextension.h"
#include "../constants.h"
#include "../fossilclient.h"
#include "../fossilplugin.h"
#include <coreplugin/iversioncontrol.h>
#include <coreplugin/vcsmanager.h>
#include <vcsbase/vcsbaseclientsettings.h>
#include <vcsbase/vcsbaseconstants.h>
using namespace Core;
namespace Fossil {
namespace Internal {
class FossilJsExtensionPrivate {
public:
FossilJsExtensionPrivate(FossilSettings *settings) :
m_vscId(Constants::VCS_ID_FOSSIL),
m_settings(settings)
{
}
Utils::Id m_vscId;
FossilSettings *m_settings;
};
QMap<QString, QString> FossilJsExtension::parseArgOptions(const QStringList &args)
{
QMap<QString, QString> 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) :
d(new FossilJsExtensionPrivate(settings))
{ }
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();
return d->m_settings->userName.value();
}
QString FossilJsExtension::defaultSslIdentityFile() const
{
if (!isConfigured())
return QString();
return d->m_settings->sslIdentityFile.value();
}
QString FossilJsExtension::defaultLocalRepoPath() const
{
if (!isConfigured())
return QString();
return d->m_settings->defaultRepoPath.value();
}
bool FossilJsExtension::defaultDisableAutosync() const
{
if (!isConfigured())
return false;
return d->m_settings->disableAutosync.value();
}
} // namespace Internal
} // namespace Fossil

View File

@@ -0,0 +1,62 @@
/****************************************************************************
**
** 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 <vcsbase/wizard/vcsjsextension.h>
#include <QStringList>
#include <QMap>
#include <QObject>
namespace Fossil {
namespace Internal {
class FossilJsExtensionPrivate;
class FossilSettings;
class FossilJsExtension : public QObject
{
Q_OBJECT
public:
static QMap<QString, QString> parseArgOptions(const QStringList &args);
FossilJsExtension(FossilSettings *settings);
~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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -0,0 +1,255 @@
{
"version": 1,
"supportedProjectTypes": [ "UNKNOWN_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}'.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() }" },
{ "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 <b>%{vcsName}</b> 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": "<default branch>"
}
},
{
"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$" ]
}
}
]
}

View File

@@ -37,6 +37,7 @@ Project {
"diffeditor/diffeditor.qbs",
"docker/docker.qbs",
"fakevim/fakevim.qbs",
"fossil/fossil.qbs",
"emacskeys/emacskeys.qbs",
"genericprojectmanager/genericprojectmanager.qbs",
"git/git.qbs",