From 63cf15b180980754b6ffea13bfd509ebfd06a69a Mon Sep 17 00:00:00 2001 From: Orgad Shaneh <orgad.shaneh@audiocodes.com> Date: Wed, 5 Jun 2013 08:12:52 +0300 Subject: [PATCH] Git: Start interactive rebase in topLevel Change-Id: I99edfed36b12942e64ee1947a46eddd1ca08b9ba Reviewed-by: Petar Perisin <petar.perisin@gmail.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com> --- src/plugins/git/gitplugin.cpp | 14 ++++++++------ src/plugins/vcsbase/vcsbaseplugin.cpp | 9 --------- src/plugins/vcsbase/vcsbaseplugin.h | 1 - 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 1520e34ce26..38a88b1bc3e 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -788,17 +788,19 @@ void GitPlugin::resetRepository() void GitPlugin::startRebase() { - QString workingDirectory = currentState().currentDirectoryOrTopLevel(); - if (workingDirectory.isEmpty() || !m_gitClient->canRebase(workingDirectory)) + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasTopLevel(), return); + const QString topLevel = state.topLevel(); + if (topLevel.isEmpty() || !m_gitClient->canRebase(topLevel)) return; - if (!m_gitClient->beginStashScope(workingDirectory, QLatin1String("Rebase-i"))) + if (!m_gitClient->beginStashScope(topLevel, QLatin1String("Rebase-i"))) return; LogChangeDialog dialog(false); dialog.setWindowTitle(tr("Interactive Rebase")); - if (dialog.runDialog(workingDirectory, QString(), false)) - m_gitClient->interactiveRebase(workingDirectory, dialog.commit(), false); + if (dialog.runDialog(topLevel, QString(), false)) + m_gitClient->interactiveRebase(topLevel, dialog.commit(), false); else - m_gitClient->endStashScope(workingDirectory); + m_gitClient->endStashScope(topLevel); } void GitPlugin::startChangeRelatedAction() diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp index 9022b65c216..c572e5d5420 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.cpp +++ b/src/plugins/vcsbase/vcsbaseplugin.cpp @@ -405,15 +405,6 @@ QString VcsBasePluginState::topLevel() const return hasFile() ? data->m_state.currentFileTopLevel : data->m_state.currentProjectTopLevel; } -QString VcsBasePluginState::currentDirectoryOrTopLevel() const -{ - if (hasFile()) - return data->m_state.currentFileDirectory; - else if (data->m_state.hasProject()) - return data->m_state.currentProjectTopLevel; - return QString(); -} - bool VcsBasePluginState::equals(const Internal::State &rhs) const { return data->m_state.equals(rhs); diff --git a/src/plugins/vcsbase/vcsbaseplugin.h b/src/plugins/vcsbase/vcsbaseplugin.h index 630f1d907a5..092d4be727f 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.h +++ b/src/plugins/vcsbase/vcsbaseplugin.h @@ -102,7 +102,6 @@ public: // the file one. QString topLevel() const; - QString currentDirectoryOrTopLevel() const; bool equals(const VcsBasePluginState &rhs) const; friend VCSBASE_EXPORT QDebug operator<<(QDebug in, const VcsBasePluginState &state); -- GitLab