forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.8' into HEAD
Conflicts: qbs/pluginspec/pluginspec.qbs Change-Id: Ic8e992623b9eda8913ee473c779a8df27643ccc9
This commit is contained in:
@@ -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();
|
||||
@@ -306,8 +312,7 @@ void BranchDialog::log()
|
||||
void BranchDialog::merge()
|
||||
{
|
||||
QModelIndex idx = selectedIndex();
|
||||
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->fullName(idx, true);
|
||||
GitClient *client = GitPlugin::instance()->gitClient();
|
||||
@@ -318,8 +323,7 @@ void BranchDialog::merge()
|
||||
void BranchDialog::rebase()
|
||||
{
|
||||
QModelIndex idx = selectedIndex();
|
||||
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->fullName(idx, true);
|
||||
GitClient *client = GitPlugin::instance()->gitClient();
|
||||
|
||||
@@ -61,6 +61,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void refresh(const QString &repository, bool force);
|
||||
void refreshIfSame(const QString &repository);
|
||||
|
||||
private slots:
|
||||
void enableButtons();
|
||||
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
|
||||
bool isLeaf() const
|
||||
{
|
||||
return children.isEmpty();
|
||||
return children.isEmpty() && parent && parent->parent;
|
||||
}
|
||||
|
||||
bool childOf(BranchNode *node) const
|
||||
@@ -339,8 +339,12 @@ void BranchModel::clear()
|
||||
|
||||
bool BranchModel::refresh(const QString &workingDirectory, QString *errorMessage)
|
||||
{
|
||||
if (workingDirectory.isEmpty())
|
||||
beginResetModel();
|
||||
clear();
|
||||
if (workingDirectory.isEmpty()) {
|
||||
endResetModel();
|
||||
return false;
|
||||
}
|
||||
|
||||
m_currentSha = m_client->synchronousTopRevision(workingDirectory);
|
||||
QStringList args;
|
||||
@@ -349,9 +353,6 @@ bool BranchModel::refresh(const QString &workingDirectory, QString *errorMessage
|
||||
if (!m_client->synchronousForEachRefCmd(workingDirectory, args, &output, errorMessage))
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(*errorMessage);
|
||||
|
||||
beginResetModel();
|
||||
clear();
|
||||
|
||||
m_workingDirectory = workingDirectory;
|
||||
const QStringList lines = output.split(QLatin1Char('\n'));
|
||||
foreach (const QString &l, lines)
|
||||
|
||||
@@ -2362,6 +2362,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)
|
||||
{
|
||||
@@ -2974,7 +2979,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,
|
||||
|
||||
@@ -327,6 +327,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;
|
||||
|
||||
@@ -695,6 +695,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)), Qt::QueuedConnection);
|
||||
|
||||
if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(RC_GIT_MIME_XML), errorMessage))
|
||||
return false;
|
||||
@@ -1435,6 +1437,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();
|
||||
|
||||
@@ -76,8 +76,6 @@ bool LogChangeWidget::init(const QString &repository, const QString &commit, boo
|
||||
GitPlugin::instance()->gitClient()->msgNoCommits(includeRemote));
|
||||
return false;
|
||||
}
|
||||
selectionModel()->select(m_model->index(0, 0),
|
||||
QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -117,6 +115,8 @@ void LogChangeWidget::emitDoubleClicked(const QModelIndex &index)
|
||||
|
||||
bool LogChangeWidget::populateLog(const QString &repository, const QString &commit, bool includeRemote)
|
||||
{
|
||||
const QString currentCommit = this->commit();
|
||||
int selected = currentCommit.isEmpty() ? 0 : -1;
|
||||
if (const int rowCount = m_model->rowCount())
|
||||
m_model->removeRows(0, rowCount);
|
||||
|
||||
@@ -144,12 +144,15 @@ bool LogChangeWidget::populateLog(const QString &repository, const QString &comm
|
||||
}
|
||||
row.push_back(item);
|
||||
}
|
||||
row[Sha1Column]->setText(line.left(colonPos));
|
||||
const QString sha1 = line.left(colonPos);
|
||||
row[Sha1Column]->setText(sha1);
|
||||
row[SubjectColumn]->setText(line.right(line.size() - colonPos - 1));
|
||||
m_model->appendRow(row);
|
||||
if (selected == -1 && currentCommit == sha1)
|
||||
selected = m_model->rowCount() - 1;
|
||||
}
|
||||
}
|
||||
setCurrentIndex(m_model->index(0, 0));
|
||||
setCurrentIndex(m_model->index(selected, 0));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -174,8 +177,8 @@ LogChangeDialog::LogChangeDialog(bool isReset, QWidget *parent) :
|
||||
if (isReset) {
|
||||
popUpLayout->addWidget(new QLabel(tr("Reset type:"), this));
|
||||
m_resetTypeComboBox = new QComboBox(this);
|
||||
m_resetTypeComboBox->addItem(tr("Mixed"), QLatin1String("--mixed"));
|
||||
m_resetTypeComboBox->addItem(tr("Hard"), QLatin1String("--hard"));
|
||||
m_resetTypeComboBox->addItem(tr("Mixed"), QLatin1String("--mixed"));
|
||||
m_resetTypeComboBox->addItem(tr("Soft"), QLatin1String("--soft"));
|
||||
popUpLayout->addWidget(m_resetTypeComboBox);
|
||||
popUpLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
|
||||
|
||||
Reference in New Issue
Block a user