forked from qt-creator/qt-creator
Git: Remove double warning for gerrit push
Change-Id: I5581521753fa525c6bb9f53725c28f947c8bbd44 Reviewed-by: Petar Perisin <petar.perisin@gmail.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
92392454b7
commit
1f447715b0
@@ -312,11 +312,8 @@ void GerritPlugin::push()
|
||||
// QScopedPointer is required to delete the dialog when leaving the function
|
||||
GerritPushDialog dialog(topLevel, m_reviewers, Core::ICore::mainWindow());
|
||||
|
||||
if (!dialog.localChangesFound()) {
|
||||
QMessageBox::warning(Core::ICore::mainWindow(), tr("No Local Changes"),
|
||||
tr("Change from HEAD appears to be in remote branch already. Aborting."));
|
||||
if (!dialog.localChangesFound())
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dialog.valid()) {
|
||||
QMessageBox::warning(Core::ICore::mainWindow(), tr("Initialization Failed"),
|
||||
|
||||
@@ -50,28 +50,21 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev
|
||||
m_ui->repositoryLabel->setText(tr("<b>Local repository:</b> %1").arg(
|
||||
QDir::toNativeSeparators(workingDir)));
|
||||
|
||||
m_ui->commitView->init(workingDir, QString(), false);
|
||||
if (!m_ui->commitView->init(workingDir, QString(), false))
|
||||
return;
|
||||
|
||||
QString earliestCommit = m_ui->commitView->earliestCommit();
|
||||
if (earliestCommit.isEmpty())
|
||||
return;
|
||||
|
||||
m_localChangesFound = true;
|
||||
|
||||
Git::Internal::GitClient *gitClient = Git::Internal::GitPlugin::instance()->gitClient();
|
||||
QString output;
|
||||
QString error;
|
||||
QStringList args;
|
||||
|
||||
args << QLatin1String("--no-color") << QLatin1String("--format=%P")
|
||||
<< QLatin1String("HEAD") << QLatin1String("--not")<< QLatin1String("--remotes");
|
||||
|
||||
if (!gitClient->synchronousLog(m_workingDir, args, &output) || output.isEmpty())
|
||||
return;
|
||||
|
||||
output.chop(1);
|
||||
if (output.isEmpty()) {
|
||||
return;
|
||||
} else {
|
||||
output = output.mid(output.lastIndexOf(QLatin1Char('\n')) + 1);
|
||||
m_localChangesFound = true;
|
||||
}
|
||||
|
||||
args.clear();
|
||||
args << QLatin1String("--remotes") << QLatin1String("--contains") << output;
|
||||
args << QLatin1String("--remotes") << QLatin1String("--contains")
|
||||
<< earliestCommit + QLatin1Char('^');
|
||||
|
||||
if (!gitClient->synchronousBranchCmd(m_workingDir, args, &output, &error))
|
||||
return;
|
||||
|
||||
@@ -96,6 +96,16 @@ int LogChangeWidget::commitIndex() const
|
||||
return -1;
|
||||
}
|
||||
|
||||
QString LogChangeWidget::earliestCommit() const
|
||||
{
|
||||
int rows = m_model->rowCount();
|
||||
if (rows) {
|
||||
if (const QStandardItem *item = m_model->item(rows - 1, Sha1Column))
|
||||
return item->text();
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
void LogChangeWidget::emitDoubleClicked(const QModelIndex &index)
|
||||
{
|
||||
if (index.isValid()) {
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
bool includeRemote = true);
|
||||
QString commit() const;
|
||||
int commitIndex() const;
|
||||
QString earliestCommit() const;
|
||||
|
||||
signals:
|
||||
void doubleClicked(const QString &commit);
|
||||
|
||||
Reference in New Issue
Block a user