Git: Support annotate revision for renamed files

Change-Id: I6993cdd6f91f29b6f4e990cc5ba332ff63f7ed9f
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2013-10-06 20:55:33 +03:00
committed by Orgad Shaneh
parent 2a54270525
commit 5e585b9eee
4 changed files with 29 additions and 2 deletions

View File

@@ -684,6 +684,12 @@ bool VcsBaseEditorWidget::supportChangeLinks() const
}
}
QString VcsBaseEditorWidget::fileNameForLine(int line) const
{
Q_UNUSED(line);
return source();
}
void VcsBaseEditorWidget::init()
{
d->m_editor = editor();
@@ -1414,8 +1420,13 @@ void VcsBaseEditorWidget::addDiffActions(QMenu *, const DiffChunk &)
void VcsBaseEditorWidget::slotAnnotateRevision()
{
if (const QAction *a = qobject_cast<const QAction *>(sender())) {
QFileInfo fi(source());
emit annotateRevisionRequested(fi.absolutePath(), fi.fileName(),
const int currentLine = editor()->currentLine();
const QString fileName = fileNameForLine(currentLine);
QString workingDirectory = d->m_workingDirectory;
if (workingDirectory.isEmpty())
workingDirectory = QFileInfo(fileName).absolutePath();
emit annotateRevisionRequested(workingDirectory,
QDir(workingDirectory).relativeFilePath(fileName),
a->data().toString(), currentLine);
}
}