VCS: Pass links to the correct VCS

Current implementation requires each VCS to connect to the referenceClicked
signal. Only Git does it, but this is conceptually wrong. If other VCSs
would connect to the same signal, all of them will act upon clicking a
link, which can result in multiple editors, most of them are likely to be
invalid anyway.

By default executes vcsDescribe. Can be extended or modified by subclasses.

Change-Id: Ib953009efd77446a4b2963f0aa8a2f3f3d26509f
Reviewed-by: Artur Shepilko <artur.shepilko@nomadbyte.com>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Orgad Shaneh
2020-06-18 00:04:17 +03:00
committed by Orgad Shaneh
parent cb0b8556c8
commit 92a4c0d38a
11 changed files with 70 additions and 37 deletions

View File

@@ -271,6 +271,15 @@ public:
GitClient::addChangeActions(menu, workingDirectory, reference);
}
bool handleLink(const QString &workingDirectory, const QString &reference) final
{
if (reference.contains(".."))
GitClient::instance()->log(workingDirectory, {}, false, {reference});
else
GitClient::instance()->show(workingDirectory, reference);
return true;
}
RepoUrl getRepoUrl(const QString &location) const override;
QStringList additionalToolsPath() const final;
@@ -1001,16 +1010,6 @@ GitPluginPrivate::GitPluginPrivate()
m_gerritPlugin->updateActions(currentState());
m_gerritPlugin->addToLocator(m_commandLocator);
connect(VcsOutputWindow::instance(), &VcsOutputWindow::referenceClicked,
this, [this](const QString &name) {
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
if (name.contains(".."))
m_gitClient.log(state.topLevel(), {}, false, {name});
else
m_gitClient.show(state.topLevel(), name);
});
}
void GitPluginPrivate::diffCurrentFile()