forked from qt-creator/qt-creator
VCS[git]: Added showing logs of all branches
This commit is contained in:
@@ -73,6 +73,7 @@ BranchDialog::BranchDialog(QWidget *parent) :
|
|||||||
m_ui(new Ui::BranchDialog),
|
m_ui(new Ui::BranchDialog),
|
||||||
m_checkoutButton(0),
|
m_checkoutButton(0),
|
||||||
m_diffButton(0),
|
m_diffButton(0),
|
||||||
|
m_logButton(0),
|
||||||
m_refreshButton(0),
|
m_refreshButton(0),
|
||||||
m_deleteButton(0),
|
m_deleteButton(0),
|
||||||
m_localModel(new LocalBranchModel(gitClient(), this)),
|
m_localModel(new LocalBranchModel(gitClient(), this)),
|
||||||
@@ -90,6 +91,9 @@ BranchDialog::BranchDialog(QWidget *parent) :
|
|||||||
m_diffButton = m_ui->buttonBox->addButton(tr("Diff"), QDialogButtonBox::ActionRole);
|
m_diffButton = m_ui->buttonBox->addButton(tr("Diff"), QDialogButtonBox::ActionRole);
|
||||||
connect(m_diffButton, SIGNAL(clicked()), this, SLOT(slotDiffSelected()));
|
connect(m_diffButton, SIGNAL(clicked()), this, SLOT(slotDiffSelected()));
|
||||||
|
|
||||||
|
m_logButton = m_ui->buttonBox->addButton(tr("Log"), QDialogButtonBox::ActionRole);
|
||||||
|
connect(m_logButton, SIGNAL(clicked()), this, SLOT(slotLog()));
|
||||||
|
|
||||||
m_refreshButton = m_ui->buttonBox->addButton(tr("Refresh"), QDialogButtonBox::ActionRole);
|
m_refreshButton = m_ui->buttonBox->addButton(tr("Refresh"), QDialogButtonBox::ActionRole);
|
||||||
connect(m_refreshButton, SIGNAL(clicked()), this, SLOT(slotRefresh()));
|
connect(m_refreshButton, SIGNAL(clicked()), this, SLOT(slotRefresh()));
|
||||||
|
|
||||||
@@ -168,6 +172,7 @@ void BranchDialog::slotEnableButtons(const QItemSelection &selected)
|
|||||||
|
|
||||||
m_checkoutButton->setEnabled(otherLocalSelected);
|
m_checkoutButton->setEnabled(otherLocalSelected);
|
||||||
m_diffButton->setEnabled(branchSelected);
|
m_diffButton->setEnabled(branchSelected);
|
||||||
|
m_logButton->setEnabled(branchSelected);
|
||||||
m_deleteButton->setEnabled(otherLocalSelected);
|
m_deleteButton->setEnabled(otherLocalSelected);
|
||||||
m_refreshButton->setEnabled(hasRepository);
|
m_refreshButton->setEnabled(hasRepository);
|
||||||
// Also disable <New Branch> entry of list view
|
// Also disable <New Branch> entry of list view
|
||||||
@@ -258,6 +263,18 @@ void BranchDialog::slotDiffSelected()
|
|||||||
gitClient()->diffBranch(m_repository, QStringList(), m_remoteModel->branchName(idx));
|
gitClient()->diffBranch(m_repository, QStringList(), m_remoteModel->branchName(idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BranchDialog::slotLog()
|
||||||
|
{
|
||||||
|
int idx = selectedLocalBranchIndex();
|
||||||
|
if (idx != -1) {
|
||||||
|
gitClient()->graphLog(m_repository, m_localModel->branchName(idx));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
idx = selectedRemoteBranchIndex();
|
||||||
|
if (idx != -1)
|
||||||
|
gitClient()->graphLog(m_repository, m_remoteModel->branchName(idx));
|
||||||
|
}
|
||||||
|
|
||||||
/* Ask to stash away changes and then close dialog and do an asynchronous
|
/* Ask to stash away changes and then close dialog and do an asynchronous
|
||||||
* checkout. */
|
* checkout. */
|
||||||
void BranchDialog::slotCheckoutSelectedBranch()
|
void BranchDialog::slotCheckoutSelectedBranch()
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ private slots:
|
|||||||
void slotCheckoutSelectedBranch();
|
void slotCheckoutSelectedBranch();
|
||||||
void slotDeleteSelectedBranch();
|
void slotDeleteSelectedBranch();
|
||||||
void slotDiffSelected();
|
void slotDiffSelected();
|
||||||
|
void slotLog();
|
||||||
void slotRefresh();
|
void slotRefresh();
|
||||||
void slotLocalBranchActivated();
|
void slotLocalBranchActivated();
|
||||||
void slotRemoteBranchActivated(const QModelIndex &);
|
void slotRemoteBranchActivated(const QModelIndex &);
|
||||||
@@ -87,6 +88,7 @@ private:
|
|||||||
Ui::BranchDialog *m_ui;
|
Ui::BranchDialog *m_ui;
|
||||||
QPushButton *m_checkoutButton;
|
QPushButton *m_checkoutButton;
|
||||||
QPushButton *m_diffButton;
|
QPushButton *m_diffButton;
|
||||||
|
QPushButton *m_logButton;
|
||||||
QPushButton *m_refreshButton;
|
QPushButton *m_refreshButton;
|
||||||
QPushButton *m_deleteButton;
|
QPushButton *m_deleteButton;
|
||||||
|
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ void GitClient::status(const QString &workingDirectory)
|
|||||||
static const char graphLogFormatC[] = "%h %an %s %ci";
|
static const char graphLogFormatC[] = "%h %an %s %ci";
|
||||||
|
|
||||||
// Create a graphical log.
|
// Create a graphical log.
|
||||||
void GitClient::graphLog(const QString &workingDirectory)
|
void GitClient::graphLog(const QString &workingDirectory, const QString & branch)
|
||||||
{
|
{
|
||||||
if (Git::Constants::debug)
|
if (Git::Constants::debug)
|
||||||
qDebug() << "log" << workingDirectory;
|
qDebug() << "log" << workingDirectory;
|
||||||
@@ -304,7 +304,13 @@ void GitClient::graphLog(const QString &workingDirectory)
|
|||||||
arguments << (QLatin1String("--pretty=format:") + QLatin1String(graphLogFormatC))
|
arguments << (QLatin1String("--pretty=format:") + QLatin1String(graphLogFormatC))
|
||||||
<< QLatin1String("--topo-order") << QLatin1String("--graph");
|
<< QLatin1String("--topo-order") << QLatin1String("--graph");
|
||||||
|
|
||||||
const QString title = tr("Git Log");
|
QString title;
|
||||||
|
if (branch.isEmpty()) {
|
||||||
|
title = tr("Git Log");
|
||||||
|
} else {
|
||||||
|
title = tr("Git Log %1").arg(branch);
|
||||||
|
arguments << branch;
|
||||||
|
}
|
||||||
const QString editorId = QLatin1String(Git::Constants::GIT_LOG_EDITOR_ID);
|
const QString editorId = QLatin1String(Git::Constants::GIT_LOG_EDITOR_ID);
|
||||||
const QString sourceFile = VCSBase::VCSBaseEditor::getSource(workingDirectory, QStringList());
|
const QString sourceFile = VCSBase::VCSBaseEditor::getSource(workingDirectory, QStringList());
|
||||||
VCSBase::VCSBaseEditor *editor = createVCSEditor(editorId, title, sourceFile, false, "logFileName", sourceFile);
|
VCSBase::VCSBaseEditor *editor = createVCSEditor(editorId, title, sourceFile, false, "logFileName", sourceFile);
|
||||||
|
|||||||
@@ -87,7 +87,8 @@ public:
|
|||||||
const QString &branchName);
|
const QString &branchName);
|
||||||
|
|
||||||
void status(const QString &workingDirectory);
|
void status(const QString &workingDirectory);
|
||||||
void graphLog(const QString &workingDirectory);
|
void graphLog(const QString &workingDirectory) { graphLog(workingDirectory, QString()); }
|
||||||
|
void graphLog(const QString &workingDirectory, const QString &branch);
|
||||||
void log(const QString &workingDirectory, const QStringList &fileNames,
|
void log(const QString &workingDirectory, const QStringList &fileNames,
|
||||||
bool enableAnnotationContextMenu = false);
|
bool enableAnnotationContextMenu = false);
|
||||||
void blame(const QString &workingDirectory, const QString &fileName,
|
void blame(const QString &workingDirectory, const QString &fileName,
|
||||||
|
|||||||
Reference in New Issue
Block a user