Commit b1c9d0eb authored by Petar Perisin's avatar Petar Perisin

Git: Added Checkout Commit

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