|
|
|
@@ -52,20 +52,21 @@
|
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QRegularExpression>
|
|
|
|
#include <QRegularExpression>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_TESTS
|
|
|
|
|
|
|
|
#include <QTest>
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
using namespace Core;
|
|
|
|
using namespace Core;
|
|
|
|
using namespace Utils;
|
|
|
|
using namespace Utils;
|
|
|
|
using namespace VcsBase;
|
|
|
|
using namespace VcsBase;
|
|
|
|
using namespace std::placeholders;
|
|
|
|
using namespace std::placeholders;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Fossil {
|
|
|
|
namespace Fossil::Internal {
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FossilTopicCache : public IVersionControl::TopicCache
|
|
|
|
class FossilTopicCache final : public IVersionControl::TopicCache
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
FossilTopicCache(FossilClient *client) :
|
|
|
|
FossilTopicCache() = default;
|
|
|
|
m_client(client)
|
|
|
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
protected:
|
|
|
|
FilePath trackFile(const FilePath &repository) final
|
|
|
|
FilePath trackFile(const FilePath &repository) final
|
|
|
|
@@ -75,11 +76,8 @@ protected:
|
|
|
|
|
|
|
|
|
|
|
|
QString refreshTopic(const FilePath &repository) final
|
|
|
|
QString refreshTopic(const FilePath &repository) final
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return m_client->synchronousTopic(repository);
|
|
|
|
return fossilClient().synchronousTopic(repository);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
FossilClient *m_client;
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const VcsBaseEditorParameters fileLogParameters {
|
|
|
|
const VcsBaseEditorParameters fileLogParameters {
|
|
|
|
@@ -183,8 +181,6 @@ public:
|
|
|
|
bool pullOrPush(SyncMode mode);
|
|
|
|
bool pullOrPush(SyncMode mode);
|
|
|
|
|
|
|
|
|
|
|
|
// Variables
|
|
|
|
// Variables
|
|
|
|
FossilClient m_client;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VcsSubmitEditorFactory submitEditorFactory {
|
|
|
|
VcsSubmitEditorFactory submitEditorFactory {
|
|
|
|
submitEditorParameters,
|
|
|
|
submitEditorParameters,
|
|
|
|
[] { return new CommitEditor; },
|
|
|
|
[] { return new CommitEditor; },
|
|
|
|
@@ -269,18 +265,13 @@ void FossilPlugin::extensionsInitialized()
|
|
|
|
dd->extensionsInitialized();
|
|
|
|
dd->extensionsInitialized();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FossilClient *FossilPlugin::client()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return &dd->m_client;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FossilPluginPrivate::FossilPluginPrivate()
|
|
|
|
FossilPluginPrivate::FossilPluginPrivate()
|
|
|
|
: VcsBasePluginPrivate(Context(Constants::FOSSIL_CONTEXT))
|
|
|
|
: VcsBasePluginPrivate(Context(Constants::FOSSIL_CONTEXT))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Context context(Constants::FOSSIL_CONTEXT);
|
|
|
|
Context context(Constants::FOSSIL_CONTEXT);
|
|
|
|
|
|
|
|
|
|
|
|
setTopicCache(new FossilTopicCache(&m_client));
|
|
|
|
setTopicCache(new FossilTopicCache);
|
|
|
|
connect(&m_client, &VcsBaseClient::changed, this, &FossilPluginPrivate::changed);
|
|
|
|
connect(&fossilClient(), &VcsBaseClient::changed, this, &FossilPluginPrivate::changed);
|
|
|
|
|
|
|
|
|
|
|
|
m_commandLocator = new CommandLocator("Fossil", "fossil", "fossil", this);
|
|
|
|
m_commandLocator = new CommandLocator("Fossil", "fossil", "fossil", this);
|
|
|
|
m_commandLocator->setDescription(Tr::tr("Triggers a Fossil version control operation."));
|
|
|
|
m_commandLocator->setDescription(Tr::tr("Triggers a Fossil version control operation."));
|
|
|
|
@@ -387,7 +378,7 @@ void FossilPluginPrivate::addCurrentFile()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const VcsBasePluginState state = currentState();
|
|
|
|
const VcsBasePluginState state = currentState();
|
|
|
|
QTC_ASSERT(state.hasFile(), return);
|
|
|
|
QTC_ASSERT(state.hasFile(), return);
|
|
|
|
m_client.synchronousAdd(state.currentFileTopLevel(), state.relativeCurrentFile());
|
|
|
|
fossilClient().synchronousAdd(state.currentFileTopLevel(), state.relativeCurrentFile());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FossilPluginPrivate::deleteCurrentFile()
|
|
|
|
void FossilPluginPrivate::deleteCurrentFile()
|
|
|
|
@@ -400,31 +391,31 @@ void FossilPluginPrivate::annotateCurrentFile()
|
|
|
|
const VcsBasePluginState state = currentState();
|
|
|
|
const VcsBasePluginState state = currentState();
|
|
|
|
QTC_ASSERT(state.hasFile(), return);
|
|
|
|
QTC_ASSERT(state.hasFile(), return);
|
|
|
|
const int lineNumber = VcsBaseEditor::lineNumberOfCurrentEditor(state.currentFile());
|
|
|
|
const int lineNumber = VcsBaseEditor::lineNumberOfCurrentEditor(state.currentFile());
|
|
|
|
m_client.annotate(state.currentFileTopLevel(), state.relativeCurrentFile(), lineNumber);
|
|
|
|
fossilClient().annotate(state.currentFileTopLevel(), state.relativeCurrentFile(), lineNumber);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FossilPluginPrivate::diffCurrentFile()
|
|
|
|
void FossilPluginPrivate::diffCurrentFile()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const VcsBasePluginState state = currentState();
|
|
|
|
const VcsBasePluginState state = currentState();
|
|
|
|
QTC_ASSERT(state.hasFile(), return);
|
|
|
|
QTC_ASSERT(state.hasFile(), return);
|
|
|
|
m_client.diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
|
|
|
|
fossilClient().diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FossilPluginPrivate::logCurrentFile()
|
|
|
|
void FossilPluginPrivate::logCurrentFile()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const VcsBasePluginState state = currentState();
|
|
|
|
const VcsBasePluginState state = currentState();
|
|
|
|
QTC_ASSERT(state.hasFile(), return);
|
|
|
|
QTC_ASSERT(state.hasFile(), return);
|
|
|
|
FossilClient::SupportedFeatures features = m_client.supportedFeatures();
|
|
|
|
FossilClient::SupportedFeatures features = fossilClient().supportedFeatures();
|
|
|
|
QStringList extraOptions;
|
|
|
|
QStringList extraOptions;
|
|
|
|
extraOptions << "-n" << QString::number(m_client.settings().logCount());
|
|
|
|
extraOptions << "-n" << QString::number(fossilClient().settings().logCount());
|
|
|
|
|
|
|
|
|
|
|
|
if (features.testFlag(FossilClient::TimelineWidthFeature))
|
|
|
|
if (features.testFlag(FossilClient::TimelineWidthFeature))
|
|
|
|
extraOptions << "-W" << QString::number(m_client.settings().timelineWidth());
|
|
|
|
extraOptions << "-W" << QString::number(fossilClient().settings().timelineWidth());
|
|
|
|
|
|
|
|
|
|
|
|
// disable annotate context menu for older client versions, used to be supported for current revision only
|
|
|
|
// disable annotate context menu for older client versions, used to be supported for current revision only
|
|
|
|
bool enableAnnotationContextMenu = features.testFlag(FossilClient::AnnotateRevisionFeature);
|
|
|
|
bool enableAnnotationContextMenu = features.testFlag(FossilClient::AnnotateRevisionFeature);
|
|
|
|
|
|
|
|
|
|
|
|
m_client.logCurrentFile(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()),
|
|
|
|
fossilClient().logCurrentFile(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()),
|
|
|
|
extraOptions, enableAnnotationContextMenu);
|
|
|
|
extraOptions, enableAnnotationContextMenu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -435,7 +426,7 @@ void FossilPluginPrivate::revertCurrentFile()
|
|
|
|
|
|
|
|
|
|
|
|
RevertDialog dialog(Tr::tr("Revert"), ICore::dialogParent());
|
|
|
|
RevertDialog dialog(Tr::tr("Revert"), ICore::dialogParent());
|
|
|
|
if (dialog.exec() == QDialog::Accepted) {
|
|
|
|
if (dialog.exec() == QDialog::Accepted) {
|
|
|
|
m_client.revertFile(state.currentFileTopLevel(), state.relativeCurrentFile(),
|
|
|
|
fossilClient().revertFile(state.currentFileTopLevel(), state.relativeCurrentFile(),
|
|
|
|
dialog.revision());
|
|
|
|
dialog.revision());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -444,7 +435,7 @@ void FossilPluginPrivate::statusCurrentFile()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const VcsBasePluginState state = currentState();
|
|
|
|
const VcsBasePluginState state = currentState();
|
|
|
|
QTC_ASSERT(state.hasFile(), return);
|
|
|
|
QTC_ASSERT(state.hasFile(), return);
|
|
|
|
m_client.status(state.currentFileTopLevel(), state.relativeCurrentFile());
|
|
|
|
fossilClient().status(state.currentFileTopLevel(), state.relativeCurrentFile());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FossilPluginPrivate::createDirectoryActions(const Context &context)
|
|
|
|
void FossilPluginPrivate::createDirectoryActions(const Context &context)
|
|
|
|
@@ -488,21 +479,21 @@ void FossilPluginPrivate::diffRepository()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const VcsBasePluginState state = currentState();
|
|
|
|
const VcsBasePluginState state = currentState();
|
|
|
|
QTC_ASSERT(state.hasTopLevel(), return);
|
|
|
|
QTC_ASSERT(state.hasTopLevel(), return);
|
|
|
|
m_client.diff(state.topLevel());
|
|
|
|
fossilClient().diff(state.topLevel());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FossilPluginPrivate::logRepository()
|
|
|
|
void FossilPluginPrivate::logRepository()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const VcsBasePluginState state = currentState();
|
|
|
|
const VcsBasePluginState state = currentState();
|
|
|
|
QTC_ASSERT(state.hasTopLevel(), return);
|
|
|
|
QTC_ASSERT(state.hasTopLevel(), return);
|
|
|
|
FossilClient::SupportedFeatures features = m_client.supportedFeatures();
|
|
|
|
FossilClient::SupportedFeatures features = fossilClient().supportedFeatures();
|
|
|
|
QStringList extraOptions;
|
|
|
|
QStringList extraOptions;
|
|
|
|
extraOptions << "-n" << QString::number(m_client.settings().logCount());
|
|
|
|
extraOptions << "-n" << QString::number(fossilClient().settings().logCount());
|
|
|
|
|
|
|
|
|
|
|
|
if (features.testFlag(FossilClient::TimelineWidthFeature))
|
|
|
|
if (features.testFlag(FossilClient::TimelineWidthFeature))
|
|
|
|
extraOptions << "-W" << QString::number(m_client.settings().timelineWidth());
|
|
|
|
extraOptions << "-W" << QString::number(fossilClient().settings().timelineWidth());
|
|
|
|
|
|
|
|
|
|
|
|
m_client.log(state.topLevel(), {}, extraOptions);
|
|
|
|
fossilClient().log(state.topLevel(), {}, extraOptions);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FossilPluginPrivate::revertAll()
|
|
|
|
void FossilPluginPrivate::revertAll()
|
|
|
|
@@ -512,14 +503,14 @@ void FossilPluginPrivate::revertAll()
|
|
|
|
|
|
|
|
|
|
|
|
RevertDialog dialog(Tr::tr("Revert"), ICore::dialogParent());
|
|
|
|
RevertDialog dialog(Tr::tr("Revert"), ICore::dialogParent());
|
|
|
|
if (dialog.exec() == QDialog::Accepted)
|
|
|
|
if (dialog.exec() == QDialog::Accepted)
|
|
|
|
m_client.revertAll(state.topLevel(), dialog.revision());
|
|
|
|
fossilClient().revertAll(state.topLevel(), dialog.revision());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FossilPluginPrivate::statusMulti()
|
|
|
|
void FossilPluginPrivate::statusMulti()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const VcsBasePluginState state = currentState();
|
|
|
|
const VcsBasePluginState state = currentState();
|
|
|
|
QTC_ASSERT(state.hasTopLevel(), return);
|
|
|
|
QTC_ASSERT(state.hasTopLevel(), return);
|
|
|
|
m_client.status(state.topLevel());
|
|
|
|
fossilClient().status(state.topLevel());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FossilPluginPrivate::createRepositoryActions(const Context &context)
|
|
|
|
void FossilPluginPrivate::createRepositoryActions(const Context &context)
|
|
|
|
@@ -592,8 +583,8 @@ bool FossilPluginPrivate::pullOrPush(FossilPluginPrivate::SyncMode mode)
|
|
|
|
QTC_ASSERT(state.hasTopLevel(), return false);
|
|
|
|
QTC_ASSERT(state.hasTopLevel(), return false);
|
|
|
|
|
|
|
|
|
|
|
|
PullOrPushDialog dialog(pullOrPushMode, ICore::dialogParent());
|
|
|
|
PullOrPushDialog dialog(pullOrPushMode, ICore::dialogParent());
|
|
|
|
dialog.setLocalBaseDirectory(m_client.settings().defaultRepoPath());
|
|
|
|
dialog.setLocalBaseDirectory(fossilClient().settings().defaultRepoPath());
|
|
|
|
const QString defaultURL(m_client.synchronousGetRepositoryURL(state.topLevel()));
|
|
|
|
const QString defaultURL(fossilClient().synchronousGetRepositoryURL(state.topLevel()));
|
|
|
|
dialog.setDefaultRemoteLocation(defaultURL);
|
|
|
|
dialog.setDefaultRemoteLocation(defaultURL);
|
|
|
|
if (dialog.exec() != QDialog::Accepted)
|
|
|
|
if (dialog.exec() != QDialog::Accepted)
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
@@ -613,9 +604,9 @@ bool FossilPluginPrivate::pullOrPush(FossilPluginPrivate::SyncMode mode)
|
|
|
|
extraOptions << "--private";
|
|
|
|
extraOptions << "--private";
|
|
|
|
switch (mode) {
|
|
|
|
switch (mode) {
|
|
|
|
case SyncPull:
|
|
|
|
case SyncPull:
|
|
|
|
return m_client.synchronousPull(state.topLevel(), remoteLocation, extraOptions);
|
|
|
|
return fossilClient().synchronousPull(state.topLevel(), remoteLocation, extraOptions);
|
|
|
|
case SyncPush:
|
|
|
|
case SyncPush:
|
|
|
|
return m_client.synchronousPush(state.topLevel(), remoteLocation, extraOptions);
|
|
|
|
return fossilClient().synchronousPush(state.topLevel(), remoteLocation, extraOptions);
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -628,7 +619,7 @@ void FossilPluginPrivate::update()
|
|
|
|
|
|
|
|
|
|
|
|
RevertDialog dialog(Tr::tr("Update"), ICore::dialogParent());
|
|
|
|
RevertDialog dialog(Tr::tr("Update"), ICore::dialogParent());
|
|
|
|
if (dialog.exec() == QDialog::Accepted)
|
|
|
|
if (dialog.exec() == QDialog::Accepted)
|
|
|
|
m_client.update(state.topLevel(), dialog.revision());
|
|
|
|
fossilClient().update(state.topLevel(), dialog.revision());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FossilPluginPrivate::configureRepository()
|
|
|
|
void FossilPluginPrivate::configureRepository()
|
|
|
|
@@ -639,14 +630,14 @@ void FossilPluginPrivate::configureRepository()
|
|
|
|
ConfigureDialog dialog;
|
|
|
|
ConfigureDialog dialog;
|
|
|
|
|
|
|
|
|
|
|
|
// retrieve current settings from the repository
|
|
|
|
// retrieve current settings from the repository
|
|
|
|
RepositorySettings currentSettings = m_client.synchronousSettingsQuery(state.topLevel());
|
|
|
|
RepositorySettings currentSettings = fossilClient().synchronousSettingsQuery(state.topLevel());
|
|
|
|
|
|
|
|
|
|
|
|
dialog.setSettings(currentSettings);
|
|
|
|
dialog.setSettings(currentSettings);
|
|
|
|
if (dialog.exec() != QDialog::Accepted)
|
|
|
|
if (dialog.exec() != QDialog::Accepted)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
const RepositorySettings newSettings = dialog.settings();
|
|
|
|
const RepositorySettings newSettings = dialog.settings();
|
|
|
|
|
|
|
|
|
|
|
|
m_client.synchronousConfigureRepository(state.topLevel(), newSettings, currentSettings);
|
|
|
|
fossilClient().synchronousConfigureRepository(state.topLevel(), newSettings, currentSettings);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FossilPluginPrivate::commit()
|
|
|
|
void FossilPluginPrivate::commit()
|
|
|
|
@@ -661,14 +652,14 @@ void FossilPluginPrivate::commit()
|
|
|
|
QTC_ASSERT(state.hasTopLevel(), return);
|
|
|
|
QTC_ASSERT(state.hasTopLevel(), return);
|
|
|
|
|
|
|
|
|
|
|
|
m_submitRepository = state.topLevel();
|
|
|
|
m_submitRepository = state.topLevel();
|
|
|
|
connect(&m_client, &VcsBaseClient::parsedStatus, this, &FossilPluginPrivate::showCommitWidget);
|
|
|
|
connect(&fossilClient(), &VcsBaseClient::parsedStatus, this, &FossilPluginPrivate::showCommitWidget);
|
|
|
|
m_client.emitParsedStatus(m_submitRepository, {});
|
|
|
|
fossilClient().emitParsedStatus(m_submitRepository, {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FossilPluginPrivate::showCommitWidget(const QList<VcsBaseClient::StatusItem> &status)
|
|
|
|
void FossilPluginPrivate::showCommitWidget(const QList<VcsBaseClient::StatusItem> &status)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//Once we receive our data release the connection so it can be reused elsewhere
|
|
|
|
//Once we receive our data release the connection so it can be reused elsewhere
|
|
|
|
disconnect(&m_client, &VcsBaseClient::parsedStatus,
|
|
|
|
disconnect(&fossilClient(), &VcsBaseClient::parsedStatus,
|
|
|
|
this, &FossilPluginPrivate::showCommitWidget);
|
|
|
|
this, &FossilPluginPrivate::showCommitWidget);
|
|
|
|
|
|
|
|
|
|
|
|
if (status.isEmpty()) {
|
|
|
|
if (status.isEmpty()) {
|
|
|
|
@@ -702,10 +693,10 @@ void FossilPluginPrivate::showCommitWidget(const QList<VcsBaseClient::StatusItem
|
|
|
|
const QString msg = Tr::tr("Commit changes for \"%1\".").arg(m_submitRepository.toUserOutput());
|
|
|
|
const QString msg = Tr::tr("Commit changes for \"%1\".").arg(m_submitRepository.toUserOutput());
|
|
|
|
commitEditor->document()->setPreferredDisplayName(msg);
|
|
|
|
commitEditor->document()->setPreferredDisplayName(msg);
|
|
|
|
|
|
|
|
|
|
|
|
const RevisionInfo currentRevision = m_client.synchronousRevisionQuery(m_submitRepository);
|
|
|
|
const RevisionInfo currentRevision = fossilClient().synchronousRevisionQuery(m_submitRepository);
|
|
|
|
const BranchInfo currentBranch = m_client.synchronousCurrentBranch(m_submitRepository);
|
|
|
|
const BranchInfo currentBranch = fossilClient().synchronousCurrentBranch(m_submitRepository);
|
|
|
|
const QString currentUser = m_client.synchronousUserDefaultQuery(m_submitRepository);
|
|
|
|
const QString currentUser = fossilClient().synchronousUserDefaultQuery(m_submitRepository);
|
|
|
|
QStringList tags = m_client.synchronousTagQuery(m_submitRepository, currentRevision.id);
|
|
|
|
QStringList tags = fossilClient().synchronousTagQuery(m_submitRepository, currentRevision.id);
|
|
|
|
// Fossil includes branch name in tag list -- remove.
|
|
|
|
// Fossil includes branch name in tag list -- remove.
|
|
|
|
tags.removeAll(currentBranch.name);
|
|
|
|
tags.removeAll(currentBranch.name);
|
|
|
|
commitEditor->setFields(m_submitRepository, currentBranch, tags, currentUser, status);
|
|
|
|
commitEditor->setFields(m_submitRepository, currentBranch, tags, currentUser, status);
|
|
|
|
@@ -717,7 +708,7 @@ void FossilPluginPrivate::showCommitWidget(const QList<VcsBaseClient::StatusItem
|
|
|
|
|
|
|
|
|
|
|
|
void FossilPluginPrivate::diffFromEditorSelected(const QStringList &files)
|
|
|
|
void FossilPluginPrivate::diffFromEditorSelected(const QStringList &files)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_client.diff(m_submitRepository, files);
|
|
|
|
fossilClient().diff(m_submitRepository, files);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline bool ask(QWidget *parent, const QString &title, const QString &question, bool defaultValue = true)
|
|
|
|
static inline bool ask(QWidget *parent, const QString &title, const QString &question, bool defaultValue = true)
|
|
|
|
@@ -808,7 +799,7 @@ bool FossilPluginPrivate::activateCommit()
|
|
|
|
// Whether local commit or not
|
|
|
|
// Whether local commit or not
|
|
|
|
if (commitWidget->isPrivateOptionEnabled())
|
|
|
|
if (commitWidget->isPrivateOptionEnabled())
|
|
|
|
extraOptions += "--private";
|
|
|
|
extraOptions += "--private";
|
|
|
|
m_client.commit(m_submitRepository, files, editorDocument->filePath().toString(), extraOptions);
|
|
|
|
fossilClient().commit(m_submitRepository, files, editorDocument->filePath().toString(), extraOptions);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -850,12 +841,12 @@ Id FossilPluginPrivate::id() const
|
|
|
|
|
|
|
|
|
|
|
|
bool FossilPluginPrivate::isVcsFileOrDirectory(const FilePath &filePath) const
|
|
|
|
bool FossilPluginPrivate::isVcsFileOrDirectory(const FilePath &filePath) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return m_client.isVcsFileOrDirectory(filePath);
|
|
|
|
return fossilClient().isVcsFileOrDirectory(filePath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool FossilPluginPrivate::managesDirectory(const FilePath &directory, FilePath *topLevel) const
|
|
|
|
bool FossilPluginPrivate::managesDirectory(const FilePath &directory, FilePath *topLevel) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const FilePath topLevelFound = m_client.findTopLevelForFile(directory);
|
|
|
|
const FilePath topLevelFound = fossilClient().findTopLevelForFile(directory);
|
|
|
|
if (topLevel)
|
|
|
|
if (topLevel)
|
|
|
|
*topLevel = topLevelFound;
|
|
|
|
*topLevel = topLevelFound;
|
|
|
|
return !topLevelFound.isEmpty();
|
|
|
|
return !topLevelFound.isEmpty();
|
|
|
|
@@ -863,12 +854,12 @@ bool FossilPluginPrivate::managesDirectory(const FilePath &directory, FilePath *
|
|
|
|
|
|
|
|
|
|
|
|
bool FossilPluginPrivate::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
|
|
|
bool FossilPluginPrivate::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return m_client.managesFile(workingDirectory, fileName);
|
|
|
|
return fossilClient().managesFile(workingDirectory, fileName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool FossilPluginPrivate::isConfigured() const
|
|
|
|
bool FossilPluginPrivate::isConfigured() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const FilePath binary = m_client.vcsBinary();
|
|
|
|
const FilePath binary = fossilClient().vcsBinary();
|
|
|
|
if (binary.isEmpty())
|
|
|
|
if (binary.isEmpty())
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -876,7 +867,7 @@ bool FossilPluginPrivate::isConfigured() const
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// Local repositories default path must be set and exist
|
|
|
|
// Local repositories default path must be set and exist
|
|
|
|
const FilePath repoPath = m_client.settings().defaultRepoPath();
|
|
|
|
const FilePath repoPath = fossilClient().settings().defaultRepoPath();
|
|
|
|
if (repoPath.isEmpty())
|
|
|
|
if (repoPath.isEmpty())
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -910,35 +901,35 @@ bool FossilPluginPrivate::vcsOpen(const FilePath &filePath)
|
|
|
|
|
|
|
|
|
|
|
|
bool FossilPluginPrivate::vcsAdd(const FilePath &filePath)
|
|
|
|
bool FossilPluginPrivate::vcsAdd(const FilePath &filePath)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return m_client.synchronousAdd(filePath.absolutePath(), filePath.fileName());
|
|
|
|
return fossilClient().synchronousAdd(filePath.absolutePath(), filePath.fileName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool FossilPluginPrivate::vcsDelete(const FilePath &filePath)
|
|
|
|
bool FossilPluginPrivate::vcsDelete(const FilePath &filePath)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return m_client.synchronousRemove(filePath.absolutePath(), filePath.fileName());
|
|
|
|
return fossilClient().synchronousRemove(filePath.absolutePath(), filePath.fileName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool FossilPluginPrivate::vcsMove(const FilePath &from, const FilePath &to)
|
|
|
|
bool FossilPluginPrivate::vcsMove(const FilePath &from, const FilePath &to)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const QFileInfo fromInfo = from.toFileInfo();
|
|
|
|
const QFileInfo fromInfo = from.toFileInfo();
|
|
|
|
const QFileInfo toInfo = to.toFileInfo();
|
|
|
|
const QFileInfo toInfo = to.toFileInfo();
|
|
|
|
return m_client.synchronousMove(from.absolutePath(), fromInfo.absoluteFilePath(),
|
|
|
|
return fossilClient().synchronousMove(from.absolutePath(), fromInfo.absoluteFilePath(),
|
|
|
|
toInfo.absoluteFilePath());
|
|
|
|
toInfo.absoluteFilePath());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool FossilPluginPrivate::vcsCreateRepository(const FilePath &directory)
|
|
|
|
bool FossilPluginPrivate::vcsCreateRepository(const FilePath &directory)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return m_client.synchronousCreateRepository(directory);
|
|
|
|
return fossilClient().synchronousCreateRepository(directory);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FossilPluginPrivate::vcsAnnotate(const FilePath &filePath, int line)
|
|
|
|
void FossilPluginPrivate::vcsAnnotate(const FilePath &filePath, int line)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_client.annotate(filePath.absolutePath(), filePath.fileName(), line);
|
|
|
|
fossilClient().annotate(filePath.absolutePath(), filePath.fileName(), line);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FossilPluginPrivate::vcsDescribe(const FilePath &source, const QString &id)
|
|
|
|
void FossilPluginPrivate::vcsDescribe(const FilePath &source, const QString &id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_client.view(source, id);
|
|
|
|
fossilClient().view(source, id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VcsCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QString &sourceUrl,
|
|
|
|
VcsCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QString &sourceUrl,
|
|
|
|
@@ -987,7 +978,7 @@ VcsCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QString &sou
|
|
|
|
checkoutPath.createDir();
|
|
|
|
checkoutPath.createDir();
|
|
|
|
|
|
|
|
|
|
|
|
// Setup the wizard page command job
|
|
|
|
// Setup the wizard page command job
|
|
|
|
auto command = VcsBaseClient::createVcsCommand(checkoutPath, m_client.processEnvironment());
|
|
|
|
auto command = VcsBaseClient::createVcsCommand(checkoutPath, fossilClient().processEnvironment());
|
|
|
|
|
|
|
|
|
|
|
|
if (!isLocalRepository
|
|
|
|
if (!isLocalRepository
|
|
|
|
&& !cloneRepository.exists()) {
|
|
|
|
&& !cloneRepository.exists()) {
|
|
|
|
@@ -1019,11 +1010,11 @@ VcsCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QString &sou
|
|
|
|
// So here we want Fossil to save the remote details when specified.
|
|
|
|
// So here we want Fossil to save the remote details when specified.
|
|
|
|
|
|
|
|
|
|
|
|
QStringList args;
|
|
|
|
QStringList args;
|
|
|
|
args << m_client.vcsCommandString(FossilClient::CloneCommand)
|
|
|
|
args << fossilClient().vcsCommandString(FossilClient::CloneCommand)
|
|
|
|
<< extraOptions
|
|
|
|
<< extraOptions
|
|
|
|
<< sourceUrl
|
|
|
|
<< sourceUrl
|
|
|
|
<< fossilFileNative;
|
|
|
|
<< fossilFileNative;
|
|
|
|
command->addJob({m_client.vcsBinary(), args}, -1);
|
|
|
|
command->addJob({fossilClient().vcsBinary(), args}, -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// check out the cloned repository file into the working copy directory;
|
|
|
|
// check out the cloned repository file into the working copy directory;
|
|
|
|
@@ -1032,20 +1023,20 @@ VcsCommand *FossilPluginPrivate::createInitialCheckoutCommand(const QString &sou
|
|
|
|
QStringList args({"open", fossilFileNative});
|
|
|
|
QStringList args({"open", fossilFileNative});
|
|
|
|
if (!checkoutBranch.isEmpty())
|
|
|
|
if (!checkoutBranch.isEmpty())
|
|
|
|
args << checkoutBranch;
|
|
|
|
args << checkoutBranch;
|
|
|
|
command->addJob({m_client.vcsBinary(), args}, -1);
|
|
|
|
command->addJob({fossilClient().vcsBinary(), args}, -1);
|
|
|
|
|
|
|
|
|
|
|
|
// set user default to admin user if specified
|
|
|
|
// set user default to admin user if specified
|
|
|
|
if (!isLocalRepository
|
|
|
|
if (!isLocalRepository
|
|
|
|
&& !adminUser.isEmpty()) {
|
|
|
|
&& !adminUser.isEmpty()) {
|
|
|
|
const QStringList args({ "user", "default", adminUser, "--user", adminUser});
|
|
|
|
const QStringList args({ "user", "default", adminUser, "--user", adminUser});
|
|
|
|
command->addJob({m_client.vcsBinary(), args}, -1);
|
|
|
|
command->addJob({fossilClient().vcsBinary(), args}, -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// turn-off autosync if requested
|
|
|
|
// turn-off autosync if requested
|
|
|
|
if (!isLocalRepository
|
|
|
|
if (!isLocalRepository
|
|
|
|
&& disableAutosync) {
|
|
|
|
&& disableAutosync) {
|
|
|
|
const QStringList args({"settings", "autosync", "off"});
|
|
|
|
const QStringList args({"settings", "autosync", "off"});
|
|
|
|
command->addJob({m_client.vcsBinary(), args}, -1);
|
|
|
|
command->addJob({fossilClient().vcsBinary(), args}, -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return command;
|
|
|
|
return command;
|
|
|
|
@@ -1094,13 +1085,9 @@ RevertDialog::RevertDialog(const QString &title, QWidget *parent)
|
|
|
|
}.attachTo(this);
|
|
|
|
}.attachTo(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
|
|
|
} // namespace Fossil
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_TESTS
|
|
|
|
#ifdef WITH_TESTS
|
|
|
|
#include <QTest>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Fossil::Internal::FossilPlugin::testDiffFileResolving_data()
|
|
|
|
void FossilPlugin::testDiffFileResolving_data()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QTest::addColumn<QByteArray>("header");
|
|
|
|
QTest::addColumn<QByteArray>("header");
|
|
|
|
QTest::addColumn<QByteArray>("fileName");
|
|
|
|
QTest::addColumn<QByteArray>("fileName");
|
|
|
|
@@ -1133,12 +1120,12 @@ void Fossil::Internal::FossilPlugin::testDiffFileResolving_data()
|
|
|
|
<< QByteArray("src/plugins/fossil/fossilclient.cpp");
|
|
|
|
<< QByteArray("src/plugins/fossil/fossilclient.cpp");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Fossil::Internal::FossilPlugin::testDiffFileResolving()
|
|
|
|
void FossilPlugin::testDiffFileResolving()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
VcsBaseEditorWidget::testDiffFileResolving(dd->diffFactory);
|
|
|
|
VcsBaseEditorWidget::testDiffFileResolving(dd->diffFactory);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Fossil::Internal::FossilPlugin::testLogResolving()
|
|
|
|
void FossilPlugin::testLogResolving()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QByteArray data(
|
|
|
|
QByteArray data(
|
|
|
|
"=== 2014-03-08 ===\n"
|
|
|
|
"=== 2014-03-08 ===\n"
|
|
|
|
@@ -1151,3 +1138,5 @@ void Fossil::Internal::FossilPlugin::testLogResolving()
|
|
|
|
VcsBaseEditorWidget::testLogResolving(dd->fileLogFactory, data, "ac6d1129b8", "56d6917c3b");
|
|
|
|
VcsBaseEditorWidget::testLogResolving(dd->fileLogFactory, data, "ac6d1129b8", "56d6917c3b");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace Fossil::Internal
|
|
|
|
|