Commit 566d3d9d authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

Git: Enable commit selection in Push to Gerrit dialog



Change-Id: Ie0ca8322858ac75d4bacf8b3efe66fa40577e3a2
Reviewed-by: default avatarLeena Miettinen <riitta-leena.miettinen@digia.com>
parent cd2722b1
......@@ -405,7 +405,10 @@ void GerritPlugin::push()
}
args << dialog->selectedRemoteName();
QString target = QLatin1String("HEAD:refs/") + dialog->selectedPushType() +
QString target = dialog->selectedCommit();
if (target.isEmpty())
target = QLatin1String("HEAD");
target += QLatin1String(":refs/") + dialog->selectedPushType() +
QLatin1Char('/') + dialog->selectedRemoteBranchName();
const QString topic = dialog->selectedTopic();
if (!topic.isEmpty())
......
......@@ -47,9 +47,10 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_ui->setupUi(this);
m_ui->repositoryLabel->setText(tr("Local Repository: %1").arg(
m_ui->repositoryLabel->setText(tr("<b>Local repository:</b> %1").arg(
QDir::toNativeSeparators(workingDir)));
m_ui->commitView->init(workingDir, QString(), false);
Git::Internal::GitClient *gitClient = Git::Internal::GitPlugin::instance()->gitClient();
QString output;
QString error;
......@@ -145,6 +146,10 @@ GerritPushDialog::~GerritPushDialog()
delete m_ui;
}
QString GerritPushDialog::selectedCommit() const
{
return m_ui->commitView->commit();
}
QString GerritPushDialog::calculateChangeRange()
{
......@@ -216,7 +221,7 @@ QString GerritPushDialog::selectedRemoteBranchName() const
QString GerritPushDialog::selectedPushType() const
{
return m_ui->publicRadioButton->isChecked() ? QLatin1String("for") : QLatin1String("draft");
return m_ui->draftCheckBox->isChecked() ? QLatin1String("draft") : QLatin1String("for");
}
QString GerritPushDialog::selectedTopic() const
......
......@@ -48,6 +48,7 @@ public:
GerritPushDialog(const QString &workingDir, const QString &reviewerList, QWidget *parent = 0);
~GerritPushDialog();
QString selectedCommit() const;
QString selectedRemoteName() const;
QString selectedRemoteBranchName() const;
QString selectedPushType() const;
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>306</width>
<height>407</height>
<width>600</width>
<height>520</height>
</rect>
</property>
<property name="windowTitle">
......@@ -31,42 +31,16 @@
<item>
<widget class="QLabel" name="repositoryLabel">
<property name="text">
<string>Local Repository:</string>
<string>&lt;b&gt;Local repository:&lt;/b&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="pushTypeGroupBox">
<widget class="QGroupBox" name="destinationGroupBox">
<property name="title">
<string>Push Type:</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QRadioButton" name="publicRadioButton">
<property name="text">
<string>&amp;Public</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="draftRadioButton">
<property name="text">
<string>&amp;Draft</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="remoteGroupBox">
<property name="title">
<string>Remote Branch:</string>
<string>Destination:</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
......@@ -75,7 +49,7 @@
<item row="1" column="0">
<widget class="QLabel" name="remoteLabel">
<property name="text">
<string>&amp;Remote Name:</string>
<string>R&amp;emote:</string>
</property>
<property name="buddy">
<cstring>remoteComboBox</cstring>
......@@ -88,7 +62,7 @@
<item row="2" column="0">
<widget class="QLabel" name="branchLabel">
<property name="text">
<string>&amp;Branch Name:</string>
<string>&amp;Branch:</string>
</property>
<property name="buddy">
<cstring>branchComboBox</cstring>
......@@ -111,6 +85,36 @@
<item row="3" column="1">
<widget class="QLineEdit" name="topicLineEdit"/>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="draftCheckBox">
<property name="text">
<string>&amp;Draft</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="infoLabel">
<property name="text">
<string>Number of commits</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="commitGroupBox">
<property name="title">
<string>&amp;Push up to commit:</string>
</property>
<layout class="QVBoxLayout" name="commitLayout">
<item>
<widget class="Git::Internal::LogChangeWidget" name="commitView">
<property name="toolTip">
<string>Pushes the selected commit and all dependent commits.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......@@ -118,8 +122,14 @@
<layout class="QFormLayout" name="reveiwersLayout">
<item row="0" column="0">
<widget class="QLabel" name="reviewersLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>R&amp;eviewers:</string>
<string>&amp;Reviewers:</string>
</property>
<property name="buddy">
<cstring>reviewersLineEdit</cstring>
......@@ -137,13 +147,6 @@ Partial names can be used if they are unambiguous.</string>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="infoLabel">
<property name="text">
<string>Number of commits</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
......@@ -169,6 +172,13 @@ Partial names can be used if they are unambiguous.</string>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Git::Internal::LogChangeWidget</class>
<extends>QTreeView</extends>
<header>../logchangedialog.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
......
......@@ -132,6 +132,7 @@ bool LogChangeWidget::populateLog(const QString &repository, const QString &comm
m_model->appendRow(row);
}
}
setCurrentIndex(m_model->index(0, 0));
return true;
}
......
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