forked from qt-creator/qt-creator
Git: Added Checkout Commit
Change-Id: I9446060b9a8ee1717b832f1f7b7dbcaf8e739ad3 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -53,6 +53,7 @@ ChangeSelectionDialog::ChangeSelectionDialog(const QString &workingDirectory, QW
|
||||
, m_showButton(new QPushButton(tr("Show"), this))
|
||||
, m_cherryPickButton(new QPushButton(tr("Cherry Pick"), this))
|
||||
, m_revertButton(new QPushButton(tr("Revert"), this))
|
||||
, m_checkoutButton(new QPushButton(tr("Checkout"), this))
|
||||
, m_cancelButton(new QPushButton(tr("Cancel"), this))
|
||||
, m_command(NoCommand)
|
||||
{
|
||||
@@ -71,6 +72,7 @@ ChangeSelectionDialog::ChangeSelectionDialog(const QString &workingDirectory, QW
|
||||
QHBoxLayout* buttonsLine = new QHBoxLayout();
|
||||
buttonsLine->addWidget(m_cancelButton);
|
||||
buttonsLine->addStretch();
|
||||
buttonsLine->addWidget(m_checkoutButton);
|
||||
buttonsLine->addWidget(m_revertButton);
|
||||
buttonsLine->addWidget(m_cherryPickButton);
|
||||
buttonsLine->addWidget(m_showButton);
|
||||
@@ -91,6 +93,7 @@ ChangeSelectionDialog::ChangeSelectionDialog(const QString &workingDirectory, QW
|
||||
connect(m_showButton, SIGNAL(clicked()), this, SLOT(acceptShow()));
|
||||
connect(m_cherryPickButton, SIGNAL(clicked()), this, SLOT(acceptCherryPick()));
|
||||
connect(m_revertButton, SIGNAL(clicked()), this, SLOT(acceptRevert()));
|
||||
connect(m_checkoutButton, SIGNAL(clicked()), this, SLOT(acceptCheckout()));
|
||||
connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
|
||||
|
||||
recalculateDetails(m_changeNumberEdit->text());
|
||||
@@ -116,6 +119,12 @@ ChangeCommand ChangeSelectionDialog::command() const
|
||||
return m_command;
|
||||
}
|
||||
|
||||
void ChangeSelectionDialog::acceptCheckout()
|
||||
{
|
||||
m_command = Checkout;
|
||||
accept();
|
||||
}
|
||||
|
||||
void ChangeSelectionDialog::acceptCherryPick()
|
||||
{
|
||||
m_command = CherryPick;
|
||||
|
@@ -46,6 +46,7 @@ namespace Internal {
|
||||
|
||||
enum ChangeCommand {
|
||||
NoCommand,
|
||||
Checkout,
|
||||
CherryPick,
|
||||
Revert,
|
||||
Show
|
||||
@@ -66,6 +67,7 @@ public:
|
||||
private slots:
|
||||
void setDetails(int exitCode);
|
||||
void recalculateDetails(const QString &ref);
|
||||
void acceptCheckout();
|
||||
void acceptCherryPick();
|
||||
void acceptRevert();
|
||||
void acceptShow();
|
||||
@@ -83,6 +85,7 @@ private:
|
||||
QPushButton* m_showButton;
|
||||
QPushButton* m_cherryPickButton;
|
||||
QPushButton* m_revertButton;
|
||||
QPushButton* m_checkoutButton;
|
||||
QPushButton* m_cancelButton;
|
||||
|
||||
ChangeCommand m_command;
|
||||
|
@@ -155,7 +155,9 @@ public:
|
||||
QString revision = QString(), QString *errorMessage = 0,
|
||||
bool revertStaging = true);
|
||||
// Checkout branch
|
||||
bool synchronousCheckout(const QString &workingDirectory, const QString &ref, QString *errorMessage = 0);
|
||||
bool synchronousCheckout(const QString &workingDirectory, const QString &ref, QString *errorMessage);
|
||||
bool synchronousCheckout(const QString &workingDirectory, const QString &ref)
|
||||
{ return synchronousCheckout(workingDirectory, ref, 0); }
|
||||
|
||||
// Do a stash and return identier.
|
||||
enum { StashPromptDescription = 0x1, StashImmediateRestore = 0x2, StashIgnoreUnchanged = 0x4 };
|
||||
|
@@ -763,6 +763,10 @@ void GitPlugin::startChangeRelatedAction()
|
||||
command = QLatin1String("Revert");
|
||||
commandFunction = &GitClient::revertCommit;
|
||||
break;
|
||||
case Checkout:
|
||||
command = QLatin1String("Checkout");
|
||||
commandFunction = &GitClient::synchronousCheckout;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user