aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/git/gitplugin.cpp
diff options
context:
space:
mode:
authorNikita Baryshnikov <[email protected]>2018-02-22 18:31:14 +0300
committerNikita Baryshnikov <[email protected]>2018-03-16 09:45:45 +0000
commite3918b563f87db838ca279ad63a460d992fc03b4 (patch)
treed7abe38e2af914391b6ec86d633fc5a2c3911e74 /src/plugins/git/gitplugin.cpp
parentf044e69f675f8dc12efee4a9715a3217ebd47a02 (diff)
Git: show commit given as command line parameter in diff editor
ex: qtcreator -client -git-show d3eb585db9 from qt-creator source dir. Change-Id: Ice62f062d431d2ab74e3d6832dfc8b0b555dfa19 Reviewed-by: Leena Miettinen <[email protected]> Reviewed-by: Orgad Shaneh <[email protected]> Reviewed-by: AndrĂ© Hartmann <[email protected]>
Diffstat (limited to 'src/plugins/git/gitplugin.cpp')
-rw-r--r--src/plugins/git/gitplugin.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index ddab8cd2fed..4657b68ac24 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -289,7 +289,6 @@ QAction *GitPlugin::createRepositoryAction(ActionContainer *ac, const QString &t
bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
- Q_UNUSED(arguments)
Q_UNUSED(errorMessage)
Context context(Constants::GIT_CONTEXT);
@@ -668,6 +667,12 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_gerritPlugin->updateActions(currentState());
m_gerritPlugin->addToLocator(m_commandLocator);
+ auto cmdContext = new QObject(this);
+ connect(Core::ICore::instance(), &Core::ICore::coreOpened, cmdContext, [this, cmdContext, arguments] {
+ remoteCommand(arguments, QDir::currentPath(), {});
+ cmdContext->deleteLater();
+ });
+
return ok;
}
@@ -1418,6 +1423,17 @@ void GitPlugin::updateBranches(const QString &repository)
m_branchDialog->refreshIfSame(repository);
}
+QObject *GitPlugin::remoteCommand(const QStringList &options, const QString &workingDirectory,
+ const QStringList &)
+{
+ if (!m_gitClient || options.size() < 2)
+ return nullptr;
+
+ if (options.first() == "-git-show")
+ m_gitClient->show(workingDirectory, options.at(1));
+ return nullptr;
+}
+
void GitPlugin::updateRepositoryBrowserAction()
{
const bool repositoryEnabled = currentState().hasTopLevel();