forked from qt-creator/qt-creator
Git: Update branches dialog when repository is changed
and on fetch Task-number: QTCREATORBUG-9667 Change-Id: Id2e5080502bbc28d5f7900dd0433e468dda56c82 Reviewed-by: Robert Loehning <robert.loehning@digia.com> Reviewed-by: Petar Perisin <petar.perisin@gmail.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
0159774451
commit
be5133cf72
@@ -97,6 +97,12 @@ void BranchDialog::refresh(const QString &repository, bool force)
|
||||
m_ui->branchView->expandAll();
|
||||
}
|
||||
|
||||
void BranchDialog::refreshIfSame(const QString &repository)
|
||||
{
|
||||
if (m_repository == repository)
|
||||
refresh();
|
||||
}
|
||||
|
||||
void BranchDialog::enableButtons()
|
||||
{
|
||||
QModelIndex idx = selectedIndex();
|
||||
|
||||
@@ -61,6 +61,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void refresh(const QString &repository, bool force);
|
||||
void refreshIfSame(const QString &repository);
|
||||
|
||||
private slots:
|
||||
void enableButtons();
|
||||
|
||||
@@ -2331,6 +2331,11 @@ void GitClient::finishSubmoduleUpdate()
|
||||
m_updatedSubmodules.clear();
|
||||
}
|
||||
|
||||
void GitClient::fetchFinished(const QVariant &cookie)
|
||||
{
|
||||
GitPlugin::instance()->updateBranches(cookie.toString());
|
||||
}
|
||||
|
||||
// Trim a git status file spec: "modified: foo .cpp" -> "modified: foo .cpp"
|
||||
static inline QString trimFileSpecification(QString fileSpec)
|
||||
{
|
||||
@@ -2930,7 +2935,9 @@ void GitClient::fetch(const QString &workingDirectory, const QString &remote)
|
||||
{
|
||||
QStringList arguments(QLatin1String("fetch"));
|
||||
arguments << (remote.isEmpty() ? QLatin1String("--all") : remote);
|
||||
executeGit(workingDirectory, arguments, 0, true);
|
||||
VcsBase::Command *command = executeGit(workingDirectory, arguments, 0, true);
|
||||
command->setCookie(workingDirectory);
|
||||
connect(command, SIGNAL(success(QVariant)), this, SLOT(fetchFinished(QVariant)));
|
||||
}
|
||||
|
||||
bool GitClient::executeAndHandleConflicts(const QString &workingDirectory,
|
||||
|
||||
@@ -323,6 +323,7 @@ private slots:
|
||||
void appendOutputData(const QByteArray &data) const;
|
||||
void appendOutputDataSilently(const QByteArray &data) const;
|
||||
void finishSubmoduleUpdate();
|
||||
void fetchFinished(const QVariant &cookie);
|
||||
|
||||
private:
|
||||
QTextCodec *getSourceCodec(const QString &file) const;
|
||||
|
||||
@@ -689,6 +689,8 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
|
||||
connect(Core::ICore::vcsManager(), SIGNAL(repositoryChanged(QString)),
|
||||
this, SLOT(updateContinueAndAbortCommands()));
|
||||
connect(Core::ICore::vcsManager(), SIGNAL(repositoryChanged(QString)),
|
||||
this, SLOT(updateBranches(QString)));
|
||||
|
||||
if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(RC_GIT_MIME_XML), errorMessage))
|
||||
return false;
|
||||
@@ -1427,6 +1429,12 @@ void GitPlugin::updateContinueAndAbortCommands()
|
||||
}
|
||||
}
|
||||
|
||||
void GitPlugin::updateBranches(const QString &repository)
|
||||
{
|
||||
if (m_branchDialog && m_branchDialog->isVisible())
|
||||
m_branchDialog->refreshIfSame(repository);
|
||||
}
|
||||
|
||||
void GitPlugin::updateRepositoryBrowserAction()
|
||||
{
|
||||
const bool repositoryEnabled = currentState().hasTopLevel();
|
||||
|
||||
@@ -102,6 +102,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void startCommit();
|
||||
void updateBranches(const QString &repository);
|
||||
|
||||
private slots:
|
||||
void diffCurrentFile();
|
||||
|
||||
Reference in New Issue
Block a user