forked from qt-creator/qt-creator
Git: Filter obsolete branch names when adding a branch
Task-number: QTCREATORBUG-16264 Change-Id: Ifcb04c7740ab274be590f53757e013da43ad96f1 Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
committed by
Orgad Shaneh
parent
43f8f04ed6
commit
62c60c6d1c
@@ -337,6 +337,7 @@ void BranchModel::clear()
|
|||||||
m_rootNode->children.takeLast();
|
m_rootNode->children.takeLast();
|
||||||
|
|
||||||
m_currentBranch = 0;
|
m_currentBranch = 0;
|
||||||
|
m_obsoleteLocalBranches.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BranchModel::refresh(const QString &workingDirectory, QString *errorMessage)
|
bool BranchModel::refresh(const QString &workingDirectory, QString *errorMessage)
|
||||||
@@ -446,7 +447,7 @@ QStringList BranchModel::localBranchNames() const
|
|||||||
if (!m_rootNode || !m_rootNode->count())
|
if (!m_rootNode || !m_rootNode->count())
|
||||||
return QStringList();
|
return QStringList();
|
||||||
|
|
||||||
return m_rootNode->children.at(LocalBranches)->childrenNames();
|
return m_rootNode->children.at(LocalBranches)->childrenNames() + m_obsoleteLocalBranches;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BranchModel::sha(const QModelIndex &idx) const
|
QString BranchModel::sha(const QModelIndex &idx) const
|
||||||
@@ -657,10 +658,14 @@ void BranchModel::parseOutputLine(const QString &line)
|
|||||||
if (!strDateTime.isEmpty()) {
|
if (!strDateTime.isEmpty()) {
|
||||||
const uint timeT = strDateTime.leftRef(strDateTime.indexOf(QLatin1Char(' '))).toUInt();
|
const uint timeT = strDateTime.leftRef(strDateTime.indexOf(QLatin1Char(' '))).toUInt();
|
||||||
const int age = QDateTime::fromTime_t(timeT).daysTo(QDateTime::currentDateTime());
|
const int age = QDateTime::fromTime_t(timeT).daysTo(QDateTime::currentDateTime());
|
||||||
if (age > Constants::OBSOLETE_COMMIT_AGE_IN_DAYS)
|
if (age > Constants::OBSOLETE_COMMIT_AGE_IN_DAYS) {
|
||||||
|
const QString heads = "refs/heads/";
|
||||||
|
if (fullName.startsWith(heads))
|
||||||
|
m_obsoleteLocalBranches.append(fullName.mid(heads.size()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
bool showTags = m_client->settings().boolValue(GitSettings::showTagsKey);
|
bool showTags = m_client->settings().boolValue(GitSettings::showTagsKey);
|
||||||
|
|
||||||
// insert node into tree:
|
// insert node into tree:
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ private:
|
|||||||
BranchNode *m_rootNode;
|
BranchNode *m_rootNode;
|
||||||
BranchNode *m_currentBranch = nullptr;
|
BranchNode *m_currentBranch = nullptr;
|
||||||
QString m_currentSha;
|
QString m_currentSha;
|
||||||
|
QStringList m_obsoleteLocalBranches;
|
||||||
bool m_oldBranchesIncluded = false;
|
bool m_oldBranchesIncluded = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user