Commit e7b7b5f2 authored by cerf's avatar cerf Committed by Tobias Hunger

Bazaar: fix incomplete list of files in the diff editor

BazaarEditor::fileNameFromDiffSpecification() was not seeing all lines
starting with "+++ file".
Searching for "=== modified file 'file'" instead solves the problem

Change-Id: Ib1d4c839543f0f8cc00ecbfaa177b369a4c20ee1
Merge-request: 330
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
Reviewed-on: http://codereview.qt.nokia.com/78
parent d67b7d17
......@@ -56,7 +56,7 @@ using namespace Bazaar;
BazaarEditor::BazaarEditor(const VCSBase::VCSBaseEditorParameters *type, QWidget *parent)
: VCSBase::VCSBaseEditorWidget(type, parent),
m_exactChangesetId(QLatin1String(Constants::CHANGESET_ID_EXACT)),
m_diffFileId(QLatin1String("^(=== modified file '.*'$)"))
m_diffFileId(QLatin1String("^=== modified file '(.*)'\\s*$"))
{
setAnnotateRevisionTextFormat(tr("Annotate %1"));
setAnnotatePreviousRevisionTextFormat(tr("Annotate parent revision %1"));
......@@ -110,20 +110,10 @@ QString BazaarEditor::fileNameFromDiffSpecification(const QTextBlock &inBlock) c
{
// Check for:
// === modified file 'mainwindow.cpp'
// --- mainwindow.cpp<tab>2011-03-28 08:12:28 +0000
// +++ mainwindow.cpp<tab>2011-03-28 08:53:55 +0000
const QString newFileIndicator = QLatin1String("+++ ");
const QChar tab = QLatin1Char('\t');
for (QTextBlock block = inBlock; block.isValid(); block = block.previous()) {
const QString line = block.text();
if (line.startsWith(newFileIndicator)) {
const int tabIndex = line.indexOf(tab);
if (tabIndex != -1) {
const QString diffFileName = line.mid(newFileIndicator.size(),
tabIndex - newFileIndicator.size());
return findDiffFile(diffFileName);
}
}
if (m_diffFileId.indexIn(line) != -1)
return findDiffFile(m_diffFileId.cap(1), BazaarPlugin::instance()->versionControl());
}
return QString();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment