forked from qt-creator/qt-creator
Git: Allow push after fixup
Direct push after fixup is really useful, especially on gerrit, because it allows easy fixing and direct pushing commits under HEAD. Change-Id: I83980e451c9ae86ac1ac0a55170d6d4141f27d49 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include "mergetool.h"
|
||||
#include "branchadddialog.h"
|
||||
|
||||
#include <gerrit/gerritplugin.h>
|
||||
#include <vcsbase/submitfilemodel.h>
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
@@ -2526,12 +2527,13 @@ QProcessEnvironment GitClient::processEnvironment() const
|
||||
return environment;
|
||||
}
|
||||
|
||||
bool GitClient::beginStashScope(const QString &workingDirectory, const QString &command, StashFlag flag)
|
||||
bool GitClient::beginStashScope(const QString &workingDirectory, const QString &command,
|
||||
StashFlag flag, PushAction pushAction)
|
||||
{
|
||||
const QString repoDirectory = findRepositoryForDirectory(workingDirectory);
|
||||
QTC_ASSERT(!repoDirectory.isEmpty(), return false);
|
||||
StashInfo &stashInfo = m_stashInfo[repoDirectory];
|
||||
return stashInfo.init(repoDirectory, command, flag);
|
||||
return stashInfo.init(repoDirectory, command, flag, pushAction);
|
||||
}
|
||||
|
||||
GitClient::StashInfo &GitClient::stashInfo(const QString &workingDirectory)
|
||||
@@ -3807,15 +3809,17 @@ unsigned GitClient::synchronousGitVersion(QString *errorMessage) const
|
||||
}
|
||||
|
||||
GitClient::StashInfo::StashInfo() :
|
||||
m_client(GitPlugin::instance()->gitClient())
|
||||
m_client(GitPlugin::instance()->gitClient()),
|
||||
m_pushAction(NoPush)
|
||||
{
|
||||
}
|
||||
|
||||
bool GitClient::StashInfo::init(const QString &workingDirectory, const QString &command,
|
||||
StashFlag flag)
|
||||
StashFlag flag, PushAction pushAction)
|
||||
{
|
||||
m_workingDir = workingDirectory;
|
||||
m_flags = flag;
|
||||
m_pushAction = pushAction;
|
||||
QString errorMessage;
|
||||
QString statusOutput;
|
||||
switch (m_client->gitStatus(m_workingDir, StatusMode(NoUntracked | NoSubmodules),
|
||||
@@ -3914,6 +3918,13 @@ void GitClient::StashInfo::end()
|
||||
if (m_client->stashNameFromMessage(m_workingDir, m_message, &stashName))
|
||||
m_client->stashPop(m_workingDir, stashName);
|
||||
}
|
||||
|
||||
if (m_pushAction == NormalPush)
|
||||
m_client->push(m_workingDir);
|
||||
else if (m_pushAction == PushToGerrit)
|
||||
GitPlugin::instance()->gerritPlugin()->push(m_workingDir);
|
||||
|
||||
m_pushAction = NoPush;
|
||||
m_stashResult = NotStashed;
|
||||
}
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user