Git: Interactive rebase

Change-Id: I3d106ce5b071df4a7a3d77be43e7c24bd7c91dfa
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2013-02-28 21:23:16 +02:00
committed by Orgad Shaneh
parent 8705862786
commit 56881e3179
4 changed files with 86 additions and 2 deletions

View File

@@ -435,6 +435,10 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
tr("Reset..."), Core::Id("Git.Reset"),
globalcontext, false, SLOT(resetRepository()));
createRepositoryAction(localRepositoryMenu,
tr("Interactive Rebase..."), Core::Id("Git.Rebase"),
globalcontext, true, SLOT(startRebase()));
createRepositoryAction(localRepositoryMenu,
tr("Revert Single Commit..."), Core::Id("Git.Revert"),
globalcontext, true, SLOT(startRevertCommit()));
@@ -719,6 +723,24 @@ void GitPlugin::resetRepository()
}
}
void GitPlugin::startRebase()
{
QString workingDirectory = currentState().currentDirectoryOrTopLevel();
if (workingDirectory.isEmpty() || !m_gitClient->canRebase(workingDirectory))
return;
GitClient::StashGuard stashGuard(workingDirectory, QLatin1String("Rebase-i"));
if (stashGuard.stashingFailed(true))
return;
stashGuard.preventPop();
LogChangeDialog dialog(false);
dialog.setWindowTitle(tr("Interactive Rebase"));
if (!dialog.runDialog(workingDirectory))
return;
const QString change = dialog.commit();
if (!change.isEmpty())
m_gitClient->interactiveRebase(workingDirectory, change);
}
void GitPlugin::startRevertCommit()
{
const VcsBase::VcsBasePluginState state = currentState();