Commit 1f447715 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

Git: Remove double warning for gerrit push



Change-Id: I5581521753fa525c6bb9f53725c28f947c8bbd44
Reviewed-by: default avatarPetar Perisin <petar.perisin@gmail.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 92392454
...@@ -312,11 +312,8 @@ void GerritPlugin::push() ...@@ -312,11 +312,8 @@ void GerritPlugin::push()
// QScopedPointer is required to delete the dialog when leaving the function // QScopedPointer is required to delete the dialog when leaving the function
GerritPushDialog dialog(topLevel, m_reviewers, Core::ICore::mainWindow()); GerritPushDialog dialog(topLevel, m_reviewers, Core::ICore::mainWindow());
if (!dialog.localChangesFound()) { if (!dialog.localChangesFound())
QMessageBox::warning(Core::ICore::mainWindow(), tr("No Local Changes"),
tr("Change from HEAD appears to be in remote branch already. Aborting."));
return; return;
}
if (!dialog.valid()) { if (!dialog.valid()) {
QMessageBox::warning(Core::ICore::mainWindow(), tr("Initialization Failed"), QMessageBox::warning(Core::ICore::mainWindow(), tr("Initialization Failed"),
......
...@@ -50,28 +50,21 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev ...@@ -50,28 +50,21 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev
m_ui->repositoryLabel->setText(tr("<b>Local repository:</b> %1").arg( m_ui->repositoryLabel->setText(tr("<b>Local repository:</b> %1").arg(
QDir::toNativeSeparators(workingDir))); QDir::toNativeSeparators(workingDir)));
m_ui->commitView->init(workingDir, QString(), false); if (!m_ui->commitView->init(workingDir, QString(), false))
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; return;
output.chop(1); QString earliestCommit = m_ui->commitView->earliestCommit();
if (output.isEmpty()) { if (earliestCommit.isEmpty())
return; return;
} else {
output = output.mid(output.lastIndexOf(QLatin1Char('\n')) + 1);
m_localChangesFound = true;
}
args.clear(); m_localChangesFound = true;
args << QLatin1String("--remotes") << QLatin1String("--contains") << output;
Git::Internal::GitClient *gitClient = Git::Internal::GitPlugin::instance()->gitClient();
QString output;
QString error;
QStringList args;
args << QLatin1String("--remotes") << QLatin1String("--contains")
<< earliestCommit + QLatin1Char('^');
if (!gitClient->synchronousBranchCmd(m_workingDir, args, &output, &error)) if (!gitClient->synchronousBranchCmd(m_workingDir, args, &output, &error))
return; return;
......
...@@ -96,6 +96,16 @@ int LogChangeWidget::commitIndex() const ...@@ -96,6 +96,16 @@ int LogChangeWidget::commitIndex() const
return -1; 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) void LogChangeWidget::emitDoubleClicked(const QModelIndex &index)
{ {
if (index.isValid()) { if (index.isValid()) {
......
...@@ -56,6 +56,7 @@ public: ...@@ -56,6 +56,7 @@ public:
bool includeRemote = true); bool includeRemote = true);
QString commit() const; QString commit() const;
int commitIndex() const; int commitIndex() const;
QString earliestCommit() const;
signals: signals:
void doubleClicked(const QString &commit); void doubleClicked(const QString &commit);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment