Git: Support change links on commit editor

Useful for commit messages with "reverts <hash>" for example.

Can later be extended for interactive rebase

Change-Id: Ibf77433ecddfacbd8d443636ddbc406bda474aa7
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2013-05-28 20:19:53 +03:00
committed by Orgad Shaneh
parent b90e3bbd8b
commit 05a6fc48ba
6 changed files with 46 additions and 2 deletions

View File

@@ -235,6 +235,16 @@ void GitEditor::init()
new GitSubmitHighlighter(baseTextDocument().data());
}
bool GitEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
{
bool res = VcsBaseEditorWidget::open(errorString, fileName, realFileName);
if (editor()->id() == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID) {
QFileInfo fi(fileName);
setSource(GitPlugin::instance()->gitClient()->findRepositoryForGitDir(fi.absolutePath()));
}
return res;
}
QString GitEditor::decorateVersion(const QString &revision) const
{
const QFileInfo fi(source());
@@ -284,5 +294,11 @@ QString GitEditor::revisionSubject(const QTextBlock &inBlock) const
return QString();
}
bool GitEditor::supportChangeLinks() const
{
return VcsBaseEditorWidget::supportChangeLinks()
|| (editor()->id() == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID);
}
} // namespace Internal
} // namespace Git