Commit 3845c833 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

VCS: Return the editor in VcsBaseClient::annotate

Will be used in a follow-up commit for setting base line number
for limited range blame.

Change-Id: Ibae90f3ac982ebe9f53aa282f70c2c703e9eeb9d
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 779f1725
......@@ -164,12 +164,12 @@ void BazaarClient::commit(const QString &repositoryRoot, const QStringList &file
QStringList(extraOptions) << QLatin1String("-F") << commitMessageFile);
}
void BazaarClient::annotate(const QString &workingDir, const QString &file,
const QString &revision, int lineNumber,
const QStringList &extraOptions)
VcsBaseEditorWidget *BazaarClient::annotate(
const QString &workingDir, const QString &file, const QString &revision,
int lineNumber, const QStringList &extraOptions)
{
VcsBaseClient::annotate(workingDir, file, revision, lineNumber,
QStringList(extraOptions) << QLatin1String("--long"));
return VcsBaseClient::annotate(workingDir, file, revision, lineNumber,
QStringList(extraOptions) << QLatin1String("--long"));
}
QString BazaarClient::findTopLevelForFile(const QFileInfo &file) const
......
......@@ -49,9 +49,9 @@ public:
const QStringList &extraOptions = QStringList());
void commit(const QString &repositoryRoot, const QStringList &files,
const QString &commitMessageFile, const QStringList &extraOptions = QStringList());
void annotate(const QString &workingDir, const QString &file,
const QString &revision = QString(), int lineNumber = -1,
const QStringList &extraOptions = QStringList());
VcsBase::VcsBaseEditorWidget *annotate(
const QString &workingDir, const QString &file, const QString &revision = QString(),
int lineNumber = -1, const QStringList &extraOptions = QStringList());
QString findTopLevelForFile(const QFileInfo &file) const;
bool managesFile(const QString &workingDirectory, const QString &fileName) const;
......
......@@ -924,8 +924,9 @@ void GitClient::show(const QString &source, const QString &id, const QString &na
});
}
void GitClient::annotate(const QString &workingDir, const QString &file, const QString &revision,
int lineNumber, const QStringList &extraOptions)
VcsBaseEditorWidget *GitClient::annotate(
const QString &workingDir, const QString &file, const QString &revision,
int lineNumber, const QStringList &extraOptions)
{
const Id editorId = Git::Constants::GIT_BLAME_EDITOR_ID;
const QString id = VcsBaseEditor::getTitleId(workingDir, QStringList(file), revision);
......@@ -954,6 +955,7 @@ void GitClient::annotate(const QString &workingDir, const QString &file, const Q
if (!revision.isEmpty())
arguments << revision;
vcsExec(workingDir, arguments, editor, false, 0, lineNumber);
return editor;
}
bool GitClient::synchronousCheckout(const QString &workingDirectory,
......
......@@ -149,9 +149,9 @@ public:
void log(const QString &workingDirectory, const QString &fileName = QString(),
bool enableAnnotationContextMenu = false, const QStringList &args = QStringList());
void reflog(const QString &workingDirectory);
void annotate(const QString &workingDir, const QString &file,
const QString &revision = QString(), int lineNumber = -1,
const QStringList &extraOptions = QStringList()) override;
VcsBase::VcsBaseEditorWidget *annotate(
const QString &workingDir, const QString &file, const QString &revision = QString(),
int lineNumber = -1, const QStringList &extraOptions = QStringList()) override;
void reset(const QString &workingDirectory, const QString &argument, const QString &commit = QString());
void addFile(const QString &workingDirectory, const QString &fileName);
bool synchronousLog(const QString &workingDirectory,
......
......@@ -299,13 +299,13 @@ void MercurialClient::outgoing(const QString &repositoryRoot)
enqueueJob(cmd, args);
}
void MercurialClient::annotate(const QString &workingDir, const QString &file,
const QString &revision, int lineNumber,
const QStringList &extraOptions)
VcsBaseEditorWidget *MercurialClient::annotate(
const QString &workingDir, const QString &file, const QString &revision,
int lineNumber, const QStringList &extraOptions)
{
QStringList args(extraOptions);
args << QLatin1String("-u") << QLatin1String("-c") << QLatin1String("-d");
VcsBaseClient::annotate(workingDir, file, revision, lineNumber, args);
return VcsBaseClient::annotate(workingDir, file, revision, lineNumber, args);
}
void MercurialClient::commit(const QString &repositoryRoot, const QStringList &files,
......
......@@ -57,9 +57,9 @@ public:
void outgoing(const QString &repositoryRoot);
bool managesFile(const QString &workingDirectory, const QString &fileName) const;
void annotate(const QString &workingDir, const QString &file,
const QString &revision = QString(), int lineNumber = -1,
const QStringList &extraOptions = QStringList()) override;
VcsBase::VcsBaseEditorWidget *annotate(
const QString &workingDir, const QString &file, const QString &revision = QString(),
int lineNumber = -1, const QStringList &extraOptions = QStringList()) override;
void commit(const QString &repositoryRoot, const QStringList &files,
const QString &commitMessageFile,
const QStringList &extraOptions = QStringList()) override;
......
......@@ -385,10 +385,9 @@ bool VcsBaseClient::synchronousPush(const QString &workingDir,
return resp.result == Utils::SynchronousProcessResponse::Finished;
}
void VcsBaseClient::annotate(const QString &workingDir, const QString &file,
const QString &revision /* = QString() */,
int lineNumber /* = -1 */,
const QStringList &extraOptions)
VcsBaseEditorWidget *VcsBaseClient::annotate(
const QString &workingDir, const QString &file, const QString &revision /* = QString() */,
int lineNumber /* = -1 */, const QStringList &extraOptions)
{
const QString vcsCmdString = vcsCommandString(AnnotateCommand);
QStringList args;
......@@ -405,6 +404,7 @@ void VcsBaseClient::annotate(const QString &workingDir, const QString &file,
VcsCommand *cmd = createCommand(workingDir, editor);
cmd->setCookie(lineNumber);
enqueueJob(cmd, args);
return editor;
}
void VcsBaseClient::diff(const QString &workingDir, const QStringList &files,
......
......@@ -87,9 +87,9 @@ public:
virtual QProcessEnvironment processEnvironment() const;
// VCS functionality:
virtual void annotate(const QString &workingDir, const QString &file,
const QString &revision = QString(), int lineNumber = -1,
const QStringList &extraOptions = QStringList()) = 0;
virtual VcsBaseEditorWidget *annotate(
const QString &workingDir, const QString &file, const QString &revision = QString(),
int lineNumber = -1, const QStringList &extraOptions = QStringList()) = 0;
// Return converted command output, remove '\r' read on Windows
static QString commandOutputFromLocal8Bit(const QByteArray &a);
......@@ -159,9 +159,9 @@ public:
virtual bool synchronousPush(const QString &workingDir,
const QString &dstLocation,
const QStringList &extraOptions = QStringList());
void annotate(const QString &workingDir, const QString &file,
const QString &revision = QString(), int lineNumber = -1,
const QStringList &extraOptions = QStringList()) override;
VcsBaseEditorWidget *annotate(
const QString &workingDir, const QString &file, const QString &revision = QString(),
int lineNumber = -1, const QStringList &extraOptions = QStringList()) override;
virtual void diff(const QString &workingDir, const QStringList &files = QStringList(),
const QStringList &extraOptions = QStringList());
virtual void log(const QString &workingDir, const QStringList &files = QStringList(),
......
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