forked from qt-creator/qt-creator
Git: Remove "Branch" from synchronousCheckoutBranch
Other refs can also be checked out using this function Change-Id: I80a1c15244b1043cfce650a121c71174b9d322cb Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
a85c32cb4a
commit
cf5f109b68
@@ -448,7 +448,7 @@ void BranchModel::checkoutBranch(const QModelIndex &idx)
|
|||||||
return;
|
return;
|
||||||
stashGuard.preventPop();
|
stashGuard.preventPop();
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
if (m_client->synchronousCheckoutBranch(m_workingDirectory, branch, &errorMessage)) {
|
if (m_client->synchronousCheckout(m_workingDirectory, branch, &errorMessage)) {
|
||||||
if (errorMessage.isEmpty()) {
|
if (errorMessage.isEmpty()) {
|
||||||
QModelIndex currentIdx = currentBranch();
|
QModelIndex currentIdx = currentBranch();
|
||||||
if (currentIdx.isValid()) {
|
if (currentIdx.isValid()) {
|
||||||
|
|||||||
@@ -778,21 +778,21 @@ void GitClient::blame(const QString &workingDirectory,
|
|||||||
executeGit(workingDirectory, arguments, editor, false, VcsBase::Command::NoReport, lineNumber);
|
executeGit(workingDirectory, arguments, editor, false, VcsBase::Command::NoReport, lineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GitClient::synchronousCheckoutBranch(const QString &workingDirectory,
|
bool GitClient::synchronousCheckout(const QString &workingDirectory,
|
||||||
const QString &branch,
|
const QString &ref,
|
||||||
QString *errorMessage /* = 0 */)
|
QString *errorMessage /* = 0 */)
|
||||||
{
|
{
|
||||||
QByteArray outputText;
|
QByteArray outputText;
|
||||||
QByteArray errorText;
|
QByteArray errorText;
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments << QLatin1String("checkout") << branch;
|
arguments << QLatin1String("checkout") << ref;
|
||||||
const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText);
|
const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText);
|
||||||
const QString output = commandOutputFromLocal8Bit(outputText);
|
const QString output = commandOutputFromLocal8Bit(outputText);
|
||||||
outputWindow()->append(output);
|
outputWindow()->append(output);
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
const QString stdErr = commandOutputFromLocal8Bit(errorText);
|
const QString stdErr = commandOutputFromLocal8Bit(errorText);
|
||||||
//: Meaning of the arguments: %1: Branch, %2: Repository, %3: Error message
|
//: Meaning of the arguments: %1: Branch, %2: Repository, %3: Error message
|
||||||
const QString msg = tr("Cannot checkout \"%1\" of \"%2\": %3").arg(branch, workingDirectory, stdErr);
|
const QString msg = tr("Cannot checkout \"%1\" of \"%2\": %3").arg(ref, workingDirectory, stdErr);
|
||||||
if (errorMessage)
|
if (errorMessage)
|
||||||
*errorMessage = msg;
|
*errorMessage = msg;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ public:
|
|||||||
QString revision = QString(), QString *errorMessage = 0,
|
QString revision = QString(), QString *errorMessage = 0,
|
||||||
bool revertStaging = true);
|
bool revertStaging = true);
|
||||||
// Checkout branch
|
// Checkout branch
|
||||||
bool synchronousCheckoutBranch(const QString &workingDirectory, const QString &branch, QString *errorMessage = 0);
|
bool synchronousCheckout(const QString &workingDirectory, const QString &ref, QString *errorMessage = 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 };
|
||||||
|
|||||||
@@ -208,10 +208,10 @@ bool GitVersionControl::vcsRestoreSnapshot(const QString &topLevel, const QStrin
|
|||||||
const QString revision = tokens.at(2);
|
const QString revision = tokens.at(2);
|
||||||
success = m_client->synchronousReset(topLevel);
|
success = m_client->synchronousReset(topLevel);
|
||||||
if (success && !branch.isEmpty()) {
|
if (success && !branch.isEmpty()) {
|
||||||
success = m_client->synchronousCheckoutBranch(topLevel, branch) &&
|
success = m_client->synchronousCheckout(topLevel, branch) &&
|
||||||
m_client->synchronousCheckoutFiles(topLevel, QStringList(), revision);
|
m_client->synchronousCheckoutFiles(topLevel, QStringList(), revision);
|
||||||
} else {
|
} else {
|
||||||
success = m_client->synchronousCheckoutBranch(topLevel, revision);
|
success = m_client->synchronousCheckout(topLevel, revision);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Restore stash if it can be resolved.
|
// Restore stash if it can be resolved.
|
||||||
|
|||||||
Reference in New Issue
Block a user