forked from qt-creator/qt-creator
VcsBase: Proliferate use of FilePath
... and update user code. Change-Id: I52c08e9e07238536d31fc72f97312ac582a1e32f Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -170,7 +170,7 @@ bool BazaarClient::managesFile(const FilePath &workingDirectory, const QString &
|
||||
return result.rawStdOut().startsWith("unknown");
|
||||
}
|
||||
|
||||
void BazaarClient::view(const QString &source, const QString &id, const QStringList &extraOptions)
|
||||
void BazaarClient::view(const FilePath &source, const QString &id, const QStringList &extraOptions)
|
||||
{
|
||||
QStringList args(QLatin1String("log"));
|
||||
args << QLatin1String("-p") << QLatin1String("-v") << extraOptions;
|
||||
|
@@ -28,7 +28,7 @@ public:
|
||||
bool isVcsDirectory(const Utils::FilePath &filePath) const;
|
||||
Utils::FilePath findTopLevelForFile(const Utils::FilePath &file) const override;
|
||||
bool managesFile(const Utils::FilePath &workingDirectory, const QString &fileName) const;
|
||||
void view(const QString &source, const QString &id,
|
||||
void view(const Utils::FilePath &source, const QString &id,
|
||||
const QStringList &extraOptions = {}) override;
|
||||
|
||||
Utils::Id vcsEditorKind(VcsCommandTag cmd) const override;
|
||||
|
@@ -172,7 +172,7 @@ public:
|
||||
bool vcsMove(const Utils::FilePath &from, const Utils::FilePath &to) final;
|
||||
bool vcsCreateRepository(const Utils::FilePath &directory) final;
|
||||
void vcsAnnotate(const Utils::FilePath &file, int line) final;
|
||||
void vcsDescribe(const Utils::FilePath &source, const QString &id) final { m_client.view(source.toString(), id); }
|
||||
void vcsDescribe(const Utils::FilePath &source, const QString &id) final { m_client.view(source, id); }
|
||||
|
||||
VcsCommand *createInitialCheckoutCommand(const QString &url,
|
||||
const Utils::FilePath &baseDirectory,
|
||||
|
@@ -253,7 +253,7 @@ private:
|
||||
QString ccViewRoot(const FilePath &directory) const;
|
||||
QString findTopLevel(const FilePath &directory) const;
|
||||
IEditor *showOutputInEditor(const QString& title, const QString &output, Id id,
|
||||
const QString &source, QTextCodec *codec) const;
|
||||
const FilePath &source, QTextCodec *codec) const;
|
||||
CommandResult runCleartoolProc(const FilePath &workingDir,
|
||||
const QStringList &arguments) const;
|
||||
CommandResult runCleartool(const FilePath &workingDir, const QStringList &arguments,
|
||||
@@ -892,7 +892,7 @@ void ClearCasePluginPrivate::updateStatusActions()
|
||||
FileStatus fileStatus = FileStatus::Unknown;
|
||||
bool hasFile = currentState().hasFile();
|
||||
if (hasFile) {
|
||||
const QString absoluteFileName = currentState().currentFile();
|
||||
const QString absoluteFileName = currentState().currentFile().toString();
|
||||
checkAndReIndexUnknownFile(absoluteFileName);
|
||||
fileStatus = vcsStatus(absoluteFileName);
|
||||
|
||||
@@ -974,7 +974,7 @@ void ClearCasePluginPrivate::setStatus(const QString &file, FileStatus::Status s
|
||||
QTC_CHECK(!file.isEmpty());
|
||||
m_statusMap->insert(file, FileStatus(status, QFileInfo(file).permissions()));
|
||||
|
||||
if (update && currentState().currentFile() == file)
|
||||
if (update && currentState().currentFile().toString() == file)
|
||||
QMetaObject::invokeMethod(this, &ClearCasePluginPrivate::updateStatusActions);
|
||||
}
|
||||
|
||||
@@ -1128,11 +1128,11 @@ void ClearCasePluginPrivate::undoHijackCurrent()
|
||||
keep = unhijackDlg.chkKeep->isChecked();
|
||||
}
|
||||
|
||||
FileChangeBlocker fcb(FilePath::fromString(state.currentFile()));
|
||||
FileChangeBlocker fcb(state.currentFile());
|
||||
|
||||
// revert
|
||||
if (vcsUndoHijack(state.currentFileTopLevel(), fileName, keep))
|
||||
emit filesChanged(QStringList(state.currentFile()));
|
||||
emit filesChanged(QStringList(state.currentFile().toString()));
|
||||
}
|
||||
|
||||
QString ClearCasePluginPrivate::ccGetFileVersion(const FilePath &workingDir, const QString &file) const
|
||||
@@ -1144,7 +1144,7 @@ void ClearCasePluginPrivate::ccDiffWithPred(const FilePath &workingDir, const QS
|
||||
{
|
||||
if (Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << files;
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, files);
|
||||
const FilePath source = VcsBaseEditor::getSource(workingDir, files);
|
||||
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(nullptr)
|
||||
: VcsBaseEditor::getCodec(source);
|
||||
|
||||
@@ -1267,7 +1267,8 @@ void ClearCasePluginPrivate::diffActivity()
|
||||
}
|
||||
m_diffPrefix.clear();
|
||||
const QString title = QString::fromLatin1("%1.patch").arg(activity);
|
||||
IEditor *editor = showOutputInEditor(title, result, diffEditorParameters.id, activity, nullptr);
|
||||
IEditor *editor = showOutputInEditor(title, result, diffEditorParameters.id,
|
||||
FilePath::fromString(activity), nullptr);
|
||||
setWorkingDirectory(editor, topLevel);
|
||||
}
|
||||
|
||||
@@ -1426,7 +1427,7 @@ void ClearCasePluginPrivate::history(const FilePath &workingDir,
|
||||
return;
|
||||
}
|
||||
const QString title = QString::fromLatin1("cc history %1").arg(id);
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, files);
|
||||
const FilePath source = VcsBaseEditor::getSource(workingDir, files);
|
||||
IEditor *newEditor = showOutputInEditor(title, result.cleanedStdOut(),
|
||||
logEditorParameters.id, source, codec);
|
||||
VcsBaseEditor::tagEditor(newEditor, tag);
|
||||
@@ -1490,7 +1491,8 @@ void ClearCasePluginPrivate::vcsAnnotateHelper(const FilePath &workingDir, const
|
||||
if (Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << file;
|
||||
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(file);
|
||||
// FIXME: Should this be something like workingDir.resolvePath(file) ?
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(FilePath::fromString(file));
|
||||
|
||||
// Determine id
|
||||
QString id = file;
|
||||
@@ -1509,7 +1511,7 @@ void ClearCasePluginPrivate::vcsAnnotateHelper(const FilePath &workingDir, const
|
||||
|
||||
// Re-use an existing view if possible to support
|
||||
// the common usage pattern of continuously changing and diffing a file
|
||||
const QString source = workingDir.pathAppended(file).toString();
|
||||
const FilePath source = workingDir.pathAppended(file);
|
||||
if (lineNumber <= 0)
|
||||
lineNumber = VcsBaseEditor::lineNumberOfCurrentEditor(source);
|
||||
|
||||
@@ -1550,7 +1552,7 @@ void ClearCasePluginPrivate::vcsDescribe(const FilePath &source, const QString &
|
||||
.relativeFilePath(source.toString()));
|
||||
const QString id = QString::fromLatin1("%1@@%2").arg(relPath, changeNr);
|
||||
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(source.toString());
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(source);
|
||||
const CommandResult result = runCleartool(topLevel, {"describe", id}, RunFlags::None, codec);
|
||||
description = result.cleanedStdOut();
|
||||
if (m_settings.extDiffAvailable)
|
||||
@@ -1564,7 +1566,7 @@ void ClearCasePluginPrivate::vcsDescribe(const FilePath &source, const QString &
|
||||
EditorManager::activateEditor(editor);
|
||||
} else {
|
||||
const QString title = QString::fromLatin1("cc describe %1").arg(id);
|
||||
IEditor *newEditor = showOutputInEditor(title, description, diffEditorParameters.id, source.toString(), codec);
|
||||
IEditor *newEditor = showOutputInEditor(title, description, diffEditorParameters.id, source, codec);
|
||||
VcsBaseEditor::tagEditor(newEditor, tag);
|
||||
}
|
||||
}
|
||||
@@ -1601,7 +1603,7 @@ CommandResult ClearCasePluginPrivate::runCleartool(const FilePath &workingDir,
|
||||
}
|
||||
|
||||
IEditor *ClearCasePluginPrivate::showOutputInEditor(const QString& title, const QString &output,
|
||||
Id id, const QString &source,
|
||||
Id id, const FilePath &source,
|
||||
QTextCodec *codec) const
|
||||
{
|
||||
if (Constants::debug)
|
||||
@@ -2172,7 +2174,7 @@ QString ClearCasePluginPrivate::getFile(const QString &nativeFile, const QString
|
||||
// runs external (GNU) diff, and returns the stdout result
|
||||
QString ClearCasePluginPrivate::diffExternal(QString file1, QString file2, bool keep)
|
||||
{
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(file1);
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(FilePath::fromString(file1));
|
||||
|
||||
// if file2 is empty, we should compare to predecessor
|
||||
if (file2.isEmpty()) {
|
||||
|
@@ -296,9 +296,9 @@ FilePaths VcsManager::repositories(const IVersionControl *versionControl)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool VcsManager::promptToDelete(IVersionControl *versionControl, const QString &fileName)
|
||||
bool VcsManager::promptToDelete(IVersionControl *versionControl, const FilePath &filePath)
|
||||
{
|
||||
return promptToDelete(versionControl, {Utils::FilePath::fromString(fileName)}).isEmpty();
|
||||
return promptToDelete(versionControl, FilePaths({filePath})).isEmpty();
|
||||
}
|
||||
|
||||
FilePaths VcsManager::promptToDelete(const FilePaths &filePaths)
|
||||
|
@@ -54,7 +54,7 @@ public:
|
||||
static Utils::FilePaths promptToDelete(const Utils::FilePaths &filePaths);
|
||||
static Utils::FilePaths promptToDelete(IVersionControl *versionControl,
|
||||
const Utils::FilePaths &filePaths);
|
||||
static bool promptToDelete(IVersionControl *versionControl, const QString &fileName);
|
||||
static bool promptToDelete(IVersionControl *versionControl, const Utils::FilePath &filePath);
|
||||
|
||||
// Shows a confirmation dialog, whether the files in the list should be
|
||||
// added to revision control. Calls vcsAdd for each file.
|
||||
|
@@ -267,7 +267,7 @@ private:
|
||||
|
||||
bool isCommitEditorOpen() const;
|
||||
Core::IEditor *showOutputInEditor(const QString& title, const QString &output,
|
||||
Utils::Id id, const QString &source, QTextCodec *codec);
|
||||
Id id, const FilePath &source, QTextCodec *codec);
|
||||
|
||||
CommandResult runCvs(const FilePath &workingDirectory, const QStringList &arguments,
|
||||
RunFlags flags = RunFlags::None, QTextCodec *outputCodec = nullptr,
|
||||
@@ -844,13 +844,13 @@ void CvsPluginPrivate::revertCurrentFile()
|
||||
Tr::tr("The file has been changed. Do you want to revert it?")))
|
||||
return;
|
||||
|
||||
FileChangeBlocker fcb(FilePath::fromString(state.currentFile()));
|
||||
FileChangeBlocker fcb(state.currentFile());
|
||||
|
||||
// revert
|
||||
const auto revertRes = runCvs(state.currentFileTopLevel(),
|
||||
{"update", "-C", state.relativeCurrentFile()}, RunFlags::ShowStdOut);
|
||||
if (revertRes.result() == ProcessResult::FinishedWithSuccess)
|
||||
emit filesChanged(QStringList(state.currentFile()));
|
||||
emit filesChanged(QStringList(state.currentFile().toString()));
|
||||
}
|
||||
|
||||
void CvsPluginPrivate::diffProject()
|
||||
@@ -985,7 +985,7 @@ void CvsPluginPrivate::filelog(const FilePath &workingDir,
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(workingDir, QStringList(file));
|
||||
// no need for temp file
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, QStringList(file));
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, file);
|
||||
const FilePath source = VcsBaseEditor::getSource(workingDir, file);
|
||||
const auto response = runCvs(workingDir, {"log", file}, RunFlags::None, codec);
|
||||
if (response.result() != ProcessResult::FinishedWithSuccess)
|
||||
return;
|
||||
@@ -1117,7 +1117,7 @@ void CvsPluginPrivate::annotate(const FilePath &workingDir, const QString &file,
|
||||
const QStringList files(file);
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(workingDir, files);
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, files, revision);
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, file);
|
||||
const FilePath source = VcsBaseEditor::getSource(workingDir, file);
|
||||
QStringList args{"annotate"};
|
||||
if (!revision.isEmpty())
|
||||
args << "-r" << revision;
|
||||
@@ -1129,7 +1129,7 @@ void CvsPluginPrivate::annotate(const FilePath &workingDir, const QString &file,
|
||||
// Re-use an existing view if possible to support
|
||||
// the common usage pattern of continuously changing and diffing a file
|
||||
if (lineNumber < 1)
|
||||
lineNumber = VcsBaseEditor::lineNumberOfCurrentEditor(file);
|
||||
lineNumber = VcsBaseEditor::lineNumberOfCurrentEditor(FilePath::fromString(file));
|
||||
|
||||
const QString tag = VcsBaseEditor::editorTag(AnnotateOutput, workingDir, {file}, revision);
|
||||
if (IEditor *editor = VcsBaseEditor::locateEditorByTag(tag)) {
|
||||
@@ -1154,7 +1154,7 @@ bool CvsPluginPrivate::status(const FilePath &topLevel, const QString &file, con
|
||||
const bool ok = response.result() == ProcessResult::FinishedWithSuccess;
|
||||
if (ok) {
|
||||
showOutputInEditor(title, response.cleanedStdOut(), commandLogEditorParameters.id,
|
||||
topLevel.toString(), nullptr);
|
||||
topLevel, nullptr);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@@ -1319,7 +1319,7 @@ bool CvsPluginPrivate::describe(const FilePath &repositoryPath,
|
||||
} else {
|
||||
const QString title = QString::fromLatin1("cvs describe %1").arg(commitId);
|
||||
IEditor *newEditor = showOutputInEditor(title, output, diffEditorParameters.id,
|
||||
entries.front().file, codec);
|
||||
FilePath::fromString(entries.front().file), codec);
|
||||
VcsBaseEditor::tagEditor(newEditor, commitId);
|
||||
setDiffBaseDirectory(newEditor, repositoryPath);
|
||||
}
|
||||
@@ -1343,7 +1343,7 @@ CommandResult CvsPluginPrivate::runCvs(const FilePath &workingDirectory,
|
||||
}
|
||||
|
||||
IEditor *CvsPluginPrivate::showOutputInEditor(const QString& title, const QString &output,
|
||||
Utils::Id id, const QString &source,
|
||||
Utils::Id id, const FilePath &source,
|
||||
QTextCodec *codec)
|
||||
{
|
||||
QString s = title;
|
||||
|
@@ -136,7 +136,7 @@ void FetchContext::show()
|
||||
{
|
||||
const QString title = QString::number(m_change->number) + '/'
|
||||
+ QString::number(m_change->currentPatchSet.patchSetNumber);
|
||||
GitClient::instance()->show(m_repository.toString(), "FETCH_HEAD", title);
|
||||
GitClient::instance()->show(m_repository, "FETCH_HEAD", title);
|
||||
}
|
||||
|
||||
void FetchContext::cherryPick()
|
||||
|
@@ -462,7 +462,7 @@ ShowController::ShowController(IDocument *document, const QString &id)
|
||||
Storage(storage),
|
||||
Storage(diffInputStorage),
|
||||
parallel,
|
||||
OnGroupSetup([this] { setStartupFile(VcsBase::source(this->document())); }),
|
||||
OnGroupSetup([this] { setStartupFile(VcsBase::source(this->document()).toString()); }),
|
||||
Group {
|
||||
optional,
|
||||
Process(setupDescription, onDescriptionDone),
|
||||
@@ -823,10 +823,8 @@ FilePaths GitClient::unmanagedFiles(const FilePaths &filePaths) const
|
||||
|
||||
QTextCodec *GitClient::codecFor(GitClient::CodecType codecType, const FilePath &source) const
|
||||
{
|
||||
if (codecType == CodecSource) {
|
||||
return source.isFile() ? VcsBaseEditor::getCodec(source.toString())
|
||||
: encoding(source, "gui.encoding");
|
||||
}
|
||||
if (codecType == CodecSource)
|
||||
return source.isFile() ? VcsBaseEditor::getCodec(source) : encoding(source, "gui.encoding");
|
||||
if (codecType == CodecLogOutput)
|
||||
return encoding(source, "i18n.logOutputEncoding");
|
||||
return nullptr;
|
||||
@@ -921,12 +919,12 @@ void GitClient::stage(DiffEditor::DiffEditorController *diffController,
|
||||
}
|
||||
}
|
||||
|
||||
void GitClient::requestReload(const QString &documentId, const QString &source,
|
||||
void GitClient::requestReload(const QString &documentId, const FilePath &source,
|
||||
const QString &title, const FilePath &workingDirectory,
|
||||
std::function<GitBaseDiffEditorController *(IDocument *)> factory) const
|
||||
{
|
||||
// Creating document might change the referenced source. Store a copy and use it.
|
||||
const QString sourceCopy = source;
|
||||
const FilePath sourceCopy = source;
|
||||
|
||||
IDocument *document = DiffEditorController::findOrCreateDocument(documentId, title);
|
||||
QTC_ASSERT(document, return);
|
||||
@@ -954,7 +952,7 @@ void GitClient::diffFiles(const FilePath &workingDirectory,
|
||||
const QString documentId = QLatin1String(Constants::GIT_PLUGIN)
|
||||
+ QLatin1String(".DiffFiles.") + workingDirectory.toString();
|
||||
requestReload(documentId,
|
||||
workingDirectory.toString(), Tr::tr("Git Diff Files"), workingDirectory,
|
||||
workingDirectory, Tr::tr("Git Diff Files"), workingDirectory,
|
||||
[stagedFileNames, unstagedFileNames](IDocument *doc) {
|
||||
return new FileListDiffController(doc, stagedFileNames, unstagedFileNames);
|
||||
});
|
||||
@@ -965,7 +963,7 @@ void GitClient::diffProject(const FilePath &workingDirectory, const QString &pro
|
||||
const QString documentId = QLatin1String(Constants::GIT_PLUGIN)
|
||||
+ QLatin1String(".DiffProject.") + workingDirectory.toString();
|
||||
requestReload(documentId,
|
||||
workingDirectory.toString(), Tr::tr("Git Diff Project"), workingDirectory,
|
||||
workingDirectory, Tr::tr("Git Diff Project"), workingDirectory,
|
||||
[projectDirectory](IDocument *doc){
|
||||
return new GitDiffEditorController(doc, {}, {}, {"--", projectDirectory});
|
||||
});
|
||||
@@ -977,7 +975,7 @@ void GitClient::diffRepository(const FilePath &workingDirectory,
|
||||
{
|
||||
const QString documentId = QLatin1String(Constants::GIT_PLUGIN)
|
||||
+ QLatin1String(".DiffRepository.") + workingDirectory.toString();
|
||||
requestReload(documentId, workingDirectory.toString(), Tr::tr("Git Diff Repository"), workingDirectory,
|
||||
requestReload(documentId, workingDirectory, Tr::tr("Git Diff Repository"), workingDirectory,
|
||||
[&leftCommit, &rightCommit](IDocument *doc) {
|
||||
return new GitDiffEditorController(doc, leftCommit, rightCommit, {});
|
||||
});
|
||||
@@ -986,9 +984,9 @@ void GitClient::diffRepository(const FilePath &workingDirectory,
|
||||
void GitClient::diffFile(const FilePath &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
const QString title = Tr::tr("Git Diff \"%1\"").arg(fileName);
|
||||
const QString sourceFile = VcsBaseEditor::getSource(workingDirectory, fileName);
|
||||
const FilePath sourceFile = VcsBaseEditor::getSource(workingDirectory, fileName);
|
||||
const QString documentId = QLatin1String(Constants::GIT_PLUGIN)
|
||||
+ QLatin1String(".DifFile.") + sourceFile;
|
||||
+ QLatin1String(".DifFile.") + sourceFile.toString();
|
||||
requestReload(documentId, sourceFile, title, workingDirectory,
|
||||
[&fileName](IDocument *doc) {
|
||||
return new GitDiffEditorController(doc, {}, {}, {"--", fileName});
|
||||
@@ -1000,7 +998,7 @@ void GitClient::diffBranch(const FilePath &workingDirectory, const QString &bran
|
||||
const QString title = Tr::tr("Git Diff Branch \"%1\"").arg(branchName);
|
||||
const QString documentId = QLatin1String(Constants::GIT_PLUGIN)
|
||||
+ QLatin1String(".DiffBranch.") + branchName;
|
||||
requestReload(documentId, workingDirectory.toString(), title, workingDirectory,
|
||||
requestReload(documentId, workingDirectory, title, workingDirectory,
|
||||
[branchName](IDocument *doc) {
|
||||
return new GitDiffEditorController(doc, branchName, {}, {});
|
||||
});
|
||||
@@ -1056,7 +1054,7 @@ void GitClient::log(const FilePath &workingDirectory, const QString &fileName,
|
||||
const FilePath workingDir = workingDirectory;
|
||||
const QString title = Tr::tr("Git Log \"%1\"").arg(msgArg);
|
||||
const Id editorId = Git::Constants::GIT_LOG_EDITOR_ID;
|
||||
const QString sourceFile = VcsBaseEditor::getSource(workingDir, fileName);
|
||||
const FilePath sourceFile = VcsBaseEditor::getSource(workingDir, fileName);
|
||||
GitEditorWidget *editor = static_cast<GitEditorWidget *>(
|
||||
createVcsEditor(editorId, title, sourceFile,
|
||||
codecFor(CodecLogOutput), "logTitle", msgArg));
|
||||
@@ -1114,7 +1112,7 @@ void GitClient::reflog(const FilePath &workingDirectory, const QString &ref)
|
||||
// Creating document might change the referenced workingDirectory. Store a copy and use it.
|
||||
const FilePath workingDir = workingDirectory;
|
||||
GitEditorWidget *editor = static_cast<GitEditorWidget *>(
|
||||
createVcsEditor(editorId, title, workingDir.toString(), codecFor(CodecLogOutput),
|
||||
createVcsEditor(editorId, title, workingDir, codecFor(CodecLogOutput),
|
||||
"reflogRepository", workingDir.toString()));
|
||||
VcsBaseEditorConfig *argWidget = editor->editorConfig();
|
||||
if (!argWidget) {
|
||||
@@ -1147,7 +1145,7 @@ static inline QString msgCannotShow(const QString &sha)
|
||||
return Tr::tr("Cannot describe \"%1\".").arg(sha);
|
||||
}
|
||||
|
||||
void GitClient::show(const QString &source, const QString &id, const QString &name)
|
||||
void GitClient::show(const FilePath &source, const QString &id, const QString &name)
|
||||
{
|
||||
if (!canShow(id)) {
|
||||
VcsOutputWindow::appendError(msgCannotShow(id));
|
||||
@@ -1155,9 +1153,8 @@ void GitClient::show(const QString &source, const QString &id, const QString &na
|
||||
}
|
||||
|
||||
const QString title = Tr::tr("Git Show \"%1\"").arg(name.isEmpty() ? id : name);
|
||||
const QFileInfo sourceFi(source);
|
||||
FilePath workingDirectory = FilePath::fromString(
|
||||
sourceFi.isDir() ? sourceFi.absoluteFilePath() : sourceFi.absolutePath());
|
||||
FilePath workingDirectory =
|
||||
source.isDir() ? source.absoluteFilePath() : source.absolutePath();
|
||||
const FilePath repoDirectory = VcsManager::findTopLevelForDirectory(workingDirectory);
|
||||
if (!repoDirectory.isEmpty())
|
||||
workingDirectory = repoDirectory;
|
||||
@@ -1225,10 +1222,10 @@ void GitClient::annotate(const Utils::FilePath &workingDir, const QString &file,
|
||||
const Id editorId = Git::Constants::GIT_BLAME_EDITOR_ID;
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, {file}, revision);
|
||||
const QString title = Tr::tr("Git Blame \"%1\"").arg(id);
|
||||
const QString sourceFile = VcsBaseEditor::getSource(workingDir, file);
|
||||
const FilePath sourceFile = VcsBaseEditor::getSource(workingDir, file);
|
||||
|
||||
VcsBaseEditorWidget *editor = createVcsEditor(editorId, title, sourceFile,
|
||||
codecFor(CodecSource, FilePath::fromString(sourceFile)), "blameFileName", id);
|
||||
codecFor(CodecSource, sourceFile), "blameFileName", id);
|
||||
VcsBaseEditorConfig *argWidget = editor->editorConfig();
|
||||
if (!argWidget) {
|
||||
argWidget = new GitBlameArgumentsWidget(settings(), editor->toolBar());
|
||||
@@ -3131,9 +3128,9 @@ void GitClient::subversionLog(const FilePath &workingDirectory) const
|
||||
// Create a command editor, no highlighting or interaction.
|
||||
const QString title = Tr::tr("Git SVN Log");
|
||||
const Id editorId = Git::Constants::GIT_SVN_LOG_EDITOR_ID;
|
||||
const QString sourceFile = VcsBaseEditor::getSource(workingDirectory, QStringList());
|
||||
const FilePath sourceFile = VcsBaseEditor::getSource(workingDirectory, QStringList());
|
||||
VcsBaseEditorWidget *editor = createVcsEditor(editorId, title, sourceFile, codecFor(CodecNone),
|
||||
"svnLog", sourceFile);
|
||||
"svnLog", sourceFile.toString());
|
||||
editor->setWorkingDirectory(workingDirectory);
|
||||
vcsExecWithEditor(workingDirectory, arguments, editor);
|
||||
}
|
||||
@@ -3638,7 +3635,7 @@ QString GitClient::suggestedLocalBranchName(
|
||||
return suggestedName;
|
||||
}
|
||||
|
||||
void GitClient::addChangeActions(QMenu *menu, const QString &source, const QString &change)
|
||||
void GitClient::addChangeActions(QMenu *menu, const FilePath &source, const QString &change)
|
||||
{
|
||||
QTC_ASSERT(!change.isEmpty(), return);
|
||||
const FilePath &workingDir = fileWorkingDirectory(source);
|
||||
@@ -3664,7 +3661,7 @@ void GitClient::addChangeActions(QMenu *menu, const QString &source, const QStri
|
||||
if (isRange) {
|
||||
menu->setDefaultAction(logAction);
|
||||
} else {
|
||||
const FilePath filePath = FilePath::fromString(source);
|
||||
const FilePath filePath = source;
|
||||
if (!filePath.isDir()) {
|
||||
menu->addAction(Tr::tr("Sh&ow file \"%1\" on revision %2").arg(filePath.fileName(), change),
|
||||
[workingDir, change, source] {
|
||||
@@ -3717,9 +3714,9 @@ void GitClient::addChangeActions(QMenu *menu, const QString &source, const QStri
|
||||
}
|
||||
}
|
||||
|
||||
FilePath GitClient::fileWorkingDirectory(const QString &file)
|
||||
FilePath GitClient::fileWorkingDirectory(const Utils::FilePath &file)
|
||||
{
|
||||
Utils::FilePath path = Utils::FilePath::fromString(file);
|
||||
Utils::FilePath path = file;
|
||||
if (!path.isEmpty() && !path.isDir())
|
||||
path = path.parentDir();
|
||||
while (!path.isEmpty() && !path.exists())
|
||||
@@ -3728,17 +3725,17 @@ FilePath GitClient::fileWorkingDirectory(const QString &file)
|
||||
}
|
||||
|
||||
IEditor *GitClient::openShowEditor(const FilePath &workingDirectory, const QString &ref,
|
||||
const QString &path, ShowEditor showSetting)
|
||||
const FilePath &path, ShowEditor showSetting)
|
||||
{
|
||||
const FilePath topLevel = VcsManager::findTopLevelForDirectory(workingDirectory);
|
||||
const QString topLevelString = topLevel.toString();
|
||||
const QString relativePath = QDir(topLevelString).relativeFilePath(path);
|
||||
const QString relativePath = QDir(topLevelString).relativeFilePath(path.toString());
|
||||
const QByteArray content = synchronousShow(topLevel, ref + ":" + relativePath);
|
||||
if (showSetting == ShowEditor::OnlyIfDifferent) {
|
||||
if (content.isEmpty())
|
||||
return nullptr;
|
||||
QByteArray fileContent;
|
||||
if (TextFileFormat::readFileUTF8(Utils::FilePath::fromString(path),
|
||||
if (TextFileFormat::readFileUTF8(path,
|
||||
nullptr,
|
||||
&fileContent,
|
||||
nullptr)
|
||||
@@ -3755,6 +3752,7 @@ IEditor *GitClient::openShowEditor(const FilePath &workingDirectory, const QStri
|
||||
IEditor *editor = EditorManager::openEditorWithContents(Id(), &title, content, documentId,
|
||||
EditorManager::DoNotSwitchToDesignMode);
|
||||
editor->document()->setTemporary(true);
|
||||
// FIXME: Check should that be relative
|
||||
VcsBase::setSource(editor->document(), path);
|
||||
return editor;
|
||||
}
|
||||
|
@@ -331,18 +331,18 @@ public:
|
||||
|
||||
static QString msgNoChangedFiles();
|
||||
static QString msgNoCommits(bool includeRemote);
|
||||
void show(const QString &source, const QString &id, const QString &name = {});
|
||||
void show(const Utils::FilePath &source, const QString &id, const QString &name = {});
|
||||
void archive(const Utils::FilePath &workingDirectory, QString commit);
|
||||
|
||||
enum class BranchTargetType { Remote, Commit };
|
||||
static QString suggestedLocalBranchName(
|
||||
const Utils::FilePath &workingDirectory, const QStringList &existingLocalNames,
|
||||
const QString &target, BranchTargetType targetType);
|
||||
static void addChangeActions(QMenu *menu, const QString &source, const QString &change);
|
||||
static Utils::FilePath fileWorkingDirectory(const QString &file);
|
||||
static void addChangeActions(QMenu *menu, const Utils::FilePath &source, const QString &change);
|
||||
static Utils::FilePath fileWorkingDirectory(const Utils::FilePath &file);
|
||||
enum class ShowEditor { OnlyIfDifferent, Always };
|
||||
Core::IEditor *openShowEditor(const Utils::FilePath &workingDirectory, const QString &ref,
|
||||
const QString &path, ShowEditor showSetting = ShowEditor::Always);
|
||||
const Utils::FilePath &path, ShowEditor showSetting = ShowEditor::Always);
|
||||
|
||||
Author getAuthor(const Utils::FilePath &workingDirectory);
|
||||
private:
|
||||
@@ -357,8 +357,8 @@ private:
|
||||
enum CodecType { CodecSource, CodecLogOutput, CodecNone };
|
||||
QTextCodec *codecFor(CodecType codecType, const Utils::FilePath &source = {}) const;
|
||||
|
||||
void requestReload(const QString &documentId, const QString &source, const QString &title,
|
||||
const Utils::FilePath &workingDirectory,
|
||||
void requestReload(const QString &documentId, const Utils::FilePath &source,
|
||||
const QString &title, const Utils::FilePath &workingDirectory,
|
||||
std::function<GitBaseDiffEditorController *(Core::IDocument *)> factory) const;
|
||||
|
||||
QString readOneLine(const Utils::FilePath &workingDirectory, const QStringList &arguments) const;
|
||||
|
@@ -244,7 +244,7 @@ void GitEditorWidget::init()
|
||||
const bool isRebaseEditor = editorId == Git::Constants::GIT_REBASE_EDITOR_ID;
|
||||
if (!isCommitEditor && !isRebaseEditor)
|
||||
return;
|
||||
const QChar commentChar = GitClient::instance()->commentChar(FilePath::fromString(source()));
|
||||
const QChar commentChar = GitClient::instance()->commentChar(source());
|
||||
if (isCommitEditor)
|
||||
textDocument()->setSyntaxHighlighter(new GitSubmitHighlighter(commentChar));
|
||||
else if (isRebaseEditor)
|
||||
@@ -273,7 +273,7 @@ void GitEditorWidget::aboutToOpen(const FilePath &filePath, const FilePath &real
|
||||
if (editorId == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID
|
||||
|| editorId == Git::Constants::GIT_REBASE_EDITOR_ID) {
|
||||
const FilePath gitPath = filePath.absolutePath();
|
||||
setSource(gitPath.toString());
|
||||
setSource(gitPath);
|
||||
textDocument()->setCodec(
|
||||
GitClient::instance()->encoding(gitPath, "i18n.commitEncoding"));
|
||||
}
|
||||
@@ -328,7 +328,7 @@ bool GitEditorWidget::supportChangeLinks() const
|
||||
|| (textDocument()->id() == Git::Constants::GIT_REBASE_EDITOR_ID);
|
||||
}
|
||||
|
||||
QString GitEditorWidget::fileNameForLine(int line) const
|
||||
FilePath GitEditorWidget::fileNameForLine(int line) const
|
||||
{
|
||||
// 7971b6e7 share/qtcreator/dumper/dumper.py (hjk
|
||||
QTextBlock block = document()->findBlockByLineNumber(line - 1);
|
||||
@@ -338,7 +338,7 @@ QString GitEditorWidget::fileNameForLine(int line) const
|
||||
if (match.hasMatch()) {
|
||||
const QString fileName = match.captured(1).trimmed();
|
||||
if (!fileName.isEmpty())
|
||||
return fileName;
|
||||
return FilePath::fromString(fileName);
|
||||
}
|
||||
return source();
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ private:
|
||||
void addChangeActions(QMenu *menu, const QString &change) override;
|
||||
QString revisionSubject(const QTextBlock &inBlock) const override;
|
||||
bool supportChangeLinks() const override;
|
||||
QString fileNameForLine(int line) const override;
|
||||
Utils::FilePath fileNameForLine(int line) const override;
|
||||
Utils::FilePath sourceWorkingDirectory() const;
|
||||
|
||||
const QRegularExpression m_changeNumberPattern;
|
||||
|
@@ -285,7 +285,7 @@ IEditor *GitGrep::openEditor(const SearchResultItem &item,
|
||||
const QStringList &itemPath = item.path();
|
||||
if (params.ref.isEmpty() || itemPath.isEmpty())
|
||||
return nullptr;
|
||||
const QString path = QDir::fromNativeSeparators(itemPath.first());
|
||||
const FilePath path = FilePath::fromUserInput(itemPath.first());
|
||||
const FilePath topLevel = FilePath::fromString(parameters.additionalParameters.toString());
|
||||
IEditor *editor = m_client->openShowEditor(topLevel, params.ref, path,
|
||||
GitClient::ShowEditor::OnlyIfDifferent);
|
||||
|
@@ -188,7 +188,7 @@ public:
|
||||
QString authorMail;
|
||||
QDateTime authorTime;
|
||||
QString summary;
|
||||
QString fileName;
|
||||
FilePath filePath;
|
||||
};
|
||||
|
||||
class BlameMark : public TextEditor::TextMark
|
||||
@@ -216,7 +216,7 @@ public:
|
||||
showAction->setIcon(Utils::Icons::ZOOM.icon());
|
||||
showAction->setToolTip(TextEditor::Tr::tr("Show Commit %1").arg(info.sha1.left(8)));
|
||||
QObject::connect(showAction, &QAction::triggered, [info] {
|
||||
GitClient::instance()->show(info.fileName, info.sha1);
|
||||
GitClient::instance()->show(info.filePath, info.sha1);
|
||||
});
|
||||
return QList<QAction *>{copyToClipboardAction, showAction};
|
||||
});
|
||||
@@ -267,7 +267,7 @@ public:
|
||||
bool vcsCreateRepository(const FilePath &directory) final;
|
||||
|
||||
void vcsAnnotate(const FilePath &filePath, int line) final;
|
||||
void vcsDescribe(const FilePath &source, const QString &id) final { m_gitClient.show(source.toString(), id); };
|
||||
void vcsDescribe(const FilePath &source, const QString &id) final { m_gitClient.show(source, id); };
|
||||
QString vcsTopic(const FilePath &directory) final;
|
||||
|
||||
VcsCommand *createInitialCheckoutCommand(const QString &url,
|
||||
@@ -284,7 +284,7 @@ public:
|
||||
QAction *action = menu->addAction(Tr::tr("&Describe Change %1").arg(reference),
|
||||
[=] { vcsDescribe(workingDirectory, reference); });
|
||||
menu->setDefaultAction(action);
|
||||
GitClient::addChangeActions(menu, workingDirectory.toString(), reference);
|
||||
GitClient::addChangeActions(menu, workingDirectory, reference);
|
||||
}
|
||||
|
||||
bool handleLink(const FilePath &workingDirectory, const QString &reference) final
|
||||
@@ -292,7 +292,7 @@ public:
|
||||
if (reference.contains(".."))
|
||||
GitClient::instance()->log(workingDirectory, {}, false, {reference});
|
||||
else
|
||||
GitClient::instance()->show(workingDirectory.toString(), reference);
|
||||
GitClient::instance()->show(workingDirectory, reference);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1132,7 +1132,7 @@ void GitPluginPrivate::blameFile()
|
||||
}
|
||||
}
|
||||
}
|
||||
const FilePath fileName = FilePath::fromString(state.currentFile()).canonicalPath();
|
||||
const FilePath fileName = state.currentFile().canonicalPath();
|
||||
FilePath topLevel;
|
||||
VcsManager::findVersionControlForDirectory(fileName.parentDir(), &topLevel);
|
||||
m_gitClient.annotate(topLevel, fileName.relativeChildPath(topLevel).toString(),
|
||||
@@ -1168,8 +1168,8 @@ void GitPluginPrivate::undoFileChanges(bool revertStaging)
|
||||
}
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
FileChangeBlocker fcb(FilePath::fromString(state.currentFile()));
|
||||
m_gitClient.revertFiles({state.currentFile()}, revertStaging);
|
||||
FileChangeBlocker fcb(state.currentFile());
|
||||
m_gitClient.revertFiles({state.currentFile().toString()}, revertStaging);
|
||||
}
|
||||
|
||||
class ResetItemDelegate : public LogItemDelegate
|
||||
@@ -1273,10 +1273,10 @@ void GitPluginPrivate::startChangeRelatedAction(const Id &id)
|
||||
if (dialog.command() == Show) {
|
||||
const int colon = change.indexOf(':');
|
||||
if (colon > 0) {
|
||||
const QString path = QDir(workingDirectory.toString()).absoluteFilePath(change.mid(colon + 1));
|
||||
const FilePath path = workingDirectory.resolvePath(change.mid(colon + 1));
|
||||
m_gitClient.openShowEditor(workingDirectory, change.left(colon), path);
|
||||
} else {
|
||||
m_gitClient.show(workingDirectory.toString(), change);
|
||||
m_gitClient.show(workingDirectory, change);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1514,7 +1514,7 @@ CommitInfo parseBlameOutput(const QStringList &blame, const Utils::FilePath &fil
|
||||
const uint timeStamp = blame.at(3).mid(12).toUInt();
|
||||
result.authorTime = QDateTime::fromSecsSinceEpoch(timeStamp);
|
||||
result.summary = blame.at(9).mid(8);
|
||||
result.fileName = filePath.toString();
|
||||
result.filePath = filePath;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1615,7 +1615,7 @@ IEditor *GitPluginPrivate::openSubmitEditor(const QString &fileName, const Commi
|
||||
}
|
||||
IDocument *document = submitEditor->document();
|
||||
document->setPreferredDisplayName(title);
|
||||
VcsBase::setSource(document, m_submitRepository.toString());
|
||||
VcsBase::setSource(document, m_submitRepository);
|
||||
return editor;
|
||||
}
|
||||
|
||||
@@ -1985,7 +1985,7 @@ QObject *GitPlugin::remoteCommand(const QStringList &options, const QString &wor
|
||||
return nullptr;
|
||||
|
||||
if (options.first() == "-git-show")
|
||||
dd->m_gitClient.show(workingDirectory, options.at(1));
|
||||
dd->m_gitClient.show(FilePath::fromUserInput(workingDirectory), options.at(1));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@@ -188,7 +188,7 @@ void GitSubmitEditor::slotDiffSelected(const QList<int> &rows)
|
||||
void GitSubmitEditor::showCommit(const QString &commit)
|
||||
{
|
||||
if (!m_workingDirectory.isEmpty())
|
||||
GitClient::instance()->show(m_workingDirectory.toString(), commit);
|
||||
GitClient::instance()->show(m_workingDirectory, commit);
|
||||
}
|
||||
|
||||
void GitSubmitEditor::updateFileModel()
|
||||
|
@@ -215,7 +215,7 @@ void StashDialog::showCurrent()
|
||||
{
|
||||
const int index = currentRow();
|
||||
QTC_ASSERT(index >= 0, return);
|
||||
GitClient::instance()->show(m_repository.toString(), QString(m_model->at(index).name));
|
||||
GitClient::instance()->show(m_repository, QString(m_model->at(index).name));
|
||||
}
|
||||
|
||||
// Suggest Branch name to restore 'stash@{0}' -> 'stash0-date'
|
||||
|
@@ -269,8 +269,8 @@ void MercurialClient::incoming(const FilePath &repositoryRoot, const QString &re
|
||||
|
||||
const QString title = Tr::tr("Hg incoming %1").arg(id);
|
||||
|
||||
VcsBaseEditorWidget *editor = createVcsEditor(Constants::DIFFLOG_ID, title, repositoryRoot.toString(),
|
||||
VcsBaseEditor::getCodec(repositoryRoot.toString()),
|
||||
VcsBaseEditorWidget *editor = createVcsEditor(Constants::DIFFLOG_ID, title, repositoryRoot,
|
||||
VcsBaseEditor::getCodec(repositoryRoot),
|
||||
"incoming", id);
|
||||
enqueueJob(createCommand(FilePath::fromString(repository), editor), args);
|
||||
}
|
||||
@@ -282,8 +282,8 @@ void MercurialClient::outgoing(const FilePath &repositoryRoot)
|
||||
|
||||
const QString title = Tr::tr("Hg outgoing %1").arg(repositoryRoot.toUserOutput());
|
||||
|
||||
VcsBaseEditorWidget *editor = createVcsEditor(Constants::DIFFLOG_ID, title, repositoryRoot.toString(),
|
||||
VcsBaseEditor::getCodec(repositoryRoot.toString()),
|
||||
VcsBaseEditorWidget *editor = createVcsEditor(Constants::DIFFLOG_ID, title, repositoryRoot,
|
||||
VcsBaseEditor::getCodec(repositoryRoot),
|
||||
"outgoing", repositoryRoot.toString());
|
||||
enqueueJob(createCommand(repositoryRoot, editor), args);
|
||||
}
|
||||
@@ -315,20 +315,20 @@ void MercurialClient::diff(const FilePath &workingDir, const QStringList &files,
|
||||
|
||||
if (files.empty()) {
|
||||
const QString title = Tr::tr("Mercurial Diff");
|
||||
const QString sourceFile = VcsBaseEditor::getSource(workingDir, fileName);
|
||||
const FilePath sourceFile = VcsBaseEditor::getSource(workingDir, fileName);
|
||||
const QString documentId = QString(Constants::MERCURIAL_PLUGIN)
|
||||
+ ".DiffRepo." + sourceFile;
|
||||
+ ".DiffRepo." + sourceFile.toString();
|
||||
requestReload(documentId, sourceFile, title, workingDir, {"diff"});
|
||||
} else if (files.size() == 1) {
|
||||
fileName = files.at(0);
|
||||
const QString title = Tr::tr("Mercurial Diff \"%1\"").arg(fileName);
|
||||
const QString sourceFile = VcsBaseEditor::getSource(workingDir, fileName);
|
||||
const FilePath sourceFile = VcsBaseEditor::getSource(workingDir, fileName);
|
||||
const QString documentId = QString(Constants::MERCURIAL_PLUGIN)
|
||||
+ ".DiffFile." + sourceFile;
|
||||
+ ".DiffFile." + sourceFile.toString();
|
||||
requestReload(documentId, sourceFile, title, workingDir, {"diff", fileName});
|
||||
} else {
|
||||
const QString title = Tr::tr("Mercurial Diff \"%1\"").arg(workingDir.toString());
|
||||
const QString sourceFile = VcsBaseEditor::getSource(workingDir, fileName);
|
||||
const FilePath sourceFile = VcsBaseEditor::getSource(workingDir, fileName);
|
||||
const QString documentId = QString(Constants::MERCURIAL_PLUGIN)
|
||||
+ ".DiffFile." + workingDir.toString();
|
||||
requestReload(documentId, sourceFile, title, workingDir, QStringList{"diff"} + files);
|
||||
@@ -355,7 +355,7 @@ bool MercurialClient::isVcsDirectory(const FilePath &filePath) const
|
||||
&& !filePath.fileName().compare(Constants::MERCURIALREPO, HostOsInfo::fileNameCaseSensitivity());
|
||||
}
|
||||
|
||||
void MercurialClient::view(const QString &source, const QString &id,
|
||||
void MercurialClient::view(const FilePath &source, const QString &id,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
QStringList args;
|
||||
@@ -417,11 +417,12 @@ MercurialClient::StatusItem MercurialClient::parseStatusLine(const QString &line
|
||||
return item;
|
||||
}
|
||||
|
||||
void MercurialClient::requestReload(const QString &documentId, const QString &source, const QString &title,
|
||||
void MercurialClient::requestReload(const QString &documentId, const FilePath &source,
|
||||
const QString &title,
|
||||
const FilePath &workingDirectory, const QStringList &args)
|
||||
{
|
||||
// Creating document might change the referenced source. Store a copy and use it.
|
||||
const QString sourceCopy = source;
|
||||
const FilePath sourceCopy = source;
|
||||
|
||||
IDocument *document = DiffEditorController::findOrCreateDocument(documentId, title);
|
||||
QTC_ASSERT(document, return);
|
||||
|
@@ -54,7 +54,7 @@ public:
|
||||
bool isVcsDirectory(const Utils::FilePath &filePath) const;
|
||||
Utils::FilePath findTopLevelForFile(const Utils::FilePath &file) const override;
|
||||
|
||||
void view(const QString &source, const QString &id,
|
||||
void view(const Utils::FilePath &source, const QString &id,
|
||||
const QStringList &extraOptions = QStringList()) override;
|
||||
|
||||
protected:
|
||||
@@ -67,8 +67,8 @@ signals:
|
||||
void needMerge();
|
||||
|
||||
private:
|
||||
void requestReload(const QString &documentId, const QString &source, const QString &title,
|
||||
const Utils::FilePath &workingDirectory,
|
||||
void requestReload(const QString &documentId, const Utils::FilePath &source,
|
||||
const QString &title, const Utils::FilePath &workingDirectory,
|
||||
const QStringList &args);
|
||||
void parsePullOutput(const QString &output);
|
||||
};
|
||||
|
@@ -14,8 +14,6 @@
|
||||
#include <QString>
|
||||
#include <QTextCursor>
|
||||
#include <QTextBlock>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QDebug>
|
||||
|
||||
using namespace Utils;
|
||||
@@ -57,18 +55,17 @@ VcsBase::BaseAnnotationHighlighter *MercurialEditorWidget::createAnnotationHighl
|
||||
|
||||
QString MercurialEditorWidget::decorateVersion(const QString &revision) const
|
||||
{
|
||||
const QFileInfo fi(source());
|
||||
const QString workingDirectory = fi.absolutePath();
|
||||
const FilePath workingDirectory = source().absolutePath();
|
||||
// Format with short summary
|
||||
return m_client->shortDescriptionSync(FilePath::fromString(workingDirectory), revision);
|
||||
return m_client->shortDescriptionSync(workingDirectory, revision);
|
||||
}
|
||||
|
||||
QStringList MercurialEditorWidget::annotationPreviousVersions(const QString &revision) const
|
||||
{
|
||||
const QFileInfo fi(source());
|
||||
const QString workingDirectory = fi.absolutePath();
|
||||
const FilePath filePath = source();
|
||||
const FilePath workingDirectory = filePath.absolutePath();
|
||||
// Retrieve parent revisions
|
||||
return m_client->parentRevisionsSync(FilePath::fromString(workingDirectory), fi.fileName(), revision);
|
||||
return m_client->parentRevisionsSync(workingDirectory, filePath.fileName(), revision);
|
||||
}
|
||||
|
||||
} // Mercurial::Internal
|
||||
|
@@ -120,7 +120,7 @@ public:
|
||||
bool vcsMove(const FilePath &from, const FilePath &to) final;
|
||||
bool vcsCreateRepository(const FilePath &directory) final;
|
||||
void vcsAnnotate(const FilePath &filePath, int line) final;
|
||||
void vcsDescribe(const FilePath &source, const QString &id) final { m_client.view(source.toString(), id); }
|
||||
void vcsDescribe(const FilePath &source, const QString &id) final { m_client.view(source, id); }
|
||||
|
||||
VcsCommand *createInitialCheckoutCommand(const QString &url,
|
||||
const Utils::FilePath &baseDirectory,
|
||||
|
@@ -267,7 +267,7 @@ public:
|
||||
typedef QHash<FilePath, DirectoryCacheEntry> ManagedDirectoryCache;
|
||||
|
||||
IEditor *showOutputInEditor(const QString &title, const QString &output,
|
||||
Id id, const QString &source,
|
||||
Id id, const FilePath &source,
|
||||
QTextCodec *codec = nullptr);
|
||||
|
||||
// args are passed as command line arguments
|
||||
@@ -604,13 +604,13 @@ void PerforcePluginPrivate::revertCurrentFile()
|
||||
if (doNotRevert)
|
||||
return;
|
||||
|
||||
FileChangeBlocker fcb(FilePath::fromString(state.currentFile()));
|
||||
FileChangeBlocker fcb(state.currentFile());
|
||||
args.clear();
|
||||
args << QLatin1String("revert") << state.relativeCurrentFile();
|
||||
PerforceResponse result2 = runP4Cmd(state.currentFileTopLevel(), args,
|
||||
CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow);
|
||||
if (!result2.error)
|
||||
emit filesChanged(QStringList(state.currentFile()));
|
||||
emit filesChanged(QStringList(state.currentFile().toString()));
|
||||
}
|
||||
|
||||
void PerforcePluginPrivate::diffCurrentFile()
|
||||
@@ -834,7 +834,7 @@ void PerforcePluginPrivate::annotate(const FilePath &workingDir,
|
||||
const QStringList files = QStringList(fileName);
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(workingDir, files);
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, files, changeList);
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, files);
|
||||
const FilePath source = VcsBaseEditor::getSource(workingDir, files);
|
||||
QStringList args;
|
||||
args << QLatin1String("annotate") << QLatin1String("-cqi");
|
||||
if (changeList.isEmpty())
|
||||
@@ -897,7 +897,7 @@ void PerforcePluginPrivate::filelog(const FilePath &workingDir, const QString &f
|
||||
CommandToWindow|StdErrToWindow|ErrorToWindow,
|
||||
{}, {}, codec);
|
||||
if (!result.error) {
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, fileName);
|
||||
const FilePath source = VcsBaseEditor::getSource(workingDir, fileName);
|
||||
IEditor *editor = showOutputInEditor(Tr::tr("p4 filelog %1").arg(id), result.stdOut,
|
||||
logEditorParameters.id, source, codec);
|
||||
if (enableAnnotationContextMenu)
|
||||
@@ -919,7 +919,7 @@ void PerforcePluginPrivate::changelists(const FilePath &workingDir, const QStrin
|
||||
CommandToWindow|StdErrToWindow|ErrorToWindow,
|
||||
{}, {}, codec);
|
||||
if (!result.error) {
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, fileName);
|
||||
const FilePath source = VcsBaseEditor::getSource(workingDir, fileName);
|
||||
IEditor *editor = showOutputInEditor(Tr::tr("p4 changelists %1").arg(id), result.stdOut,
|
||||
logEditorParameters.id, source, codec);
|
||||
VcsBaseEditor::gotoLineOfEditor(editor, 1);
|
||||
@@ -1380,7 +1380,7 @@ PerforceResponse PerforcePluginPrivate::runP4Cmd(const FilePath &workingDir,
|
||||
IEditor *PerforcePluginPrivate::showOutputInEditor(const QString &title,
|
||||
const QString &output,
|
||||
Utils::Id id,
|
||||
const QString &source,
|
||||
const FilePath &source,
|
||||
QTextCodec *codec)
|
||||
{
|
||||
QString s = title;
|
||||
@@ -1502,13 +1502,13 @@ void PerforcePluginPrivate::p4Diff(const PerforceDiffParameters &p)
|
||||
void PerforcePluginPrivate::vcsDescribe(const FilePath &source, const QString &n)
|
||||
{
|
||||
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(nullptr)
|
||||
: VcsBaseEditor::getCodec(source.toString());
|
||||
: VcsBaseEditor::getCodec(source);
|
||||
QStringList args;
|
||||
args << QLatin1String("describe") << QLatin1String("-du") << n;
|
||||
const PerforceResponse result = runP4Cmd(m_settings.topLevel(), args, CommandToWindow|StdErrToWindow|ErrorToWindow,
|
||||
{}, {}, codec);
|
||||
if (!result.error)
|
||||
showOutputInEditor(Tr::tr("p4 describe %1").arg(n), result.stdOut, diffEditorParameters.id, source.toString(), codec);
|
||||
showOutputInEditor(Tr::tr("p4 describe %1").arg(n), result.stdOut, diffEditorParameters.id, source, codec);
|
||||
}
|
||||
|
||||
void PerforcePluginPrivate::cleanCommitMessageFile()
|
||||
|
@@ -237,7 +237,7 @@ void SubversionDiffEditorController::setChangeNumber(int changeNumber)
|
||||
}
|
||||
|
||||
SubversionDiffEditorController *SubversionClient::findOrCreateDiffEditor(const QString &documentId,
|
||||
const QString &source, const QString &title, const FilePath &workingDirectory)
|
||||
const FilePath &source, const QString &title, const FilePath &workingDirectory)
|
||||
{
|
||||
auto &settings = static_cast<SubversionSettings &>(this->settings());
|
||||
IDocument *document = DiffEditorController::findOrCreateDocument(documentId, title);
|
||||
@@ -265,7 +265,7 @@ void SubversionClient::diff(const FilePath &workingDirectory, const QStringList
|
||||
const QString title = vcsEditorTitle(vcsCmdString, documentId);
|
||||
|
||||
SubversionDiffEditorController *controller =
|
||||
findOrCreateDiffEditor(documentId, workingDirectory.toString(), title, workingDirectory);
|
||||
findOrCreateDiffEditor(documentId, workingDirectory, title, workingDirectory);
|
||||
controller->setFilesList(files);
|
||||
controller->requestReload();
|
||||
}
|
||||
@@ -299,7 +299,7 @@ void SubversionClient::describe(const FilePath &workingDirectory, int changeNumb
|
||||
workingDirectory, {}, QString::number(changeNumber));
|
||||
|
||||
SubversionDiffEditorController *controller = findOrCreateDiffEditor(documentId,
|
||||
workingDirectory.toString(), title, workingDirectory);
|
||||
workingDirectory, title, workingDirectory);
|
||||
controller->setChangeNumber(changeNumber);
|
||||
controller->requestReload();
|
||||
}
|
||||
|
@@ -54,7 +54,8 @@ protected:
|
||||
|
||||
private:
|
||||
SubversionDiffEditorController *findOrCreateDiffEditor(const QString &documentId,
|
||||
const QString &source, const QString &title, const Utils::FilePath &workingDirectory);
|
||||
const Utils::FilePath &source, const QString &title,
|
||||
const Utils::FilePath &workingDirectory);
|
||||
|
||||
mutable Utils::FilePath m_svnVersionBinary;
|
||||
mutable QString m_svnVersion;
|
||||
|
@@ -249,7 +249,7 @@ private:
|
||||
|
||||
inline bool isCommitEditorOpen() const;
|
||||
Core::IEditor *showOutputInEditor(const QString &title, const QString &output,
|
||||
Utils::Id id, const QString &source,
|
||||
Id id, const FilePath &source,
|
||||
QTextCodec *codec);
|
||||
|
||||
void filelog(const FilePath &workingDir,
|
||||
@@ -675,7 +675,7 @@ void SubversionPluginPrivate::revertCurrentFile()
|
||||
return;
|
||||
}
|
||||
|
||||
FileChangeBlocker fcb(FilePath::fromString(state.currentFile()));
|
||||
FileChangeBlocker fcb(state.currentFile());
|
||||
|
||||
// revert
|
||||
CommandLine args{m_settings.binaryPath.filePath(), {"revert"}};
|
||||
@@ -684,7 +684,7 @@ void SubversionPluginPrivate::revertCurrentFile()
|
||||
|
||||
const auto revertResponse = runSvn(state.currentFileTopLevel(), args, RunFlags::ShowStdOut);
|
||||
if (revertResponse.result() == ProcessResult::FinishedWithSuccess)
|
||||
emit filesChanged(QStringList(state.currentFile()));
|
||||
emit filesChanged(QStringList(state.currentFile().toString()));
|
||||
}
|
||||
|
||||
void SubversionPluginPrivate::diffProject()
|
||||
@@ -865,7 +865,7 @@ void SubversionPluginPrivate::vcsAnnotateHelper(const FilePath &workingDir, cons
|
||||
const QString &revision /* = QString() */,
|
||||
int lineNumber /* = -1 */)
|
||||
{
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, file);
|
||||
const FilePath source = VcsBaseEditor::getSource(workingDir, file);
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(source);
|
||||
|
||||
CommandLine args{m_settings.binaryPath.filePath(), {"annotate"}};
|
||||
@@ -960,7 +960,7 @@ CommandResult SubversionPluginPrivate::runSvn(const FilePath &workingDir,
|
||||
}
|
||||
|
||||
IEditor *SubversionPluginPrivate::showOutputInEditor(const QString &title, const QString &output,
|
||||
Id id, const QString &source,
|
||||
Id id, const FilePath &source,
|
||||
QTextCodec *codec)
|
||||
{
|
||||
if (Subversion::Constants::debug)
|
||||
|
@@ -24,7 +24,6 @@
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QFutureInterface>
|
||||
#include <QStringList>
|
||||
#include <QTextCodec>
|
||||
@@ -204,7 +203,7 @@ VcsCommand *VcsBaseClientImpl::createVcsCommand(const FilePath &defaultWorkingDi
|
||||
}
|
||||
|
||||
VcsBaseEditorWidget *VcsBaseClientImpl::createVcsEditor(Id kind, QString title,
|
||||
const QString &source, QTextCodec *codec,
|
||||
const FilePath &source, QTextCodec *codec,
|
||||
const char *registerDynamicProperty,
|
||||
const QString &dynamicPropertyValue) const
|
||||
{
|
||||
@@ -335,9 +334,9 @@ void VcsBaseClient::annotate(const Utils::FilePath &workingDir, const QString &f
|
||||
QStringList args;
|
||||
args << vcsCmdString << revisionSpec(revision) << extraOptions << file;
|
||||
const Id kind = vcsEditorKind(AnnotateCommand);
|
||||
const QString id = VcsBaseEditor::getSource(workingDir, QStringList(file));
|
||||
const QString id = VcsBaseEditor::getSource(workingDir, QStringList(file)).toString();
|
||||
const QString title = vcsEditorTitle(vcsCmdString, id);
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, file);
|
||||
const FilePath source = VcsBaseEditor::getSource(workingDir, file);
|
||||
|
||||
VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source,
|
||||
VcsBaseEditor::getCodec(source),
|
||||
@@ -355,7 +354,7 @@ void VcsBaseClient::diff(const FilePath &workingDir, const QStringList &files,
|
||||
const Id kind = vcsEditorKind(DiffCommand);
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, files);
|
||||
const QString title = vcsEditorTitle(vcsCmdString, id);
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, files);
|
||||
const FilePath source = VcsBaseEditor::getSource(workingDir, files);
|
||||
VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source,
|
||||
VcsBaseEditor::getCodec(source),
|
||||
vcsCmdString.toLatin1().constData(), id);
|
||||
@@ -399,7 +398,7 @@ void VcsBaseClient::log(const FilePath &workingDir,
|
||||
const Id kind = vcsEditorKind(LogCommand);
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, files);
|
||||
const QString title = vcsEditorTitle(vcsCmdString, id);
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, files);
|
||||
const FilePath source = VcsBaseEditor::getSource(workingDir, files);
|
||||
VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source,
|
||||
VcsBaseEditor::getCodec(source),
|
||||
vcsCmdString.toLatin1().constData(), id);
|
||||
@@ -538,7 +537,7 @@ void VcsBaseClient::import(const FilePath &repositoryRoot,
|
||||
enqueueJob(createCommand(repositoryRoot), args);
|
||||
}
|
||||
|
||||
void VcsBaseClient::view(const QString &source,
|
||||
void VcsBaseClient::view(const FilePath &source,
|
||||
const QString &id,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
@@ -550,8 +549,7 @@ void VcsBaseClient::view(const QString &source,
|
||||
VcsBaseEditorWidget *editor = createVcsEditor(kind, title, source,
|
||||
VcsBaseEditor::getCodec(source), "view", id);
|
||||
|
||||
const QFileInfo fi(source);
|
||||
const FilePath workingDirPath = FilePath::fromString(fi.isFile() ? fi.absolutePath() : source);
|
||||
const FilePath workingDirPath = source.isFile() ? source.absolutePath() : source;
|
||||
enqueueJob(createCommand(workingDirPath, editor), args);
|
||||
}
|
||||
|
||||
|
@@ -49,7 +49,7 @@ public:
|
||||
const Utils::Environment &environment);
|
||||
|
||||
VcsBaseEditorWidget *createVcsEditor(Utils::Id kind, QString title,
|
||||
const QString &source, QTextCodec *codec,
|
||||
const Utils::FilePath &source, QTextCodec *codec,
|
||||
const char *registerDynamicProperty,
|
||||
const QString &dynamicPropertyValue) const;
|
||||
|
||||
@@ -174,7 +174,7 @@ public:
|
||||
|
||||
virtual Utils::FilePath findTopLevelForFile(const Utils::FilePath &/*file*/) const { return {}; }
|
||||
|
||||
virtual void view(const QString &source, const QString &id,
|
||||
virtual void view(const Utils::FilePath &source, const QString &id,
|
||||
const QStringList &extraOptions = QStringList());
|
||||
|
||||
signals:
|
||||
|
@@ -297,8 +297,7 @@ QString ChangeTextCursorHandler::currentContents() const
|
||||
|
||||
void ChangeTextCursorHandler::slotDescribe()
|
||||
{
|
||||
emit editorWidget()->describeRequested(FilePath::fromString(editorWidget()->source()),
|
||||
m_currentChange);
|
||||
emit editorWidget()->describeRequested(editorWidget()->source(), m_currentChange);
|
||||
}
|
||||
|
||||
void ChangeTextCursorHandler::slotCopyRevision()
|
||||
@@ -665,7 +664,7 @@ bool VcsBaseEditorWidget::supportChangeLinks() const
|
||||
}
|
||||
}
|
||||
|
||||
QString VcsBaseEditorWidget::fileNameForLine(int line) const
|
||||
FilePath VcsBaseEditorWidget::fileNameForLine(int line) const
|
||||
{
|
||||
Q_UNUSED(line)
|
||||
return source();
|
||||
@@ -761,12 +760,12 @@ void VcsBaseEditorWidget::setForceReadOnly(bool b)
|
||||
textDocument()->setTemporary(b);
|
||||
}
|
||||
|
||||
QString VcsBaseEditorWidget::source() const
|
||||
FilePath VcsBaseEditorWidget::source() const
|
||||
{
|
||||
return VcsBase::source(textDocument());
|
||||
}
|
||||
|
||||
void VcsBaseEditorWidget::setSource(const QString &source)
|
||||
void VcsBaseEditorWidget::setSource(const FilePath &source)
|
||||
{
|
||||
VcsBase::setSource(textDocument(), source);
|
||||
}
|
||||
@@ -1222,19 +1221,17 @@ const VcsBaseEditorParameters *VcsBaseEditor::findType(const VcsBaseEditorParame
|
||||
}
|
||||
|
||||
// Find the codec used for a file querying the editor.
|
||||
static QTextCodec *findFileCodec(const QString &source)
|
||||
static QTextCodec *findFileCodec(const FilePath &source)
|
||||
{
|
||||
Core::IDocument *document = Core::DocumentModel::documentForFilePath(
|
||||
FilePath::fromString(source));
|
||||
Core::IDocument *document = Core::DocumentModel::documentForFilePath(source);
|
||||
if (auto textDocument = qobject_cast<Core::BaseTextDocument *>(document))
|
||||
return const_cast<QTextCodec *>(textDocument->codec());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Find the codec by checking the projects (root dir of project file)
|
||||
static QTextCodec *findProjectCodec(const QString &dir)
|
||||
static QTextCodec *findProjectCodec(const FilePath &dirPath)
|
||||
{
|
||||
const FilePath dirPath = FilePath::fromString(dir);
|
||||
typedef QList<ProjectExplorer::Project*> ProjectList;
|
||||
// Try to find a project under which file tree the file is.
|
||||
const ProjectList projects = ProjectExplorer::SessionManager::projects();
|
||||
@@ -1243,16 +1240,15 @@ static QTextCodec *findProjectCodec(const QString &dir)
|
||||
return p ? p->editorConfiguration()->textCodec() : nullptr;
|
||||
}
|
||||
|
||||
QTextCodec *VcsBaseEditor::getCodec(const QString &source)
|
||||
QTextCodec *VcsBaseEditor::getCodec(const FilePath &source)
|
||||
{
|
||||
if (!source.isEmpty()) {
|
||||
// Check file
|
||||
const QFileInfo sourceFi(source);
|
||||
if (sourceFi.isFile())
|
||||
if (source.isFile())
|
||||
if (QTextCodec *fc = findFileCodec(source))
|
||||
return fc;
|
||||
// Find by project via directory
|
||||
if (QTextCodec *pc = findProjectCodec(sourceFi.isFile() ? sourceFi.absolutePath() : source))
|
||||
if (QTextCodec *pc = findProjectCodec(source.isFile() ? source.absolutePath() : source))
|
||||
return pc;
|
||||
}
|
||||
QTextCodec *sys = QTextCodec::codecForLocale();
|
||||
@@ -1260,15 +1256,10 @@ QTextCodec *VcsBaseEditor::getCodec(const QString &source)
|
||||
}
|
||||
|
||||
QTextCodec *VcsBaseEditor::getCodec(const FilePath &workingDirectory, const QStringList &files)
|
||||
{
|
||||
return getCodec(workingDirectory.toString(), files);
|
||||
}
|
||||
|
||||
QTextCodec *VcsBaseEditor::getCodec(const QString &workingDirectory, const QStringList &files)
|
||||
{
|
||||
if (files.empty())
|
||||
return getCodec(workingDirectory);
|
||||
return getCodec(workingDirectory + QLatin1Char('/') + files.front());
|
||||
return getCodec(workingDirectory / files.front());
|
||||
}
|
||||
|
||||
VcsBaseEditorWidget *VcsBaseEditor::getVcsBaseEditor(const Core::IEditor *editor)
|
||||
@@ -1279,14 +1270,14 @@ VcsBaseEditorWidget *VcsBaseEditor::getVcsBaseEditor(const Core::IEditor *editor
|
||||
}
|
||||
|
||||
// Return line number of current editor if it matches.
|
||||
int VcsBaseEditor::lineNumberOfCurrentEditor(const QString ¤tFile)
|
||||
int VcsBaseEditor::lineNumberOfCurrentEditor(const FilePath ¤tFile)
|
||||
{
|
||||
Core::IEditor *ed = Core::EditorManager::currentEditor();
|
||||
if (!ed)
|
||||
return -1;
|
||||
if (!currentFile.isEmpty()) {
|
||||
const Core::IDocument *idocument = ed->document();
|
||||
if (!idocument || idocument->filePath().toString() != currentFile)
|
||||
if (!idocument || idocument->filePath() != currentFile)
|
||||
return -1;
|
||||
}
|
||||
auto eda = qobject_cast<const BaseTextEditor *>(ed);
|
||||
@@ -1316,16 +1307,16 @@ bool VcsBaseEditor::gotoLineOfEditor(Core::IEditor *e, int lineNumber)
|
||||
|
||||
// Return source file or directory string depending on parameters
|
||||
// ('git diff XX' -> 'XX' , 'git diff XX file' -> 'XX/file').
|
||||
QString VcsBaseEditor::getSource(const FilePath &workingDirectory, const QString &fileName)
|
||||
FilePath VcsBaseEditor::getSource(const FilePath &workingDirectory, const QString &fileName)
|
||||
{
|
||||
return workingDirectory.pathAppended(fileName).toString();
|
||||
return workingDirectory.pathAppended(fileName);
|
||||
}
|
||||
|
||||
QString VcsBaseEditor::getSource(const FilePath &workingDirectory, const QStringList &fileNames)
|
||||
FilePath VcsBaseEditor::getSource(const FilePath &workingDirectory, const QStringList &fileNames)
|
||||
{
|
||||
return fileNames.size() == 1
|
||||
? getSource(workingDirectory, fileNames.front())
|
||||
: workingDirectory.toString();
|
||||
: workingDirectory;
|
||||
}
|
||||
|
||||
QString VcsBaseEditor::getTitleId(const FilePath &workingDirectory,
|
||||
@@ -1413,7 +1404,7 @@ QString VcsBaseEditorWidget::findDiffFile(const QString &f) const
|
||||
return baseFileInfo.absoluteFilePath().toString();
|
||||
}
|
||||
// 2) Try in source (which can be file or directory)
|
||||
const FilePath sourcePath = FilePath::fromString(source());
|
||||
const FilePath sourcePath = source();
|
||||
if (!sourcePath.isEmpty()) {
|
||||
const FilePath sourceDir = sourcePath.isDir() ? sourcePath.absoluteFilePath()
|
||||
: sourcePath.absolutePath();
|
||||
@@ -1451,7 +1442,7 @@ void VcsBaseEditorWidget::addDiffActions(QMenu *, const DiffChunk &)
|
||||
void VcsBaseEditorWidget::slotAnnotateRevision(const QString &change)
|
||||
{
|
||||
const int currentLine = textCursor().blockNumber() + 1;
|
||||
const FilePath fileName = FilePath::fromString(fileNameForLine(currentLine)).canonicalPath();
|
||||
const FilePath fileName = fileNameForLine(currentLine).canonicalPath();
|
||||
const FilePath workingDirectory = d->m_workingDirectory.isEmpty()
|
||||
? VcsManager::findTopLevelForDirectory(fileName.parentDir())
|
||||
: d->m_workingDirectory;
|
||||
@@ -1647,7 +1638,7 @@ void VcsBaseEditorWidget::testDiffFileResolving(const VcsEditorFactory &factory)
|
||||
QTextDocument doc(QString::fromLatin1(header));
|
||||
QTextBlock block = doc.lastBlock();
|
||||
// set source root for shadow builds
|
||||
widget->setSource(QString::fromLatin1(SRC_DIR));
|
||||
widget->setSource(FilePath::fromString(QString::fromLatin1(SRC_DIR)));
|
||||
QVERIFY(widget->fileNameFromDiffSpecification(block).endsWith(QString::fromLatin1(fileName)));
|
||||
|
||||
delete editor;
|
||||
|
@@ -71,9 +71,8 @@ public:
|
||||
// the editor manager and the project managers (defaults to system codec).
|
||||
// The codec should be set on editors displaying diff or annotation
|
||||
// output.
|
||||
static QTextCodec *getCodec(const QString &source);
|
||||
static QTextCodec *getCodec(const Utils::FilePath &source);
|
||||
static QTextCodec *getCodec(const Utils::FilePath &workingDirectory, const QStringList &files);
|
||||
static QTextCodec *getCodec(const QString &workingDirectory, const QStringList &files); // FIXME: Remove
|
||||
|
||||
// Utility to return the widget from the IEditor returned by the editor
|
||||
// manager which is a BaseTextEditor.
|
||||
@@ -83,7 +82,7 @@ public:
|
||||
// pass in the file name to match it. To be used when jumping to current
|
||||
// line number in a 'annnotate current file' slot, which checks if the
|
||||
// current file originates from the current editor or the project selection.
|
||||
static int lineNumberOfCurrentEditor(const QString ¤tFile = QString());
|
||||
static int lineNumberOfCurrentEditor(const Utils::FilePath ¤tFile = {});
|
||||
|
||||
//Helper to go to line of editor if it is a text editor
|
||||
static bool gotoLineOfEditor(Core::IEditor *e, int lineNumber);
|
||||
@@ -91,8 +90,8 @@ public:
|
||||
// Convenience functions to determine the source to pass on to a diff
|
||||
// editor if one has a call consisting of working directory and file arguments.
|
||||
// ('git diff XX' -> 'XX' , 'git diff XX file' -> 'XX/file').
|
||||
static QString getSource(const Utils::FilePath &workingDirectory, const QString &fileName);
|
||||
static QString getSource(const Utils::FilePath &workingDirectory, const QStringList &fileNames);
|
||||
static Utils::FilePath getSource(const Utils::FilePath &workingDirectory, const QString &fileName);
|
||||
static Utils::FilePath getSource(const Utils::FilePath &workingDirectory, const QStringList &fileNames);
|
||||
// Convenience functions to determine an title/id to identify the editor
|
||||
// from the arguments (','-joined arguments or directory) + revision.
|
||||
static QString getTitleId(const Utils::FilePath &workingDirectory,
|
||||
@@ -126,7 +125,7 @@ protected:
|
||||
// Pattern for annotation separator. Lookup will stop on match.
|
||||
void setAnnotationSeparatorPattern(const QString &pattern);
|
||||
virtual bool supportChangeLinks() const;
|
||||
virtual QString fileNameForLine(int line) const;
|
||||
virtual Utils::FilePath fileNameForLine(int line) const;
|
||||
|
||||
QString lineNumber(int blockNumber) const override;
|
||||
int lineNumberDigits() const override;
|
||||
@@ -150,8 +149,8 @@ public:
|
||||
* files. */
|
||||
void setForceReadOnly(bool b);
|
||||
|
||||
QString source() const;
|
||||
void setSource(const QString &source);
|
||||
Utils::FilePath source() const;
|
||||
void setSource(const Utils::FilePath &source);
|
||||
|
||||
// Format for "Annotate" revision menu entries. Should contain '%1" placeholder
|
||||
QString annotateRevisionTextFormat() const;
|
||||
|
@@ -243,7 +243,7 @@ void StateListener::slotStateChanged()
|
||||
if (currentDocument) {
|
||||
state.currentFile = currentDocument->filePath();
|
||||
if (state.currentFile.isEmpty() || currentDocument->isTemporary())
|
||||
state.currentFile = FilePath::fromString(VcsBase::source(currentDocument));
|
||||
state.currentFile = VcsBase::source(currentDocument);
|
||||
}
|
||||
|
||||
// Get the file and its control. Do not use the file unless we find one
|
||||
@@ -350,9 +350,9 @@ VcsBasePluginState &VcsBasePluginState::operator=(const VcsBasePluginState &rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
QString VcsBasePluginState::currentFile() const
|
||||
FilePath VcsBasePluginState::currentFile() const
|
||||
{
|
||||
return data->m_state.currentFile.toString();
|
||||
return data->m_state.currentFile;
|
||||
}
|
||||
|
||||
QString VcsBasePluginState::currentFileName() const
|
||||
@@ -614,7 +614,7 @@ void VcsBasePluginPrivate::promptToDeleteCurrentFile()
|
||||
if (!rc)
|
||||
QMessageBox::warning(ICore::dialogParent(), Tr::tr("Version Control"),
|
||||
Tr::tr("The file \"%1\" could not be deleted.").
|
||||
arg(QDir::toNativeSeparators(state.currentFile())),
|
||||
arg(state.currentFile().toUserOutput()),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
|
||||
@@ -717,15 +717,15 @@ FilePath findRepositoryForFile(const FilePath &fileOrDir, const QString &checkFi
|
||||
|
||||
static const char SOURCE_PROPERTY[] = "qtcreator_source";
|
||||
|
||||
void setSource(IDocument *document, const QString &source)
|
||||
void setSource(IDocument *document, const FilePath &source)
|
||||
{
|
||||
document->setProperty(SOURCE_PROPERTY, source);
|
||||
document->setProperty(SOURCE_PROPERTY, source.toVariant());
|
||||
m_listener->slotStateChanged();
|
||||
}
|
||||
|
||||
QString source(IDocument *document)
|
||||
FilePath source(IDocument *document)
|
||||
{
|
||||
return document->property(SOURCE_PROPERTY).toString();
|
||||
return FilePath::fromVariant(document->property(SOURCE_PROPERTY));
|
||||
}
|
||||
|
||||
void setProcessEnvironment(Environment *e)
|
||||
|
@@ -52,7 +52,7 @@ public:
|
||||
bool hasTopLevel() const;
|
||||
|
||||
// Current file.
|
||||
QString currentFile() const;
|
||||
Utils::FilePath currentFile() const;
|
||||
QString currentFileName() const;
|
||||
Utils::FilePath currentFileDirectory() const;
|
||||
Utils::FilePath currentFileTopLevel() const;
|
||||
@@ -107,9 +107,9 @@ VCSBASE_EXPORT Utils::FilePath findRepositoryForFile(const Utils::FilePath &file
|
||||
// (suppress LOCALE warnings/parse commands output) if desired.
|
||||
VCSBASE_EXPORT void setProcessEnvironment(Utils::Environment *e);
|
||||
// Sets the source of editor contents, can be directory or file.
|
||||
VCSBASE_EXPORT void setSource(Core::IDocument *document, const QString &source);
|
||||
VCSBASE_EXPORT void setSource(Core::IDocument *document, const Utils::FilePath &source);
|
||||
// Returns the source of editor contents.
|
||||
VCSBASE_EXPORT QString source(Core::IDocument *document);
|
||||
VCSBASE_EXPORT Utils::FilePath source(Core::IDocument *document);
|
||||
|
||||
class VCSBASE_EXPORT VcsBasePluginPrivate : public Core::IVersionControl
|
||||
{
|
||||
|
Reference in New Issue
Block a user