Commit cf5f109b authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Git: Remove "Branch" from synchronousCheckoutBranch

Other refs can also be checked out using this function

Change-Id: I80a1c15244b1043cfce650a121c71174b9d322cb
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent a85c32cb
......@@ -448,7 +448,7 @@ void BranchModel::checkoutBranch(const QModelIndex &idx)
return;
stashGuard.preventPop();
QString errorMessage;
if (m_client->synchronousCheckoutBranch(m_workingDirectory, branch, &errorMessage)) {
if (m_client->synchronousCheckout(m_workingDirectory, branch, &errorMessage)) {
if (errorMessage.isEmpty()) {
QModelIndex currentIdx = currentBranch();
if (currentIdx.isValid()) {
......
......@@ -778,21 +778,21 @@ void GitClient::blame(const QString &workingDirectory,
executeGit(workingDirectory, arguments, editor, false, VcsBase::Command::NoReport, lineNumber);
}
bool GitClient::synchronousCheckoutBranch(const QString &workingDirectory,
const QString &branch,
bool GitClient::synchronousCheckout(const QString &workingDirectory,
const QString &ref,
QString *errorMessage /* = 0 */)
{
QByteArray outputText;
QByteArray errorText;
QStringList arguments;
arguments << QLatin1String("checkout") << branch;
arguments << QLatin1String("checkout") << ref;
const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText);
const QString output = commandOutputFromLocal8Bit(outputText);
outputWindow()->append(output);
if (!rc) {
const QString stdErr = commandOutputFromLocal8Bit(errorText);
//: 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)
*errorMessage = msg;
else
......
......@@ -156,7 +156,7 @@ public:
QString revision = QString(), QString *errorMessage = 0,
bool revertStaging = true);
// 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.
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);
success = m_client->synchronousReset(topLevel);
if (success && !branch.isEmpty()) {
success = m_client->synchronousCheckoutBranch(topLevel, branch) &&
success = m_client->synchronousCheckout(topLevel, branch) &&
m_client->synchronousCheckoutFiles(topLevel, QStringList(), revision);
} else {
success = m_client->synchronousCheckoutBranch(topLevel, revision);
success = m_client->synchronousCheckout(topLevel, revision);
}
} else {
// Restore stash if it can be resolved.
......
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