forked from qt-creator/qt-creator
Git: Support annotate revision for renamed files
Change-Id: I6993cdd6f91f29b6f4e990cc5ba332ff63f7ed9f Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
2a54270525
commit
5e585b9eee
@@ -366,5 +366,19 @@ bool GitEditor::supportChangeLinks() const
|
||||
|| (editor()->id() == Git::Constants::GIT_REBASE_EDITOR_ID);
|
||||
}
|
||||
|
||||
QString GitEditor::fileNameForLine(int line) const
|
||||
{
|
||||
// 7971b6e7 share/qtcreator/dumper/dumper.py (hjk
|
||||
QTextBlock block = document()->findBlockByLineNumber(line - 1);
|
||||
QTC_ASSERT(block.isValid(), return source());
|
||||
static QRegExp renameExp(QLatin1String("^" CHANGE_PATTERN "\\s+([^(]+)"));
|
||||
if (renameExp.indexIn(block.text()) != -1) {
|
||||
const QString fileName = renameExp.cap(1).trimmed();
|
||||
if (!fileName.isEmpty())
|
||||
return fileName;
|
||||
}
|
||||
return source();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Git
|
||||
|
||||
@@ -74,6 +74,7 @@ private:
|
||||
void addChangeActions(QMenu *menu, const QString &change);
|
||||
QString revisionSubject(const QTextBlock &inBlock) const;
|
||||
bool supportChangeLinks() const;
|
||||
QString fileNameForLine(int line) const;
|
||||
|
||||
mutable QRegExp m_changeNumberPattern;
|
||||
QString m_currentChange;
|
||||
|
||||
Reference in New Issue
Block a user