VCS: Add vcsDescribe

Already exists in all implementations, but there was no common declaration.

Change-Id: Ieb3d10d1936c207722b5001712bce41e8114dcdc
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Orgad Shaneh
2020-06-17 23:50:30 +03:00
committed by Orgad Shaneh
parent e9df7825fa
commit 5ebe34a332
8 changed files with 44 additions and 40 deletions

View File

@@ -161,6 +161,7 @@ public:
bool vcsMove(const QString &from, const QString &to) final;
bool vcsCreateRepository(const QString &directory) final;
void vcsAnnotate(const QString &file, int line) final;
void vcsDescribe(const QString &source, const QString &id) final { m_client.view(source, id); }
Core::ShellCommand *createInitialCheckoutCommand(const QString &url,
const Utils::FilePath &baseDirectory,
@@ -203,8 +204,6 @@ public:
void createDirectoryActions(const Core::Context &context);
void createRepositoryActions(const Core::Context &context);
void describe(const QString &source, const QString &id) { m_client.view(source, id); }
// Variables
BazaarSettings m_settings;
BazaarClient m_client{&m_settings};
@@ -238,19 +237,19 @@ public:
VcsEditorFactory logEditorFactory {
&logEditorParameters,
[] { return new BazaarEditorWidget; },
std::bind(&BazaarPluginPrivate::describe, this, _1, _2)
std::bind(&BazaarPluginPrivate::vcsDescribe, this, _1, _2)
};
VcsEditorFactory annotateEditorFactory {
&annotateEditorParameters,
[] { return new BazaarEditorWidget; },
std::bind(&BazaarPluginPrivate::describe, this, _1, _2)
std::bind(&BazaarPluginPrivate::vcsDescribe, this, _1, _2)
};
VcsEditorFactory diffEditorFactory {
&diffEditorParameters,
[] { return new BazaarEditorWidget; },
std::bind(&BazaarPluginPrivate::describe, this, _1, _2)
std::bind(&BazaarPluginPrivate::vcsDescribe, this, _1, _2)
};
};

View File

@@ -200,6 +200,7 @@ public:
bool vcsCreateRepository(const QString &directory) final;
void vcsAnnotate(const QString &file, int line) final;
void vcsDescribe(const QString &source, const QString &changeNr) final;
QString vcsOpenText() const final;
QString vcsMakeWritableText() const final;
@@ -250,7 +251,6 @@ public:
const QString &revision = QString(), int lineNumber = -1) const;
bool newActivity();
void updateStreamAndView();
void describe(const QString &source, const QString &changeNr);
protected:
void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override;
@@ -363,19 +363,19 @@ private:
VcsEditorFactory logEditorFactory {
&logEditorParameters,
[] { return new ClearCaseEditorWidget; },
std::bind(&ClearCasePluginPrivate::describe, this, _1, _2)
std::bind(&ClearCasePluginPrivate::vcsDescribe, this, _1, _2)
};
VcsEditorFactory annotateEditorFactory {
&annotateEditorParameters,
[] { return new ClearCaseEditorWidget; },
std::bind(&ClearCasePluginPrivate::describe, this, _1, _2)
std::bind(&ClearCasePluginPrivate::vcsDescribe, this, _1, _2)
};
VcsEditorFactory diffEditorFactory {
&diffEditorParameters,
[] { return new ClearCaseEditorWidget; },
std::bind(&ClearCasePluginPrivate::describe, this, _1, _2)
std::bind(&ClearCasePluginPrivate::vcsDescribe, this, _1, _2)
};
friend class ClearCasePlugin;
@@ -1605,7 +1605,7 @@ void ClearCasePluginPrivate::vcsAnnotateHelper(const QString &workingDir, const
}
}
void ClearCasePluginPrivate::describe(const QString &source, const QString &changeNr)
void ClearCasePluginPrivate::vcsDescribe(const QString &source, const QString &changeNr)
{
const QFileInfo fi(source);
QString topLevel;

View File

@@ -211,6 +211,11 @@ public:
*/
virtual QString vcsMakeWritableText() const;
/*!
* Display details of reference
*/
virtual void vcsDescribe(const QString &workingDirectory, const QString &reference) = 0;
/*!
* Return a list of paths where tools that came with the VCS may be installed.
* This is helpful on windows where e.g. git comes with a lot of nice unix tools.
@@ -297,6 +302,7 @@ public:
bool vcsMove(const QString &, const QString &) override { return false; }
bool vcsCreateRepository(const QString &) override { return false; }
void vcsAnnotate(const QString &, int) override {}
void vcsDescribe(const QString &, const QString &) override {}
private:
Id m_id;

View File

@@ -271,6 +271,7 @@ public:
void vcsAnnotate(const QString &workingDirectory, const QString &file,
const QString &revision, int lineNumber);
void vcsDescribe(const QString &source, const QString &changeNr) final;
protected:
void updateActions(ActionState) final;
@@ -318,7 +319,6 @@ private:
bool describe(const QString &source, const QString &changeNr, QString *errorMessage);
bool describe(const QString &toplevel, const QString &source, const QString &changeNr, QString *errorMessage);
bool describe(const QString &repository, QList<CvsLogEntry> entries, QString *errorMessage);
void describeHelper(const QString &source, const QString &changeNr);
void filelog(const QString &workingDir,
const QString &file = QString(),
bool enableAnnotationContextMenu = false);
@@ -379,25 +379,25 @@ public:
VcsEditorFactory commandLogEditorFactory {
&commandLogEditorParameters,
[] { return new CvsEditorWidget; },
std::bind(&CvsPluginPrivate::describeHelper, this, _1, _2)
std::bind(&CvsPluginPrivate::vcsDescribe, this, _1, _2)
};
VcsEditorFactory logEditorFactory {
&logEditorParameters,
[] { return new CvsEditorWidget; },
std::bind(&CvsPluginPrivate::describeHelper, this, _1, _2)
std::bind(&CvsPluginPrivate::vcsDescribe, this, _1, _2)
};
VcsEditorFactory annotateEditorFactory {
&annotateEditorParameters,
[] { return new CvsEditorWidget; },
std::bind(&CvsPluginPrivate::describeHelper, this, _1, _2)
std::bind(&CvsPluginPrivate::vcsDescribe, this, _1, _2)
};
VcsEditorFactory diffEditorFactory {
&diffEditorParameters,
[] { return new CvsEditorWidget; },
std::bind(&CvsPluginPrivate::describeHelper, this, _1, _2)
std::bind(&CvsPluginPrivate::vcsDescribe, this, _1, _2)
};
};
@@ -740,7 +740,7 @@ CvsPluginPrivate::CvsPluginPrivate()
m_commandLocator->appendCommand(command);
}
void CvsPluginPrivate::describeHelper(const QString &source, const QString &changeNr)
void CvsPluginPrivate::vcsDescribe(const QString &source, const QString &changeNr)
{
QString errorMessage;
if (!describe(source, changeNr, &errorMessage))

View File

@@ -250,6 +250,7 @@ public:
bool vcsCreateRepository(const QString &directory) final;
void vcsAnnotate(const QString &file, int line) final;
void vcsDescribe(const QString &source, const QString &id) final { m_gitClient.show(source, id); };
QString vcsTopic(const QString &directory) final;
Core::ShellCommand *createInitialCheckoutCommand(const QString &url,
@@ -264,7 +265,7 @@ public:
menu->addAction(tr("&Copy \"%1\"").arg(reference),
[reference] { QApplication::clipboard()->setText(reference); });
QAction *action = menu->addAction(tr("&Describe Change %1").arg(reference),
[=] { describe(workingDirectory, reference); });
[=] { vcsDescribe(workingDirectory, reference); });
menu->setDefaultAction(action);
GitClient::addChangeActions(menu, workingDirectory, reference);
}
@@ -366,7 +367,6 @@ public:
void onApplySettings();;
void describe(const QString &source, const QString &id) { m_gitClient.show(source, id); };
Core::CommandLocator *m_commandLocator = nullptr;
@@ -407,37 +407,37 @@ public:
VcsEditorFactory svnLogEditorFactory {
&svnLogEditorParameters,
[] { return new GitEditorWidget; },
std::bind(&GitPluginPrivate::describe, this, _1, _2)
std::bind(&GitPluginPrivate::vcsDescribe, this, _1, _2)
};
VcsEditorFactory logEditorFactory {
&logEditorParameters,
[] { return new GitLogEditorWidgetT<GitEditorWidget>; },
std::bind(&GitPluginPrivate::describe, this, _1, _2)
std::bind(&GitPluginPrivate::vcsDescribe, this, _1, _2)
};
VcsEditorFactory reflogEditorFactory {
&reflogEditorParameters,
[] { return new GitLogEditorWidgetT<GitReflogEditorWidget>; },
std::bind(&GitPluginPrivate::describe, this, _1, _2)
std::bind(&GitPluginPrivate::vcsDescribe, this, _1, _2)
};
VcsEditorFactory blameEditorFactory {
&blameEditorParameters,
[] { return new GitEditorWidget; },
std::bind(&GitPluginPrivate::describe, this, _1, _2)
std::bind(&GitPluginPrivate::vcsDescribe, this, _1, _2)
};
VcsEditorFactory commitTextEditorFactory {
&commitTextEditorParameters,
[] { return new GitEditorWidget; },
std::bind(&GitPluginPrivate::describe, this, _1, _2)
std::bind(&GitPluginPrivate::vcsDescribe, this, _1, _2)
};
VcsEditorFactory rebaseEditorFactory {
&rebaseEditorParameters,
[] { return new GitEditorWidget; },
std::bind(&GitPluginPrivate::describe, this, _1, _2)
std::bind(&GitPluginPrivate::vcsDescribe, this, _1, _2)
};
VcsSubmitEditorFactory submitEditorFactory {

View File

@@ -145,6 +145,7 @@ public:
bool vcsMove(const QString &from, const QString &to) final;
bool vcsCreateRepository(const QString &directory) final;
void vcsAnnotate(const QString &file, int line) final;
void vcsDescribe(const QString &source, const QString &id) final { m_client.view(source, id); }
Core::ShellCommand *createInitialCheckoutCommand(const QString &url,
const Utils::FilePath &baseDirectory,
@@ -193,8 +194,6 @@ private:
void createDirectoryActions(const Core::Context &context);
void createRepositoryActions(const Core::Context &context);
void describe(const QString &source, const QString &id) { m_client.view(source, id); }
// Variables
MercurialSettings m_settings;
MercurialClient m_client{&m_settings};
@@ -232,19 +231,19 @@ public:
VcsEditorFactory logEditorFactory {
&logEditorParameters,
[this] { return new MercurialEditorWidget(&m_client); },
std::bind(&MercurialPluginPrivate::describe, this, _1, _2)
std::bind(&MercurialPluginPrivate::vcsDescribe, this, _1, _2)
};
VcsEditorFactory annotateEditorFactory {
&annotateEditorParameters,
[this] { return new MercurialEditorWidget(&m_client); },
std::bind(&MercurialPluginPrivate::describe, this, _1, _2)
std::bind(&MercurialPluginPrivate::vcsDescribe, this, _1, _2)
};
VcsEditorFactory diffEditorFactory {
&diffEditorParameters,
[this] { return new MercurialEditorWidget(&m_client); },
std::bind(&MercurialPluginPrivate::describe, this, _1, _2)
std::bind(&MercurialPluginPrivate::vcsDescribe, this, _1, _2)
};
};

View File

@@ -224,6 +224,7 @@ public:
bool vcsMove(const QString &from, const QString &to) final;
bool vcsCreateRepository(const QString &directory) final;
void vcsAnnotate(const QString &file, int line) final;
void vcsDescribe(const QString &source, const QString &n) final;
QString vcsOpenText() const final;
QString vcsMakeWritableText() const final;
@@ -237,7 +238,6 @@ public:
IEditor *openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames);
void describe(const QString &source, const QString &n);
void getTopLevel(const QString &workingDirectory = QString(), bool isSync = false);
void updateActions(ActionState) override;
@@ -371,19 +371,19 @@ public:
VcsEditorFactory logEditorFactory {
&logEditorParameters,
[] { return new PerforceEditorWidget; },
std::bind(&PerforcePluginPrivate::describe, this, _1, _2)
std::bind(&PerforcePluginPrivate::vcsDescribe, this, _1, _2)
};
VcsEditorFactory annotateEditorFactory {
&annotateEditorParameters,
[] { return new PerforceEditorWidget; },
std::bind(&PerforcePluginPrivate::describe, this, _1, _2)
std::bind(&PerforcePluginPrivate::vcsDescribe, this, _1, _2)
};
VcsEditorFactory diffEditorFactory {
&diffEditorParameters,
[] { return new PerforceEditorWidget; },
std::bind(&PerforcePluginPrivate::describe, this, _1, _2)
std::bind(&PerforcePluginPrivate::vcsDescribe, this, _1, _2)
};
};
@@ -824,7 +824,7 @@ void PerforcePluginPrivate::describeChange()
{
ChangeNumberDialog dia;
if (dia.exec() == QDialog::Accepted && dia.number() > 0)
describe(QString(), QString::number(dia.number()));
vcsDescribe(QString(), QString::number(dia.number()));
}
void PerforcePluginPrivate::annotateCurrentFile()
@@ -1539,7 +1539,7 @@ void PerforcePluginPrivate::p4Diff(const PerforceDiffParameters &p)
diffEditorWidget->setEditorConfig(pw);
}
void PerforcePluginPrivate::describe(const QString & source, const QString &n)
void PerforcePluginPrivate::vcsDescribe(const QString & source, const QString &n)
{
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(nullptr)
: VcsBaseEditor::getCodec(source);

View File

@@ -222,6 +222,7 @@ public:
bool vcsCreateRepository(const QString &directory) final;
void vcsAnnotate(const QString &file, int line) final;
void vcsDescribe(const QString &source, const QString &changeNr) final;
Core::ShellCommand *createInitialCheckoutCommand(const QString &url,
const Utils::FilePath &baseDirectory,
@@ -248,7 +249,6 @@ public:
SubversionResponse runSvn(const QString &workingDir,
const QStringList &arguments, int timeOutS,
unsigned flags, QTextCodec *outputCodec = nullptr) const;
void describe(const QString &source, const QString &changeNr);
void vcsAnnotateHelper(const QString &workingDir, const QString &file,
const QString &revision = QString(), int lineNumber = -1);
@@ -335,13 +335,13 @@ public:
VcsEditorFactory logEditorFactory {
&logEditorParameters,
[] { return new SubversionEditorWidget; },
std::bind(&SubversionPluginPrivate::describe, this, _1, _2)
std::bind(&SubversionPluginPrivate::vcsDescribe, this, _1, _2)
};
VcsEditorFactory blameEditorFactory {
&blameEditorParameters,
[] { return new SubversionEditorWidget; },
std::bind(&SubversionPluginPrivate::describe, this, _1, _2)
std::bind(&SubversionPluginPrivate::vcsDescribe, this, _1, _2)
};
};
@@ -967,7 +967,7 @@ void SubversionPluginPrivate::projectStatus()
svnStatus(state.currentProjectTopLevel(), state.relativeCurrentProject());
}
void SubversionPluginPrivate::describe(const QString &source, const QString &changeNr)
void SubversionPluginPrivate::vcsDescribe(const QString &source, const QString &changeNr)
{
// To describe a complete change, find the top level and then do
//svn diff -r 472958:472959 <top level>
@@ -1004,7 +1004,7 @@ void SubversionPluginPrivate::slotDescribe()
return;
const int revision = inputDialog.intValue();
describe(state.topLevel(), QString::number(revision));
vcsDescribe(state.topLevel(), QString::number(revision));
}
void SubversionPluginPrivate::commitFromEditor()