summaryrefslogtreecommitdiff
path: root/src/plugins/vcsbase
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2013-10-06 20:55:33 +0300
committerOrgad Shaneh <orgads@gmail.com>2013-10-10 19:00:01 +0200
commit5e585b9eee12fec02f2ddc8c88ca1f902e9d3200 (patch)
treebd04325ee7737106edf0fed57eceb1754c080078 /src/plugins/vcsbase
parent2a542705252592652c00c084bb3fac4469372c74 (diff)
downloadqt-creator-5e585b9eee12fec02f2ddc8c88ca1f902e9d3200.tar.gz
Git: Support annotate revision for renamed files
Change-Id: I6993cdd6f91f29b6f4e990cc5ba332ff63f7ed9f Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Diffstat (limited to 'src/plugins/vcsbase')
-rw-r--r--src/plugins/vcsbase/vcsbaseeditor.cpp15
-rw-r--r--src/plugins/vcsbase/vcsbaseeditor.h1
2 files changed, 14 insertions, 2 deletions
diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp
index a7be34a5a9..fe72592fb1 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.cpp
+++ b/src/plugins/vcsbase/vcsbaseeditor.cpp
@@ -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);
}
}
diff --git a/src/plugins/vcsbase/vcsbaseeditor.h b/src/plugins/vcsbase/vcsbaseeditor.h
index b932defb33..7c0654dae6 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.h
+++ b/src/plugins/vcsbase/vcsbaseeditor.h
@@ -107,6 +107,7 @@ protected:
// Pattern for log entry. hash/revision number must be in the first capture group
void setLogEntryPattern(const QRegExp &pattern);
virtual bool supportChangeLinks() const;
+ virtual QString fileNameForLine(int line) const;
public:
virtual void init();