diff --git a/src/plugins/git/clonewizardpage.cpp b/src/plugins/git/clonewizardpage.cpp index c7d0667fd54ba1c82b3f2476d738506a3c57b3b3..3d678210d09b31ef64300bcdbc5feca4d0da221b 100644 --- a/src/plugins/git/clonewizardpage.cpp +++ b/src/plugins/git/clonewizardpage.cpp @@ -164,9 +164,9 @@ QSharedPointer<VCSBase::AbstractCheckoutJob> CloneWizardPage::createCheckoutJob( QStringList CloneWizardPage::branches(const QString &repository, int *current) { - // Run git on remote repository if URL is complete + // Run git on remote repository if an URL was specified. *current = 0; - if (!repository.endsWith(d->gitPostFix)) + if (repository.isEmpty()) return QStringList(); const QStringList branches = Internal::GitPlugin::instance()->gitClient()->synchronousRepositoryBranches(repository); *current = branches.indexOf(QLatin1String("master")); diff --git a/src/plugins/git/giteditor.cpp b/src/plugins/git/giteditor.cpp index bb89ffdc3c1895892e754315461b7ceaab40fdf9..b378acbb6bc08e039521d92a6398e1b74a771490 100644 --- a/src/plugins/git/giteditor.cpp +++ b/src/plugins/git/giteditor.cpp @@ -66,6 +66,7 @@ GitEditor::GitEditor(const VCSBase::VCSBaseEditorParameters *type, QTC_ASSERT(m_changeNumberPattern8.isValid(), return); QTC_ASSERT(m_changeNumberPattern40.isValid(), return); setAnnotateRevisionTextFormat(tr("Blame %1")); + setAnnotatePreviousRevisionTextFormat(tr("Blame parent revision %1")); if (Git::Constants::debug) qDebug() << "GitEditor::GitEditor" << type->type << type->id; } diff --git a/src/plugins/mercurial/mercurialeditor.cpp b/src/plugins/mercurial/mercurialeditor.cpp index e38d30b886ebc777a625a4a85308e624d71b39f1..061730eec279914f5c74690f026bd0cd0414b44f 100644 --- a/src/plugins/mercurial/mercurialeditor.cpp +++ b/src/plugins/mercurial/mercurialeditor.cpp @@ -55,6 +55,7 @@ MercurialEditor::MercurialEditor(const VCSBase::VCSBaseEditorParameters *type, Q diffIdentifier(QLatin1String(Constants::DIFFIDENTIFIER)) { setAnnotateRevisionTextFormat(tr("Annotate %1")); + setAnnotatePreviousRevisionTextFormat(tr("Annotate parent revision %1")); } QSet<QString> MercurialEditor::annotationChanges() const diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index af184590093bac4fbd8448eb7656a75e46d62d10..83f7d7938a87cc4071784fd0beda3847678af887 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -158,6 +158,7 @@ struct VCSBaseEditorPrivate QList<int> m_diffSections; // line number where this section starts int m_cursorLine; QString m_annotateRevisionTextFormat; + QString m_annotatePreviousRevisionTextFormat; QString m_copyRevisionTextFormat; bool m_fileLogAnnotateEnabled; }; @@ -246,6 +247,16 @@ void VCSBaseEditor::setAnnotateRevisionTextFormat(const QString &f) d->m_annotateRevisionTextFormat = f; } +QString VCSBaseEditor::annotatePreviousRevisionTextFormat() const +{ + return d->m_annotatePreviousRevisionTextFormat; +} + +void VCSBaseEditor::setAnnotatePreviousRevisionTextFormat(const QString &f) +{ + d->m_annotatePreviousRevisionTextFormat = f; +} + QString VCSBaseEditor::copyRevisionTextFormat() const { return d->m_copyRevisionTextFormat; @@ -405,9 +416,12 @@ QAction *VCSBaseEditor::createDescribeAction(const QString &change) return a; } -QAction *VCSBaseEditor::createAnnotateAction(const QString &change) +QAction *VCSBaseEditor::createAnnotateAction(const QString &change, bool previous) { - QAction *a = new QAction(d->m_annotateRevisionTextFormat.arg(change), 0); + // Use 'previous' format if desired and available, else default to standard. + const QString &format = previous && !d->m_annotatePreviousRevisionTextFormat.isEmpty() ? + d->m_annotatePreviousRevisionTextFormat : d->m_annotateRevisionTextFormat; + QAction *a = new QAction(format.arg(change), 0); a->setData(change); connect(a, SIGNAL(triggered()), this, SLOT(slotAnnotateRevision())); return a; @@ -434,7 +448,7 @@ void VCSBaseEditor::contextMenuEvent(QContextMenuEvent *e) menu->addAction(createCopyRevisionAction(d->m_currentChange)); menu->addAction(createDescribeAction(d->m_currentChange)); if (d->m_fileLogAnnotateEnabled) - menu->addAction(createAnnotateAction(d->m_currentChange)); + menu->addAction(createAnnotateAction(d->m_currentChange, false)); break; case AnnotateOutput: { // Describe current / annotate previous menu->addSeparator(); @@ -444,7 +458,7 @@ void VCSBaseEditor::contextMenuEvent(QContextMenuEvent *e) if (!previousVersions.isEmpty()) { menu->addSeparator(); foreach(const QString &pv, previousVersions) - menu->addAction(createAnnotateAction(pv)); + menu->addAction(createAnnotateAction(pv, true)); } // has previous versions } break; diff --git a/src/plugins/vcsbase/vcsbaseeditor.h b/src/plugins/vcsbase/vcsbaseeditor.h index 19aa82ab7af55a84c503268f19929d91ccd910be..f03a83554b3243ceb8645f81736f471de400a07b 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.h +++ b/src/plugins/vcsbase/vcsbaseeditor.h @@ -119,6 +119,11 @@ public: QString annotateRevisionTextFormat() const; void setAnnotateRevisionTextFormat(const QString &); + // Format for "Annotate Previous" revision menu entries. Should contain '%1" placeholder. + // Defaults to "annotateRevisionTextFormat" if unset. + QString annotatePreviousRevisionTextFormat() const; + void setAnnotatePreviousRevisionTextFormat(const QString &); + // Format for "Copy" revision menu entries. Should contain '%1" placeholder QString copyRevisionTextFormat() const; void setCopyRevisionTextFormat(const QString &); @@ -230,7 +235,7 @@ private: void jumpToChangeFromDiff(QTextCursor cursor); QAction *createDescribeAction(const QString &change); - QAction *createAnnotateAction(const QString &change); + QAction *createAnnotateAction(const QString &change, bool previous = false); QAction *createCopyRevisionAction(const QString &change); VCSBaseEditorPrivate *d;