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()
|
||||
{
|
||||
QModelIndex trackedIndex = selectedIndex();
|
||||
QString trackedBranch = m_model->branchName(trackedIndex);
|
||||
QString trackedBranch = m_model->fullName(trackedIndex);
|
||||
if (trackedBranch.isEmpty()) {
|
||||
trackedIndex = m_model->currentBranch();
|
||||
trackedBranch = m_model->branchName(trackedIndex);
|
||||
trackedBranch = m_model->fullName(trackedIndex);
|
||||
}
|
||||
const bool isLocal = m_model->isLocal(trackedIndex);
|
||||
const bool isTag = m_model->isTag(trackedIndex);
|
||||
@@ -162,8 +162,8 @@ void BranchDialog::checkout()
|
||||
{
|
||||
QModelIndex idx = selectedIndex();
|
||||
|
||||
const QString currentBranch = m_model->branchName(m_model->currentBranch());
|
||||
const QString nextBranch = m_model->branchName(idx);
|
||||
const QString currentBranch = m_model->fullName(m_model->currentBranch());
|
||||
const QString nextBranch = m_model->fullName(idx);
|
||||
const QString popMessageStart = QCoreApplication::applicationName() +
|
||||
QLatin1String(" ") + nextBranch + QLatin1String("-AutoStash ");
|
||||
|
||||
@@ -224,7 +224,7 @@ void BranchDialog::remove()
|
||||
QModelIndex selected = selectedIndex();
|
||||
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())
|
||||
return;
|
||||
|
||||
@@ -254,7 +254,7 @@ void BranchDialog::rename()
|
||||
const bool isTag = m_model->isTag(selected);
|
||||
QTC_CHECK(m_model->isLocal(selected) || isTag);
|
||||
|
||||
QString oldName = m_model->branchName(selected);
|
||||
QString oldName = m_model->fullName(selected);
|
||||
QStringList localNames;
|
||||
if (!isTag)
|
||||
localNames = m_model->localBranchNames();
|
||||
@@ -287,16 +287,16 @@ void BranchDialog::rename()
|
||||
|
||||
void BranchDialog::diff()
|
||||
{
|
||||
QString branchName = m_model->branchName(selectedIndex());
|
||||
if (branchName.isEmpty())
|
||||
QString fullName = m_model->fullName(selectedIndex());
|
||||
if (fullName.isEmpty())
|
||||
return;
|
||||
// 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()
|
||||
{
|
||||
QString branchName = m_model->branchName(selectedIndex());
|
||||
QString branchName = m_model->fullName(selectedIndex());
|
||||
if (branchName.isEmpty())
|
||||
return;
|
||||
// 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(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();
|
||||
if (client->beginStashScope(m_repository, QLatin1String("merge"), AllowUnstashed))
|
||||
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(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();
|
||||
if (client->beginStashScope(m_repository, QLatin1String("rebase")))
|
||||
client->rebase(m_repository, baseBranch);
|
||||
|
||||
@@ -419,7 +419,7 @@ QModelIndex BranchModel::currentBranch() const
|
||||
return nodeToIndex(m_currentBranch);
|
||||
}
|
||||
|
||||
QString BranchModel::branchName(const QModelIndex &idx) const
|
||||
QString BranchModel::fullName(const QModelIndex &idx) const
|
||||
{
|
||||
if (!idx.isValid())
|
||||
return QString();
|
||||
@@ -473,7 +473,7 @@ bool BranchModel::isTag(const QModelIndex &idx) const
|
||||
|
||||
void BranchModel::removeBranch(const QModelIndex &idx)
|
||||
{
|
||||
QString branch = branchName(idx);
|
||||
QString branch = fullName(idx);
|
||||
if (branch.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -491,7 +491,7 @@ void BranchModel::removeBranch(const QModelIndex &idx)
|
||||
|
||||
void BranchModel::removeTag(const QModelIndex &idx)
|
||||
{
|
||||
QString tag = branchName(idx);
|
||||
QString tag = fullName(idx);
|
||||
if (tag.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -509,7 +509,7 @@ void BranchModel::removeTag(const QModelIndex &idx)
|
||||
|
||||
void BranchModel::checkoutBranch(const QModelIndex &idx)
|
||||
{
|
||||
QString branch = branchName(idx);
|
||||
QString branch = fullName(idx);
|
||||
if (branch.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -535,7 +535,7 @@ void BranchModel::checkoutBranch(const QModelIndex &idx)
|
||||
|
||||
bool BranchModel::branchIsMerged(const QModelIndex &idx)
|
||||
{
|
||||
QString branch = branchName(idx);
|
||||
QString branch = fullName(idx);
|
||||
if (branch.isEmpty())
|
||||
return false;
|
||||
|
||||
@@ -573,7 +573,7 @@ QModelIndex BranchModel::addBranch(const QString &name, bool track, const QModel
|
||||
if (!m_rootNode || !m_rootNode->count())
|
||||
return QModelIndex();
|
||||
|
||||
const QString trackedBranch = branchName(startPoint);
|
||||
const QString trackedBranch = fullName(startPoint);
|
||||
QString output;
|
||||
QString errorMessage;
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
GitClient *client() const;
|
||||
|
||||
QModelIndex currentBranch() const;
|
||||
QString branchName(const QModelIndex &idx) const;
|
||||
QString fullName(const QModelIndex &idx) const;
|
||||
QStringList localBranchNames() const;
|
||||
QString sha(const QModelIndex &idx) const;
|
||||
bool isLocal(const QModelIndex &idx) const;
|
||||
|
||||
Reference in New Issue
Block a user