forked from qt-creator/qt-creator
Git: Pop stored stash after checkout
Change-Id: I41eda91149c0152fd0b9f3d2c0294120153377b5 Reviewed-by: Petar Perisin <petar.perisin@gmail.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
fc85a4766d
commit
5eff132253
@@ -256,7 +256,7 @@ void FetchContext::cherryPick()
|
||||
|
||||
void FetchContext::checkout()
|
||||
{
|
||||
Git::Internal::GitPlugin::instance()->gitClient()->synchronousCheckout(
|
||||
Git::Internal::GitPlugin::instance()->gitClient()->stashAndCheckout(
|
||||
m_repository, QLatin1String("FETCH_HEAD"));
|
||||
}
|
||||
|
||||
|
||||
@@ -1814,6 +1814,16 @@ bool GitClient::synchronousCheckoutFiles(const QString &workingDirectory,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GitClient::stashAndCheckout(const QString &workingDirectory, const QString &ref)
|
||||
{
|
||||
if (!beginStashScope(workingDirectory, QLatin1String("Checkout")))
|
||||
return false;
|
||||
if (!synchronousCheckout(workingDirectory, ref))
|
||||
return false;
|
||||
endStashScope(workingDirectory);
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline QString msgParentRevisionFailed(const QString &workingDirectory,
|
||||
const QString &revision,
|
||||
const QString &why)
|
||||
|
||||
@@ -179,7 +179,8 @@ public:
|
||||
QStringList files = QStringList(),
|
||||
QString revision = QString(), QString *errorMessage = 0,
|
||||
bool revertStaging = true);
|
||||
// Checkout branch
|
||||
// Checkout ref
|
||||
bool stashAndCheckout(const QString &workingDirectory, const QString &ref);
|
||||
bool synchronousCheckout(const QString &workingDirectory, const QString &ref,
|
||||
QString *errorMessage = 0);
|
||||
|
||||
|
||||
@@ -900,9 +900,7 @@ void GitPlugin::startChangeRelatedAction()
|
||||
m_gitClient->synchronousRevert(workingDirectory, change);
|
||||
break;
|
||||
case Checkout:
|
||||
if (!m_gitClient->beginStashScope(workingDirectory, QLatin1String("Checkout")))
|
||||
return;
|
||||
m_gitClient->synchronousCheckout(workingDirectory, change);
|
||||
m_gitClient->stashAndCheckout(workingDirectory, QLatin1String("Checkout"));
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user