Git: Set remote-tracking branch

Task-number: QTCREATORBUG-8863
Change-Id: I06df735d85e2f9ed17c71385fed5057f8fc67d55
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2013-07-02 22:57:58 +03:00
committed by Orgad Shaneh
parent 51a9d5065a
commit 062b8f5d31
7 changed files with 57 additions and 1 deletions

View File

@@ -3059,6 +3059,26 @@ QString GitClient::synchronousTrackingBranch(const QString &workingDirectory, co
return remote + QLatin1Char('/') + rBranch;
}
bool GitClient::synchronousSetTrackingBranch(const QString &workingDirectory,
const QString &branch, const QString &tracking)
{
QByteArray outputText;
QByteArray errorText;
QStringList arguments;
arguments << QLatin1String("branch");
if (gitVersion() >= 0x010800)
arguments << (QLatin1String("--set-upstream-to=") + tracking) << branch;
else
arguments << QLatin1String("--set-upstream") << branch << tracking;
const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText);
if (!rc) {
const QString errorMessage = tr("Cannot set tracking branch: %1")
.arg(commandOutputFromLocal8Bit(errorText));
outputWindow()->appendError(errorMessage);
}
return rc;
}
void GitClient::handleMergeConflicts(const QString &workingDir, const QString &commit,
const QStringList &files, const QString &abortCommand)
{