Git: Added submodule update

Change-Id: If8a4b0c572b0ca2d57f80f1304c7ebf141a40148
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Petar Perisin
2013-03-30 03:50:41 +01:00
parent b1c9d0eb37
commit 5d4c4a6968
4 changed files with 46 additions and 2 deletions

View File

@@ -441,6 +441,11 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
tr("Change-related Actions..."), Core::Id("Git.ChangeRelatedActions"),
globalcontext, true, SLOT(startChangeRelatedAction()));
m_submoduleUpdateAction =
createRepositoryAction(localRepositoryMenu,
tr("Update Submodules"), Core::Id("Git.SubmoduleUpdate"),
globalcontext, true, SLOT(updateSubmodules())).first;
// --------------
localRepositoryMenu->addSeparator(globalcontext);
@@ -1089,6 +1094,13 @@ void GitPlugin::cleanRepository(const QString &directory)
dialog.exec();
}
void GitPlugin::updateSubmodules()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient->submoduleUpdate(state.topLevel());
}
// If the file is modified in an editor, make sure it is saved.
static bool ensureFileSaved(const QString &fileName)
{
@@ -1224,13 +1236,14 @@ void GitPlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as)
fileAction->setParameter(fileName);
// If the current file looks like a patch, offer to apply
m_applyCurrentFilePatchAction->setParameter(currentState().currentPatchFileDisplayName());
const QString projectName = currentState().currentProjectName();
foreach (Utils::ParameterAction *projectAction, m_projectActions)
projectAction->setParameter(projectName);
foreach (QAction *repositoryAction, m_repositoryActions)
repositoryAction->setEnabled(repositoryEnabled);
m_submoduleUpdateAction->setVisible(repositoryEnabled
&& QFile::exists(currentState().topLevel() + QLatin1String("/.gitmodules")));
updateRepositoryBrowserAction();
}