forked from qt-creator/qt-creator
Git: Call updateUpstreamStatus for all branches in a single place
* Calling it for each parsed line mixes unrelated logic. * I consider adding a cache later, but that will require data for all the remotes before this call. Change-Id: Ic3ee975fc6172f2a8848bc8d0a6620d4ccbf9cd2 Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
committed by
Orgad Shaneh
parent
885c6c1f0e
commit
cd8ea1f45b
@@ -218,6 +218,7 @@ public:
|
|||||||
bool hasTags() const { return rootNode->children.count() > Tags; }
|
bool hasTags() const { return rootNode->children.count() > Tags; }
|
||||||
void parseOutputLine(const QString &line, bool force = false);
|
void parseOutputLine(const QString &line, bool force = false);
|
||||||
void flushOldEntries();
|
void flushOldEntries();
|
||||||
|
void updateAllUpstreamStatus(BranchNode *node);
|
||||||
|
|
||||||
BranchModel *q;
|
BranchModel *q;
|
||||||
GitClient *client;
|
GitClient *client;
|
||||||
@@ -422,6 +423,7 @@ bool BranchModel::refresh(const FilePath &workingDirectory, QString *errorMessag
|
|||||||
d->parseOutputLine(l);
|
d->parseOutputLine(l);
|
||||||
d->flushOldEntries();
|
d->flushOldEntries();
|
||||||
|
|
||||||
|
d->updateAllUpstreamStatus(d->rootNode->children.at(LocalBranches));
|
||||||
if (d->currentBranch) {
|
if (d->currentBranch) {
|
||||||
if (d->currentBranch->isLocal())
|
if (d->currentBranch->isLocal())
|
||||||
d->currentBranch = nullptr;
|
d->currentBranch = nullptr;
|
||||||
@@ -827,7 +829,6 @@ void BranchModel::Private::parseOutputLine(const QString &line, bool force)
|
|||||||
root->insert(nameParts, newNode);
|
root->insert(nameParts, newNode);
|
||||||
if (current)
|
if (current)
|
||||||
currentBranch = newNode;
|
currentBranch = newNode;
|
||||||
q->updateUpstreamStatus(newNode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BranchModel::Private::flushOldEntries()
|
void BranchModel::Private::flushOldEntries()
|
||||||
@@ -902,6 +903,18 @@ void BranchModel::updateUpstreamStatus(BranchNode *node)
|
|||||||
process->start();
|
process->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BranchModel::Private::updateAllUpstreamStatus(BranchNode *node)
|
||||||
|
{
|
||||||
|
if (!node)
|
||||||
|
return;
|
||||||
|
if (node->isLeaf()) {
|
||||||
|
q->updateUpstreamStatus(node);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (BranchNode *child : node->children)
|
||||||
|
updateAllUpstreamStatus(child);
|
||||||
|
}
|
||||||
|
|
||||||
QString BranchModel::toolTip(const QString &sha) const
|
QString BranchModel::toolTip(const QString &sha) const
|
||||||
{
|
{
|
||||||
// Show the sha description excluding diff as toolTip
|
// Show the sha description excluding diff as toolTip
|
||||||
|
|||||||
Reference in New Issue
Block a user