Vcs: Use new FilePathAspect in a few places

Change-Id: Idc23616dd3b7bc21301471cb48e2893116b83f0d
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2023-05-15 18:32:01 +02:00
parent 6c5fb656d6
commit 337497d990
12 changed files with 15 additions and 19 deletions

View File

@@ -871,7 +871,7 @@ bool BazaarPluginPrivate::managesFile(const FilePath &workingDirectory, const QS
bool BazaarPluginPrivate::isConfigured() const
{
const FilePath binary = settings().binaryPath.filePath();
const FilePath binary = settings().binaryPath();
return !binary.isEmpty() && binary.isExecutableFile();
}

View File

@@ -33,7 +33,6 @@ BazaarSettings::BazaarSettings()
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
registerAspect(&binaryPath);
binaryPath.setDisplayStyle(StringAspect::PathChooserDisplay);
binaryPath.setExpectedKind(PathChooser::ExistingCommand);
binaryPath.setDefaultValue(Constants::BAZAARDEFAULT);
binaryPath.setDisplayName(Tr::tr("Bazaar Command"));

View File

@@ -366,7 +366,7 @@ bool CvsPluginPrivate::isVcsFileOrDirectory(const Utils::FilePath &filePath) con
bool CvsPluginPrivate::isConfigured() const
{
const FilePath binary = settings().binaryPath.filePath();
const FilePath binary = settings().binaryPath();
if (binary.isEmpty())
return false;
QFileInfo fi = binary.toFileInfo();
@@ -439,7 +439,7 @@ VcsCommand *CvsPluginPrivate::createInitialCheckoutCommand(const QString &url,
auto command = VcsBaseClient::createVcsCommand(baseDirectory, Environment::systemEnvironment());
command->setDisplayName(Tr::tr("CVS Checkout"));
command->addJob({settings().binaryPath.filePath(), settings().addOptions(args)}, -1);
command->addJob({settings().binaryPath(), settings().addOptions(args)}, -1);
return command;
}
@@ -1321,7 +1321,7 @@ CommandResult CvsPluginPrivate::runCvs(const FilePath &workingDirectory,
const QStringList &arguments, RunFlags flags,
QTextCodec *outputCodec, int timeoutMultiplier) const
{
const FilePath executable = settings().binaryPath.filePath();
const FilePath executable = settings().binaryPath();
if (executable.isEmpty())
return CommandResult(ProcessResult::StartFailed, Tr::tr("No CVS executable specified."));

View File

@@ -35,7 +35,6 @@ CvsSettings::CvsSettings()
registerAspect(&binaryPath);
binaryPath.setDefaultValue("cvs" QTC_HOST_EXE_SUFFIX);
binaryPath.setDisplayStyle(StringAspect::PathChooserDisplay);
binaryPath.setExpectedKind(PathChooser::ExistingCommand);
binaryPath.setHistoryCompleter(QLatin1String("Cvs.Command.History"));
binaryPath.setDisplayName(Tr::tr("CVS Command"));

View File

@@ -34,7 +34,6 @@ FossilSettings::FossilSettings()
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
registerAspect(&binaryPath);
binaryPath.setDisplayStyle(StringAspect::PathChooserDisplay);
binaryPath.setExpectedKind(PathChooser::ExistingCommand);
binaryPath.setDefaultValue(Constants::FOSSILDEFAULT);
binaryPath.setDisplayName(Tr::tr("Fossil Command"));

View File

@@ -428,7 +428,7 @@ void MercurialClient::requestReload(const QString &documentId, const FilePath &s
IDocument *document = DiffEditorController::findOrCreateDocument(documentId, title);
QTC_ASSERT(document, return);
auto controller = new MercurialDiffEditorController(document, args);
controller->setVcsBinary(settings().binaryPath.filePath());
controller->setVcsBinary(settings().binaryPath());
controller->setProcessEnvironment(processEnvironment());
controller->setWorkingDirectory(workingDirectory);

View File

@@ -715,7 +715,7 @@ bool MercurialPluginPrivate::managesFile(const FilePath &workingDirectory, const
bool MercurialPluginPrivate::isConfigured() const
{
const FilePath binary = settings().binaryPath.filePath();
const FilePath binary = settings().binaryPath();
if (binary.isEmpty())
return false;
QFileInfo fi = binary.toFileInfo();

View File

@@ -34,7 +34,6 @@ MercurialSettings::MercurialSettings()
setAutoApply(false);
registerAspect(&binaryPath);
binaryPath.setDisplayStyle(StringAspect::PathChooserDisplay);
binaryPath.setExpectedKind(PathChooser::ExistingCommand);
binaryPath.setDefaultValue(Constants::MERCURIALDEFAULT);
binaryPath.setDisplayName(Tr::tr("Mercurial Command"));

View File

@@ -240,7 +240,7 @@ SubversionDiffEditorController *SubversionClient::findOrCreateDiffEditor(const Q
DiffEditorController::controller(document));
if (!controller) {
controller = new SubversionDiffEditorController(document);
controller->setVcsBinary(settings.binaryPath.filePath());
controller->setVcsBinary(settings.binaryPath());
controller->setProcessEnvironment(processEnvironment());
controller->setWorkingDirectory(workingDirectory);
}

View File

@@ -638,7 +638,7 @@ void SubversionPluginPrivate::revertAll()
QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
return;
// NoteL: Svn "revert ." doesn not work.
CommandLine args{settings().binaryPath.filePath(), {"revert"}};
CommandLine args{settings().binaryPath(), {"revert"}};
args << SubversionClient::AddAuthOptions();
args << QLatin1String("--recursive") << state.topLevel().toString();
const auto revertResponse = runSvn(state.topLevel(), args, RunFlags::ShowStdOut);
@@ -655,7 +655,7 @@ void SubversionPluginPrivate::revertCurrentFile()
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
CommandLine diffArgs{settings().binaryPath.filePath(), {"diff"}};
CommandLine diffArgs{settings().binaryPath(), {"diff"}};
diffArgs << SubversionClient::AddAuthOptions();
diffArgs << SubversionClient::escapeFile(state.relativeCurrentFile());
@@ -673,7 +673,7 @@ void SubversionPluginPrivate::revertCurrentFile()
FileChangeBlocker fcb(state.currentFile());
// revert
CommandLine args{settings().binaryPath.filePath(), {"revert"}};
CommandLine args{settings().binaryPath(), {"revert"}};
args << SubversionClient::AddAuthOptions();
args << SubversionClient::escapeFile(state.relativeCurrentFile());
@@ -734,7 +734,7 @@ void SubversionPluginPrivate::startCommit(const FilePath &workingDir, const QStr
return;
}
CommandLine args{settings().binaryPath.filePath(), {"status"}};
CommandLine args{settings().binaryPath(), {"status"}};
args << SubversionClient::AddAuthOptions();
args << SubversionClient::escapeFiles(files);
@@ -813,7 +813,7 @@ void SubversionPluginPrivate::svnStatus(const FilePath &workingDir, const QStrin
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
CommandLine args{settings().binaryPath.filePath(), {"status"}};
CommandLine args{settings().binaryPath(), {"status"}};
args << SubversionClient::AddAuthOptions();
if (!relativePath.isEmpty())
args << SubversionClient::escapeFile(relativePath);
@@ -839,7 +839,7 @@ void SubversionPluginPrivate::updateProject()
void SubversionPluginPrivate::svnUpdate(const FilePath &workingDir, const QString &relativePath)
{
CommandLine args{settings().binaryPath.filePath(), {"update"}};
CommandLine args{settings().binaryPath(), {"update"}};
args << SubversionClient::AddAuthOptions();
args << Constants::NON_INTERACTIVE_OPTION;
if (!relativePath.isEmpty())

View File

@@ -69,7 +69,7 @@ VcsBaseSettings &VcsBaseClientImpl::settings() const
FilePath VcsBaseClientImpl::vcsBinary() const
{
return m_baseSettings->binaryPath.filePath();
return m_baseSettings->binaryPath();
}
VcsCommand *VcsBaseClientImpl::createCommand(const FilePath &workingDirectory,

View File

@@ -15,7 +15,7 @@ public:
VcsBaseSettings();
~VcsBaseSettings();
Utils::StringAspect binaryPath;
Utils::FilePathAspect binaryPath;
Utils::StringAspect userName;
Utils::StringAspect userEmail;
Utils::IntegerAspect logCount;