forked from qt-creator/qt-creator
Gerrit: List remote branches also for non-fetched remotes
Task-number: QTCREATORBUG-13718 Change-Id: I0259d06f4f06b68af459d747176dc46b14a55008 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
bd5afaf4c6
commit
7471187404
@@ -118,8 +118,7 @@ void GerritPushDialog::initRemoteBranches()
|
||||
BranchDate bd(ref.mid(refBranchIndex + 1), QDateTime::fromTime_t(timeT).date());
|
||||
m_remoteBranches.insertMulti(ref.left(refBranchIndex), bd);
|
||||
}
|
||||
QStringList remotes = m_remoteBranches.keys();
|
||||
remotes.removeDuplicates();
|
||||
QStringList remotes = m_client->synchronousRemotesList(m_workingDir).keys();
|
||||
m_ui->remoteComboBox->addItems(remotes);
|
||||
m_ui->remoteComboBox->setEnabled(remotes.count() > 1);
|
||||
}
|
||||
@@ -224,6 +223,11 @@ void GerritPushDialog::setRemoteBranches(bool includeOld)
|
||||
m_ui->targetBranchComboBox->clear();
|
||||
|
||||
const QString remoteName = selectedRemoteName();
|
||||
if (!m_remoteBranches.contains(remoteName)) {
|
||||
foreach (const QString &branch, m_client->synchronousRepositoryBranches(remoteName, m_workingDir))
|
||||
m_remoteBranches.insertMulti(remoteName, qMakePair(branch, QDate()));
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
bool excluded = false;
|
||||
foreach (const BranchDate &bd, m_remoteBranches.values(remoteName)) {
|
||||
|
@@ -1873,7 +1873,8 @@ bool GitClient::synchronousRemoteCmd(const QString &workingDirectory, QStringLis
|
||||
msgCannotRun(remoteArgs, workingDirectory, errorText, errorMessage);
|
||||
return false;
|
||||
}
|
||||
*output = commandOutputFromLocal8Bit(outputText);
|
||||
if (output)
|
||||
*output = commandOutputFromLocal8Bit(outputText);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2420,14 +2421,15 @@ QString GitClient::extendedShowDescription(const QString &workingDirectory, cons
|
||||
// Quietly retrieve branch list of remote repository URL
|
||||
//
|
||||
// The branch HEAD is pointing to is always returned first.
|
||||
QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryURL) const
|
||||
QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryURL,
|
||||
const QString &workingDirectory) const
|
||||
{
|
||||
QStringList arguments(QLatin1String("ls-remote"));
|
||||
arguments << repositoryURL << QLatin1String(HEAD) << QLatin1String("refs/heads/*");
|
||||
const unsigned flags = VcsBasePlugin::SshPasswordPrompt
|
||||
| VcsBasePlugin::SuppressStdErrInLogWindow
|
||||
| VcsBasePlugin::SuppressFailMessageInLogWindow;
|
||||
const SynchronousProcessResponse resp = synchronousGit(QString(), arguments, flags);
|
||||
const SynchronousProcessResponse resp = synchronousGit(workingDirectory, arguments, flags);
|
||||
QStringList branches;
|
||||
branches << tr("<Detached HEAD>");
|
||||
QString headSha;
|
||||
|
@@ -218,7 +218,7 @@ public:
|
||||
bool synchronousForEachRefCmd(const QString &workingDirectory, QStringList args,
|
||||
QString *output, QString *errorMessage = 0) const;
|
||||
bool synchronousRemoteCmd(const QString &workingDirectory, QStringList remoteArgs,
|
||||
QString *output, QString *errorMessage, bool silent = false) const;
|
||||
QString *output = 0, QString *errorMessage = 0, bool silent = false) const;
|
||||
|
||||
QMap<QString,QString> synchronousRemotesList(const QString &workingDirectory,
|
||||
QString *errorMessage = 0) const;
|
||||
@@ -325,7 +325,8 @@ public:
|
||||
|
||||
void launchRepositoryBrowser(const QString &workingDirectory);
|
||||
|
||||
QStringList synchronousRepositoryBranches(const QString &repositoryURL) const;
|
||||
QStringList synchronousRepositoryBranches(const QString &repositoryURL,
|
||||
const QString &workingDirectory = QString()) const;
|
||||
|
||||
GitSettings *settings() const;
|
||||
|
||||
|
Reference in New Issue
Block a user