forked from qt-creator/qt-creator
Simplify data structures
Do some cleanup. Change-Id: If40fefbdb646f0eb434539f8306421a40e47a3ee Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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)
|
||||
|
||||
@@ -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) {
|
||||
@@ -78,7 +77,8 @@ void CommitEditor::setFields(const QString &repositoryRoot, const BranchInfo &br
|
||||
});
|
||||
|
||||
const QList<VcsBase::VcsBaseClient::StatusItem> 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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -287,11 +287,13 @@ QList<BranchInfo> 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<BranchInfo> 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
|
||||
|
||||
@@ -70,56 +70,51 @@ public:
|
||||
BranchInfo synchronousCurrentBranch(const Utils::FilePath &workingDirectory);
|
||||
QList<BranchInfo> 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<BranchInfo> branchListFromOutput(const QString &output, const BranchInfo::BranchFlags defaultFlags = {});
|
||||
static QList<BranchInfo> branchListFromOutput(const QString &output,
|
||||
const BranchInfo::BranchFlags defaultFlags = {});
|
||||
static QStringList parseRevisionCommentLine(const QString &commentLine);
|
||||
|
||||
QString sanitizeFossilOutput(const QString &output) const;
|
||||
|
||||
@@ -33,11 +33,9 @@
|
||||
#include <utils/completingtextedit.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QSyntaxHighlighter>
|
||||
#include <QTextEdit>
|
||||
|
||||
#include <QRegularExpression>
|
||||
#include <QDir>
|
||||
#include <QRegularExpression>
|
||||
#include <QSyntaxHighlighter>
|
||||
|
||||
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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -29,17 +29,10 @@
|
||||
#include "fossilplugin.h"
|
||||
#include "fossilclient.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <vcsbase/diffandloghighlighter.h>
|
||||
|
||||
#include <QRegularExpression>
|
||||
#include <QString>
|
||||
#include <QTextCursor>
|
||||
#include <QTextBlock>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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 QList<VcsBase::VcsBaseClient::S
|
||||
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());
|
||||
tags.removeAll(currentBranch.name);
|
||||
commitEditor->setFields(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,
|
||||
|
||||
@@ -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
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "branchinfo.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user