Commit 7c0f4e8f authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

VCS[SVN, CVS, Perforce]: Implement "Annotate Previous" context menu.

in annotation editor, including base infrastructure in
VCSBaseEditor. Pass signals of VCSBaseEditor to opaque
VCSBaseEditable (IEditor) for convenience.

Task-number: QTCREATORBUG-503
parent 0afaf1f2
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
**************************************************************************/ **************************************************************************/
#include "cvseditor.h" #include "cvseditor.h"
#include "cvsutils.h"
#include "annotationhighlighter.h" #include "annotationhighlighter.h"
#include "cvsconstants.h" #include "cvsconstants.h"
...@@ -148,5 +149,13 @@ QString CVSEditor::fileNameFromDiffSpecification(const QTextBlock &inBlock) cons ...@@ -148,5 +149,13 @@ QString CVSEditor::fileNameFromDiffSpecification(const QTextBlock &inBlock) cons
return QString(); return QString();
} }
QStringList CVSEditor::annotationPreviousVersions(const QString &revision, QString *actionTextFormat) const
{
if (isFirstRevision(revision))
return QStringList();
*actionTextFormat = tr("Annotate revision \"%1\"");
return QStringList(previousRevision(revision));
}
} }
} }
...@@ -51,6 +51,7 @@ private: ...@@ -51,6 +51,7 @@ private:
virtual VCSBase::DiffHighlighter *createDiffHighlighter() const; virtual VCSBase::DiffHighlighter *createDiffHighlighter() const;
virtual VCSBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes) const; virtual VCSBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes) const;
virtual QString fileNameFromDiffSpecification(const QTextBlock &diffFileName) const; virtual QString fileNameFromDiffSpecification(const QTextBlock &diffFileName) const;
virtual QStringList annotationPreviousVersions(const QString &revision, QString *actionTextFormat) const;
const QRegExp m_revisionAnnotationPattern; const QRegExp m_revisionAnnotationPattern;
const QRegExp m_revisionLogPattern; const QRegExp m_revisionLogPattern;
......
...@@ -690,21 +690,33 @@ void CVSPlugin::annotateCurrentFile() ...@@ -690,21 +690,33 @@ void CVSPlugin::annotateCurrentFile()
annotate(state.currentFileTopLevel(), state.relativeCurrentFile()); annotate(state.currentFileTopLevel(), state.relativeCurrentFile());
} }
void CVSPlugin::annotate(const QString &workingDir, const QString &file) void CVSPlugin::annotateVersion(const QString &file, const QString &revision, int lineNumber)
{
const QFileInfo fi(file);
annotate(fi.absolutePath(), fi.fileName(), revision, lineNumber);
}
void CVSPlugin::annotate(const QString &workingDir, const QString &file,
const QString &revision /* = QString() */,
int lineNumber /* = -1 */)
{ {
const QStringList files(file); const QStringList files(file);
QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(workingDir, files); QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(workingDir, files);
const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir, files); const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir, files, revision);
const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, file); const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, file);
QStringList args; QStringList args;
args << QLatin1String("annotate") << file; args << QLatin1String("annotate");
if (!revision.isEmpty())
args << QLatin1String("-r") << revision;
args << file;
const CVSResponse response = runCVS(workingDir, args, m_settings.timeOutMS(), false, codec); const CVSResponse response = runCVS(workingDir, args, m_settings.timeOutMS(), false, codec);
if (response.result != CVSResponse::Ok) if (response.result != CVSResponse::Ok)
return; return;
// Re-use an existing view if possible to support // Re-use an existing view if possible to support
// the common usage pattern of continuously changing and diffing a file // the common usage pattern of continuously changing and diffing a file
const int lineNumber = VCSBase::VCSBaseEditor::lineNumberOfCurrentEditor(file); if (lineNumber < 1)
lineNumber = VCSBase::VCSBaseEditor::lineNumberOfCurrentEditor(file);
if (Core::IEditor *editor = locateEditor("annotateFileName", id)) { if (Core::IEditor *editor = locateEditor("annotateFileName", id)) {
editor->createNew(response.stdOut); editor->createNew(response.stdOut);
...@@ -714,6 +726,8 @@ void CVSPlugin::annotate(const QString &workingDir, const QString &file) ...@@ -714,6 +726,8 @@ void CVSPlugin::annotate(const QString &workingDir, const QString &file)
const QString title = QString::fromLatin1("cvs annotate %1").arg(id); const QString title = QString::fromLatin1("cvs annotate %1").arg(id);
Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::AnnotateOutput, source, codec); Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::AnnotateOutput, source, codec);
newEditor->setProperty("annotateFileName", id); newEditor->setProperty("annotateFileName", id);
connect(newEditor, SIGNAL(annotatePreviousRequested(QString,QString,int)),
this, SLOT(annotateVersion(QString,QString,int)));
VCSBase::VCSBaseEditor::gotoLineOfEditor(newEditor, lineNumber); VCSBase::VCSBaseEditor::gotoLineOfEditor(newEditor, lineNumber);
} }
} }
...@@ -729,22 +743,6 @@ void CVSPlugin::projectStatus() ...@@ -729,22 +743,6 @@ void CVSPlugin::projectStatus()
showOutputInEditor(tr("Project status"), response.stdOut, VCSBase::RegularCommandOutput, state.currentProjectTopLevel(), 0); showOutputInEditor(tr("Project status"), response.stdOut, VCSBase::RegularCommandOutput, state.currentProjectTopLevel(), 0);
} }
// Decrement version number "1.2" -> "1.1"
static QString previousRevision(const QString &rev)
{
const int dotPos = rev.lastIndexOf(QLatin1Char('.'));
if (dotPos == -1)
return rev;
const int minor = rev.mid(dotPos + 1).toInt();
return rev.left(dotPos + 1) + QString::number(minor - 1);
}
// Is "[1.2...].1"?
static inline bool isFirstRevision(const QString &r)
{
return r.endsWith(QLatin1String(".1"));
}
void CVSPlugin::slotDescribe(const QString &source, const QString &changeNr) void CVSPlugin::slotDescribe(const QString &source, const QString &changeNr)
{ {
QString errorMessage; QString errorMessage;
......
...@@ -107,6 +107,7 @@ private slots: ...@@ -107,6 +107,7 @@ private slots:
void startCommitCurrentFile(); void startCommitCurrentFile();
void filelogCurrentFile(); void filelogCurrentFile();
void annotateCurrentFile(); void annotateCurrentFile();
void annotateVersion(const QString &file, const QString &revision, int lineNumber);
void projectStatus(); void projectStatus();
void slotDescribe(const QString &source, const QString &changeNr); void slotDescribe(const QString &source, const QString &changeNr);
void updateProject(); void updateProject();
...@@ -129,7 +130,8 @@ private: ...@@ -129,7 +130,8 @@ private:
bool showStdOutInOutputWindow, QTextCodec *outputCodec = 0, bool showStdOutInOutputWindow, QTextCodec *outputCodec = 0,
bool mergeStderr = false); bool mergeStderr = false);
void annotate(const QString &workingDir, const QString &file); void annotate(const QString &workingDir, const QString &file,
const QString &revision = QString(), int lineNumber= -1);
bool describe(const QString &source, const QString &changeNr, QString *errorMessage); bool describe(const QString &source, const QString &changeNr, QString *errorMessage);
bool describe(const QString &toplevel, const QString &source, const QString &changeNr, QString *errorMessage); bool describe(const QString &toplevel, const QString &source, const QString &changeNr, QString *errorMessage);
bool describe(const QString &repository, QList<CVS_LogEntry> entries, QString *errorMessage); bool describe(const QString &repository, QList<CVS_LogEntry> entries, QString *errorMessage);
......
...@@ -234,5 +234,21 @@ StateList parseStatusOutput(const QString &directory, const QString &output) ...@@ -234,5 +234,21 @@ StateList parseStatusOutput(const QString &directory, const QString &output)
return changeSet; return changeSet;
} }
// Decrement version number "1.2" -> "1.1"
QString previousRevision(const QString &rev)
{
const int dotPos = rev.lastIndexOf(QLatin1Char('.'));
if (dotPos == -1)
return rev;
const int minor = rev.mid(dotPos + 1).toInt();
return rev.left(dotPos + 1) + QString::number(minor - 1);
}
// Is "[1.2...].1"?
bool isFirstRevision(const QString &r)
{
return r.endsWith(QLatin1String(".1"));
}
} // namespace Internal } // namespace Internal
} // namespace CVS } // namespace CVS
...@@ -80,6 +80,11 @@ QString fixDiffOutput(QString d); ...@@ -80,6 +80,11 @@ QString fixDiffOutput(QString d);
typedef QList<CVSSubmitEditor::StateFilePair> StateList; typedef QList<CVSSubmitEditor::StateFilePair> StateList;
StateList parseStatusOutput(const QString &directory, const QString &output); StateList parseStatusOutput(const QString &directory, const QString &output);
// Revision number utilities: Decrement version number "1.2" -> "1.1"
QString previousRevision(const QString &rev);
// Revision number utilities: Is it "[1.2...].1"?
bool isFirstRevision(const QString &r);
} // namespace Internal } // namespace Internal
} // namespace CVS } // namespace CVS
......
...@@ -154,5 +154,15 @@ QString PerforceEditor::fileNameFromDiffSpecification(const QTextBlock &inBlock) ...@@ -154,5 +154,15 @@ QString PerforceEditor::fileNameFromDiffSpecification(const QTextBlock &inBlock)
return QString(); return QString();
} }
QStringList PerforceEditor::annotationPreviousVersions(const QString &v, QString *actionTextFormat) const
{
bool ok;
const int changeList = v.toInt(&ok);
if (!ok || changeList < 2)
return QStringList();
*actionTextFormat = tr("Annotate change list \"%1\"");
return QStringList(QString::number(changeList - 1));
}
} // namespace Internal } // namespace Internal
} // namespace Perforce } // namespace Perforce
...@@ -53,6 +53,7 @@ private: ...@@ -53,6 +53,7 @@ private:
virtual VCSBase::DiffHighlighter *createDiffHighlighter() const; virtual VCSBase::DiffHighlighter *createDiffHighlighter() const;
virtual VCSBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes) const; virtual VCSBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes) const;
virtual QString fileNameFromDiffSpecification(const QTextBlock &diffFileName) const; virtual QString fileNameFromDiffSpecification(const QTextBlock &diffFileName) const;
virtual QStringList annotationPreviousVersions(const QString &v, QString *actionTextFormat) const;
const QRegExp m_changeNumberPattern; const QRegExp m_changeNumberPattern;
PerforcePlugin *m_plugin; PerforcePlugin *m_plugin;
......
...@@ -683,22 +683,40 @@ void PerforcePlugin::annotate() ...@@ -683,22 +683,40 @@ void PerforcePlugin::annotate()
} }
} }
void PerforcePlugin::annotate(const QString &workingDir, const QString &fileName) void PerforcePlugin::annotateVersion(const QString &file, const QString &revision, int lineNumber)
{
const QFileInfo fi(file);
annotate(fi.absolutePath(), fi.fileName(), revision, lineNumber);
}
void PerforcePlugin::annotate(const QString &workingDir,
const QString &fileName,
const QString &changeList /* = QString() */,
int lineNumber /* = -1 */)
{ {
const QStringList files = QStringList(fileName); const QStringList files = QStringList(fileName);
QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(workingDir, files); QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(workingDir, files);
const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir, files); const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir, files, changeList);
const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, files); const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, files);
QStringList args; QStringList args;
args << QLatin1String("annotate") << QLatin1String("-cqi") << fileName; args << QLatin1String("annotate") << QLatin1String("-cqi");
if (changeList.isEmpty()) {
args << fileName;
} else {
args << (fileName + QLatin1Char('@') + changeList);
}
const PerforceResponse result = runP4Cmd(workingDir, args, const PerforceResponse result = runP4Cmd(workingDir, args,
CommandToWindow|StdErrToWindow|ErrorToWindow, CommandToWindow|StdErrToWindow|ErrorToWindow,
QStringList(), QByteArray(), codec); QStringList(), QByteArray(), codec);
if (!result.error) { if (!result.error) {
const int lineNumber = VCSBase::VCSBaseEditor::lineNumberOfCurrentEditor(); if (lineNumber < 1)
lineNumber = VCSBase::VCSBaseEditor::lineNumberOfCurrentEditor();
const QFileInfo fi(fileName); const QFileInfo fi(fileName);
Core::IEditor *ed = showOutputInEditor(tr("p4 annotate %1").arg(id), Core::IEditor *ed = showOutputInEditor(tr("p4 annotate %1").arg(id),
result.stdOut, VCSBase::AnnotateOutput, codec); result.stdOut, VCSBase::AnnotateOutput,
source, codec);
connect(ed, SIGNAL(annotatePreviousRequested(QString,QString,int)),
this, SLOT(annotateVersion(QString,QString,int)));
VCSBase::VCSBaseEditor::gotoLineOfEditor(ed, lineNumber); VCSBase::VCSBaseEditor::gotoLineOfEditor(ed, lineNumber);
} }
} }
...@@ -730,7 +748,10 @@ void PerforcePlugin::filelog(const QString &workingDir, const QStringList &fileN ...@@ -730,7 +748,10 @@ void PerforcePlugin::filelog(const QString &workingDir, const QStringList &fileN
CommandToWindow|StdErrToWindow|ErrorToWindow, CommandToWindow|StdErrToWindow|ErrorToWindow,
QStringList(), QByteArray(), codec); QStringList(), QByteArray(), codec);
if (!result.error) if (!result.error)
showOutputInEditor(tr("p4 filelog %1").arg(id), result.stdOut, VCSBase::LogOutput, codec); showOutputInEditor(tr("p4 filelog %1").arg(id), result.stdOut,
VCSBase::LogOutput,
VCSBase::VCSBaseEditor::getSource(workingDir, fileNames),
codec);
} }
void PerforcePlugin::updateActions(VCSBase::VCSBasePlugin::ActionState as) void PerforcePlugin::updateActions(VCSBase::VCSBasePlugin::ActionState as)
...@@ -1078,7 +1099,9 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QString &workingDir, ...@@ -1078,7 +1099,9 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QString &workingDir,
} }
Core::IEditor * PerforcePlugin::showOutputInEditor(const QString& title, const QString output, Core::IEditor * PerforcePlugin::showOutputInEditor(const QString& title, const QString output,
int editorType, QTextCodec *codec) int editorType,
const QString &source,
QTextCodec *codec)
{ {
const VCSBase::VCSBaseEditorParameters *params = findType(editorType); const VCSBase::VCSBaseEditorParameters *params = findType(editorType);
QTC_ASSERT(params, return 0); QTC_ASSERT(params, return 0);
...@@ -1090,6 +1113,7 @@ Core::IEditor * PerforcePlugin::showOutputInEditor(const QString& title, const Q ...@@ -1090,6 +1113,7 @@ Core::IEditor * PerforcePlugin::showOutputInEditor(const QString& title, const Q
PerforceEditor *e = qobject_cast<PerforceEditor*>(editor->widget()); PerforceEditor *e = qobject_cast<PerforceEditor*>(editor->widget());
if (!e) if (!e)
return 0; return 0;
e->setSource(source);
s.replace(QLatin1Char(' '), QLatin1Char('_')); s.replace(QLatin1Char(' '), QLatin1Char('_'));
e->setSuggestedFileName(s); e->setSuggestedFileName(s);
if (codec) if (codec)
...@@ -1138,7 +1162,9 @@ void PerforcePlugin::p4Diff(const QString &workingDir, const QStringList &files) ...@@ -1138,7 +1162,9 @@ void PerforcePlugin::p4Diff(const QString &workingDir, const QStringList &files)
existingEditor->createNew(result.stdOut); existingEditor->createNew(result.stdOut);
Core::EditorManager::instance()->activateEditor(existingEditor); Core::EditorManager::instance()->activateEditor(existingEditor);
} else { } else {
Core::IEditor *editor = showOutputInEditor(tr("p4 diff %1").arg(id), result.stdOut, VCSBase::DiffOutput, codec); Core::IEditor *editor = showOutputInEditor(tr("p4 diff %1").arg(id), result.stdOut, VCSBase::DiffOutput,
VCSBase::VCSBaseEditor::getSource(workingDir, files),
codec);
editor->file()->setProperty("originalFileName", id); editor->file()->setProperty("originalFileName", id);
} }
} }
...@@ -1151,7 +1177,7 @@ void PerforcePlugin::describe(const QString & source, const QString &n) ...@@ -1151,7 +1177,7 @@ void PerforcePlugin::describe(const QString & source, const QString &n)
const PerforceResponse result = runP4Cmd(m_settings.topLevel(), args, CommandToWindow|StdErrToWindow|ErrorToWindow, const PerforceResponse result = runP4Cmd(m_settings.topLevel(), args, CommandToWindow|StdErrToWindow|ErrorToWindow,
QStringList(), QByteArray(), codec); QStringList(), QByteArray(), codec);
if (!result.error) if (!result.error)
showOutputInEditor(tr("p4 describe %1").arg(n), result.stdOut, VCSBase::DiffOutput, codec); showOutputInEditor(tr("p4 describe %1").arg(n), result.stdOut, VCSBase::DiffOutput, source, codec);
} }
void PerforcePlugin::submitCurrentLog() void PerforcePlugin::submitCurrentLog()
......
...@@ -120,6 +120,7 @@ private slots: ...@@ -120,6 +120,7 @@ private slots:
void describeChange(); void describeChange();
void annotateCurrentFile(); void annotateCurrentFile();
void annotate(); void annotate();
void annotateVersion(const QString &file, const QString &revision, int lineNumber);
void filelogCurrentFile(); void filelogCurrentFile();
void filelog(); void filelog();
...@@ -138,7 +139,7 @@ private: ...@@ -138,7 +139,7 @@ private:
typedef QHash<QString, bool> ManagedDirectoryCache; typedef QHash<QString, bool> ManagedDirectoryCache;
Core::IEditor *showOutputInEditor(const QString& title, const QString output, Core::IEditor *showOutputInEditor(const QString& title, const QString output,
int editorType, int editorType, const QString &source,
QTextCodec *codec = 0); QTextCodec *codec = 0);
// Flags for runP4Cmd. // Flags for runP4Cmd.
...@@ -174,7 +175,8 @@ private: ...@@ -174,7 +175,8 @@ private:
QTextCodec *outputCodec) const; QTextCodec *outputCodec) const;
QString clientFilePath(const QString &serverFilePath); QString clientFilePath(const QString &serverFilePath);
void annotate(const QString &workingDir, const QString &fileName); void annotate(const QString &workingDir, const QString &fileName,
const QString &changeList = QString(), int lineNumber = -1);
void filelog(const QString &workingDir, const QStringList &fileNames); void filelog(const QString &workingDir, const QStringList &fileNames);
void cleanCommitMessageFile(); void cleanCommitMessageFile();
bool isCommitEditorOpen() const; bool isCommitEditorOpen() const;
......
...@@ -137,3 +137,13 @@ QString SubversionEditor::fileNameFromDiffSpecification(const QTextBlock &inBloc ...@@ -137,3 +137,13 @@ QString SubversionEditor::fileNameFromDiffSpecification(const QTextBlock &inBloc
} }
return QString(); return QString();
} }
QStringList SubversionEditor::annotationPreviousVersions(const QString &v, QString *actionTextFormat) const
{
bool ok;
const int revision = v.toInt(&ok);
if (!ok || revision < 2)
return QStringList();
*actionTextFormat = tr("Annotate revision \"%1\"");
return QStringList(QString::number(revision - 1));
}
...@@ -51,6 +51,7 @@ private: ...@@ -51,6 +51,7 @@ private:
virtual VCSBase::DiffHighlighter *createDiffHighlighter() const; virtual VCSBase::DiffHighlighter *createDiffHighlighter() const;
virtual VCSBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes) const; virtual VCSBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes) const;
virtual QString fileNameFromDiffSpecification(const QTextBlock &diffFileName) const; virtual QString fileNameFromDiffSpecification(const QTextBlock &diffFileName) const;
virtual QStringList annotationPreviousVersions(const QString &, QString *actionTextFormat) const;
const QRegExp m_changeNumberPattern; const QRegExp m_changeNumberPattern;
const QRegExp m_revisionNumberPattern; const QRegExp m_revisionNumberPattern;
......
...@@ -712,13 +712,25 @@ void SubversionPlugin::annotateCurrentFile() ...@@ -712,13 +712,25 @@ void SubversionPlugin::annotateCurrentFile()
annotate(state.currentFileTopLevel(), state.relativeCurrentFile()); annotate(state.currentFileTopLevel(), state.relativeCurrentFile());
} }
void SubversionPlugin::annotate(const QString &workingDir, const QString &file) void SubversionPlugin::annotateVersion(const QString &file,
const QString &revision,
int lineNr)
{
const QFileInfo fi(file);
annotate(fi.absolutePath(), fi.fileName(), revision, lineNr);
}
void SubversionPlugin::annotate(const QString &workingDir, const QString &file,
const QString &revision /* = QString() */,
int lineNumber /* = -1 */)
{ {
QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(file); QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(file);
QStringList args(QLatin1String("annotate")); QStringList args(QLatin1String("annotate"));
if (m_settings.spaceIgnorantAnnotation) if (m_settings.spaceIgnorantAnnotation)
args << QLatin1String("-x") << QLatin1String("-uw"); args << QLatin1String("-x") << QLatin1String("-uw");
if (!revision.isEmpty())
args << QLatin1String("-r") << revision;
args.push_back(QLatin1String("-v")); args.push_back(QLatin1String("-v"));
args.append(QDir::toNativeSeparators(file)); args.append(QDir::toNativeSeparators(file));
...@@ -729,8 +741,10 @@ void SubversionPlugin::annotate(const QString &workingDir, const QString &file) ...@@ -729,8 +741,10 @@ void SubversionPlugin::annotate(const QString &workingDir, const QString &file)
// Re-use an existing view if possible to support // Re-use an existing view if possible to support
// the common usage pattern of continuously changing and diffing a file // the common usage pattern of continuously changing and diffing a file
const QString source = workingDir + QLatin1Char('/') + file; const QString source = workingDir + QLatin1Char('/') + file;
const int lineNumber = VCSBase::VCSBaseEditor::lineNumberOfCurrentEditor(source); if (lineNumber <= 0)
const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir, QStringList(file)); lineNumber = VCSBase::VCSBaseEditor::lineNumberOfCurrentEditor(source);
// Determine id
const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir, QStringList(file), revision);
if (Core::IEditor *editor = locateEditor("annotateFileName", id)) { if (Core::IEditor *editor = locateEditor("annotateFileName", id)) {
editor->createNew(response.stdOut); editor->createNew(response.stdOut);
...@@ -739,6 +753,8 @@ void SubversionPlugin::annotate(const QString &workingDir, const QString &file) ...@@ -739,6 +753,8 @@ void SubversionPlugin::annotate(const QString &workingDir, const QString &file)
} else { } else {
const QString title = QString::fromLatin1("svn annotate %1").arg(id); const QString title = QString::fromLatin1("svn annotate %1").arg(id);
Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::AnnotateOutput, source, codec); Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::AnnotateOutput, source, codec);
connect(newEditor, SIGNAL(annotatePreviousRequested(QString,QString,int)),
this, SLOT(annotateVersion(QString,QString,int)));
newEditor->setProperty("annotateFileName", id); newEditor->setProperty("annotateFileName", id);
VCSBase::VCSBaseEditor::gotoLineOfEditor(newEditor, lineNumber); VCSBase::VCSBaseEditor::gotoLineOfEditor(newEditor, lineNumber);
} }
......
...@@ -104,6 +104,7 @@ private slots: ...@@ -104,6 +104,7 @@ private slots:
void startCommitCurrentFile(); void startCommitCurrentFile();
void filelogCurrentFile(); void filelogCurrentFile();
void annotateCurrentFile(); void annotateCurrentFile();
void annotateVersion(const QString &file, const QString &revision, int lineNumber);
void projectStatus(); void projectStatus();
void describe(const QString &source, const QString &changeNr); void describe(const QString &source, const QString &changeNr);
void slotDescribe(); void slotDescribe();
...@@ -111,6 +112,7 @@ private slots: ...@@ -111,6 +112,7 @@ private slots:
void submitCurrentLog(); void submitCurrentLog();
void diffCommitFiles(const QStringList &); void diffCommitFiles(const QStringList &);
protected: protected:
virtual void updateActions(VCSBase::VCSBasePlugin::ActionState); virtual void updateActions(VCSBase::VCSBasePlugin::ActionState);
virtual bool submitEditorAboutToClose(VCSBase::VCSBaseSubmitEditor *submitEditor); virtual bool submitEditorAboutToClose(VCSBase::VCSBaseSubmitEditor *submitEditor);
...@@ -123,7 +125,8 @@ private: ...@@ -123,7 +125,8 @@ private:
SubversionResponse runSvn(const QString &workingDir, SubversionResponse runSvn(const QString &workingDir,
const QStringList &arguments, int timeOut, const QStringList &arguments, int timeOut,
bool showStdOutInOutputWindow, QTextCodec *outputCodec = 0); bool showStdOutInOutputWindow, QTextCodec *outputCodec = 0);
void annotate(const QString &workingDir, const QString &file); void annotate(const QString &workingDir, const QString &file,
const QString &revision = QString(), int lineNumber = -1);
void filelog(const QString &workingDir, const QStringList &file = QStringList()); void filelog(const QString &workingDir, const QStringList &file = QStringList());
bool managesDirectory(const QDir &directory) const; bool managesDirectory(const QDir &directory) const;
QString findTopLevelForDirectoryI(const QString &directory) const; QString findTopLevelForDirectoryI(const QString &directory) const;
......
...@@ -67,8 +67,11 @@ namespace VCSBase { ...@@ -67,8 +67,11 @@ namespace VCSBase {
// VCSBaseEditorEditable: An editable with no support for duplicates // VCSBaseEditorEditable: An editable with no support for duplicates
// Creates a browse combo in the toolbar for diff output. // Creates a browse combo in the toolbar for diff output.
// It also mirrors the signals of the VCSBaseEditor since the editor
// manager passes the Editable around.
class VCSBaseEditorEditable : public TextEditor::BaseTextEditorEditable class VCSBaseEditorEditable : public TextEditor::BaseTextEditorEditable
{ {
Q_OBJECT
public: public:
VCSBaseEditorEditable(VCSBaseEditor *, VCSBaseEditorEditable(VCSBaseEditor *,
const VCSBaseEditorParameters *type); const VCSBaseEditorParameters *type);
...@@ -80,6 +83,10 @@ public: ...@@ -80,6 +83,10 @@ public:
bool isTemporary() const { return true; } bool isTemporary() const { return true; }