forked from qt-creator/qt-creator
Git: Rename branchName -> fullName
The model can contain tags Change-Id: I70a75534848232476447125801a5ca7e963bbdcc Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
2af4c05b8c
commit
b2a09f7b45
@@ -124,10 +124,10 @@ void BranchDialog::refresh()
|
|||||||
void BranchDialog::add()
|
void BranchDialog::add()
|
||||||
{
|
{
|
||||||
QModelIndex trackedIndex = selectedIndex();
|
QModelIndex trackedIndex = selectedIndex();
|
||||||
QString trackedBranch = m_model->branchName(trackedIndex);
|
QString trackedBranch = m_model->fullName(trackedIndex);
|
||||||
if (trackedBranch.isEmpty()) {
|
if (trackedBranch.isEmpty()) {
|
||||||
trackedIndex = m_model->currentBranch();
|
trackedIndex = m_model->currentBranch();
|
||||||
trackedBranch = m_model->branchName(trackedIndex);
|
trackedBranch = m_model->fullName(trackedIndex);
|
||||||
}
|
}
|
||||||
const bool isLocal = m_model->isLocal(trackedIndex);
|
const bool isLocal = m_model->isLocal(trackedIndex);
|
||||||
const bool isTag = m_model->isTag(trackedIndex);
|
const bool isTag = m_model->isTag(trackedIndex);
|
||||||
@@ -162,8 +162,8 @@ void BranchDialog::checkout()
|
|||||||
{
|
{
|
||||||
QModelIndex idx = selectedIndex();
|
QModelIndex idx = selectedIndex();
|
||||||
|
|
||||||
const QString currentBranch = m_model->branchName(m_model->currentBranch());
|
const QString currentBranch = m_model->fullName(m_model->currentBranch());
|
||||||
const QString nextBranch = m_model->branchName(idx);
|
const QString nextBranch = m_model->fullName(idx);
|
||||||
const QString popMessageStart = QCoreApplication::applicationName() +
|
const QString popMessageStart = QCoreApplication::applicationName() +
|
||||||
QLatin1String(" ") + nextBranch + QLatin1String("-AutoStash ");
|
QLatin1String(" ") + nextBranch + QLatin1String("-AutoStash ");
|
||||||
|
|
||||||
@@ -224,7 +224,7 @@ void BranchDialog::remove()
|
|||||||
QModelIndex selected = selectedIndex();
|
QModelIndex selected = selectedIndex();
|
||||||
QTC_CHECK(selected != m_model->currentBranch()); // otherwise the button would not be enabled!
|
QTC_CHECK(selected != m_model->currentBranch()); // otherwise the button would not be enabled!
|
||||||
|
|
||||||
QString branchName = m_model->branchName(selected);
|
QString branchName = m_model->fullName(selected);
|
||||||
if (branchName.isEmpty())
|
if (branchName.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -254,7 +254,7 @@ void BranchDialog::rename()
|
|||||||
const bool isTag = m_model->isTag(selected);
|
const bool isTag = m_model->isTag(selected);
|
||||||
QTC_CHECK(m_model->isLocal(selected) || isTag);
|
QTC_CHECK(m_model->isLocal(selected) || isTag);
|
||||||
|
|
||||||
QString oldName = m_model->branchName(selected);
|
QString oldName = m_model->fullName(selected);
|
||||||
QStringList localNames;
|
QStringList localNames;
|
||||||
if (!isTag)
|
if (!isTag)
|
||||||
localNames = m_model->localBranchNames();
|
localNames = m_model->localBranchNames();
|
||||||
@@ -287,16 +287,16 @@ void BranchDialog::rename()
|
|||||||
|
|
||||||
void BranchDialog::diff()
|
void BranchDialog::diff()
|
||||||
{
|
{
|
||||||
QString branchName = m_model->branchName(selectedIndex());
|
QString fullName = m_model->fullName(selectedIndex());
|
||||||
if (branchName.isEmpty())
|
if (fullName.isEmpty())
|
||||||
return;
|
return;
|
||||||
// Do not pass working dir by reference since it might change
|
// Do not pass working dir by reference since it might change
|
||||||
GitPlugin::instance()->gitClient()->diffBranch(QString(m_repository), QStringList(), branchName);
|
GitPlugin::instance()->gitClient()->diffBranch(QString(m_repository), QStringList(), fullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BranchDialog::log()
|
void BranchDialog::log()
|
||||||
{
|
{
|
||||||
QString branchName = m_model->branchName(selectedIndex());
|
QString branchName = m_model->fullName(selectedIndex());
|
||||||
if (branchName.isEmpty())
|
if (branchName.isEmpty())
|
||||||
return;
|
return;
|
||||||
// Do not pass working dir by reference since it might change
|
// Do not pass working dir by reference since it might change
|
||||||
@@ -309,7 +309,7 @@ void BranchDialog::merge()
|
|||||||
QTC_CHECK(m_model->isLocal(m_model->currentBranch())); // otherwise the button would not be enabled!
|
QTC_CHECK(m_model->isLocal(m_model->currentBranch())); // otherwise the button would not be enabled!
|
||||||
QTC_CHECK(idx != m_model->currentBranch()); // otherwise the button would not be enabled!
|
QTC_CHECK(idx != m_model->currentBranch()); // otherwise the button would not be enabled!
|
||||||
|
|
||||||
const QString branch = m_model->branchName(idx);
|
const QString branch = m_model->fullName(idx);
|
||||||
GitClient *client = GitPlugin::instance()->gitClient();
|
GitClient *client = GitPlugin::instance()->gitClient();
|
||||||
if (client->beginStashScope(m_repository, QLatin1String("merge"), AllowUnstashed))
|
if (client->beginStashScope(m_repository, QLatin1String("merge"), AllowUnstashed))
|
||||||
client->synchronousMerge(m_repository, branch);
|
client->synchronousMerge(m_repository, branch);
|
||||||
@@ -321,7 +321,7 @@ void BranchDialog::rebase()
|
|||||||
QTC_CHECK(m_model->isLocal(m_model->currentBranch())); // otherwise the button would not be enabled!
|
QTC_CHECK(m_model->isLocal(m_model->currentBranch())); // otherwise the button would not be enabled!
|
||||||
QTC_CHECK(idx != m_model->currentBranch()); // otherwise the button would not be enabled!
|
QTC_CHECK(idx != m_model->currentBranch()); // otherwise the button would not be enabled!
|
||||||
|
|
||||||
const QString baseBranch = m_model->branchName(idx);
|
const QString baseBranch = m_model->fullName(idx);
|
||||||
GitClient *client = GitPlugin::instance()->gitClient();
|
GitClient *client = GitPlugin::instance()->gitClient();
|
||||||
if (client->beginStashScope(m_repository, QLatin1String("rebase")))
|
if (client->beginStashScope(m_repository, QLatin1String("rebase")))
|
||||||
client->rebase(m_repository, baseBranch);
|
client->rebase(m_repository, baseBranch);
|
||||||
|
|||||||
@@ -419,7 +419,7 @@ QModelIndex BranchModel::currentBranch() const
|
|||||||
return nodeToIndex(m_currentBranch);
|
return nodeToIndex(m_currentBranch);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BranchModel::branchName(const QModelIndex &idx) const
|
QString BranchModel::fullName(const QModelIndex &idx) const
|
||||||
{
|
{
|
||||||
if (!idx.isValid())
|
if (!idx.isValid())
|
||||||
return QString();
|
return QString();
|
||||||
@@ -473,7 +473,7 @@ bool BranchModel::isTag(const QModelIndex &idx) const
|
|||||||
|
|
||||||
void BranchModel::removeBranch(const QModelIndex &idx)
|
void BranchModel::removeBranch(const QModelIndex &idx)
|
||||||
{
|
{
|
||||||
QString branch = branchName(idx);
|
QString branch = fullName(idx);
|
||||||
if (branch.isEmpty())
|
if (branch.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -491,7 +491,7 @@ void BranchModel::removeBranch(const QModelIndex &idx)
|
|||||||
|
|
||||||
void BranchModel::removeTag(const QModelIndex &idx)
|
void BranchModel::removeTag(const QModelIndex &idx)
|
||||||
{
|
{
|
||||||
QString tag = branchName(idx);
|
QString tag = fullName(idx);
|
||||||
if (tag.isEmpty())
|
if (tag.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -509,7 +509,7 @@ void BranchModel::removeTag(const QModelIndex &idx)
|
|||||||
|
|
||||||
void BranchModel::checkoutBranch(const QModelIndex &idx)
|
void BranchModel::checkoutBranch(const QModelIndex &idx)
|
||||||
{
|
{
|
||||||
QString branch = branchName(idx);
|
QString branch = fullName(idx);
|
||||||
if (branch.isEmpty())
|
if (branch.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -535,7 +535,7 @@ void BranchModel::checkoutBranch(const QModelIndex &idx)
|
|||||||
|
|
||||||
bool BranchModel::branchIsMerged(const QModelIndex &idx)
|
bool BranchModel::branchIsMerged(const QModelIndex &idx)
|
||||||
{
|
{
|
||||||
QString branch = branchName(idx);
|
QString branch = fullName(idx);
|
||||||
if (branch.isEmpty())
|
if (branch.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -573,7 +573,7 @@ QModelIndex BranchModel::addBranch(const QString &name, bool track, const QModel
|
|||||||
if (!m_rootNode || !m_rootNode->count())
|
if (!m_rootNode || !m_rootNode->count())
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
|
||||||
const QString trackedBranch = branchName(startPoint);
|
const QString trackedBranch = fullName(startPoint);
|
||||||
QString output;
|
QString output;
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public:
|
|||||||
GitClient *client() const;
|
GitClient *client() const;
|
||||||
|
|
||||||
QModelIndex currentBranch() const;
|
QModelIndex currentBranch() const;
|
||||||
QString branchName(const QModelIndex &idx) const;
|
QString fullName(const QModelIndex &idx) const;
|
||||||
QStringList localBranchNames() const;
|
QStringList localBranchNames() const;
|
||||||
QString sha(const QModelIndex &idx) const;
|
QString sha(const QModelIndex &idx) const;
|
||||||
bool isLocal(const QModelIndex &idx) const;
|
bool isLocal(const QModelIndex &idx) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user