void VcsCommandPage::delayedInitialize() { auto wiz = qobject_cast<JsonWizard *>(wizard()); QTC_ASSERT(wiz, return); const QString vcsId = wiz->expander()->expand(m_vcsId); IVersionControl *vc = VcsManager::versionControl(Id::fromString(vcsId)); if (!vc) { qWarning() << QCoreApplication::translate("VcsBase::VcsCommandPage", "\"%1\" (%2) not found.") .arg(QLatin1String(VCSCOMMAND_VCSID), vcsId); return; } if (!vc->isConfigured()) { qWarning() << QCoreApplication::translate("VcsBase::VcsCommandPage", "Version control \"%1\" is not configured.") .arg(vcsId); return; } if (!vc->supportsOperation(IVersionControl::InitialCheckoutOperation)) { qWarning() << QCoreApplication::translate("VcsBase::VcsCommandPage", "Version control \"%1\" does not support initial checkouts.") .arg(vcsId); return; } const QString repo = wiz->expander()->expand(m_repository); if (repo.isEmpty()) { qWarning() << QCoreApplication::translate("VcsBase::VcsCommandPage", "\"%1\" is empty when trying to run checkout.") .arg(QLatin1String(VCSCOMMAND_REPO)); return; } const QString base = wiz->expander()->expand(m_directory); if (!QDir(base).exists()) { qWarning() << QCoreApplication::translate("VcsBase::VcsCommandPage", "\"%1\" (%2) does not exist.") .arg(QLatin1String(VCSCOMMAND_DIR), base); return; } const QString name = wiz->expander()->expand(m_name); if (name.isEmpty()) { qWarning() << QCoreApplication::translate("VcsBase::VcsCommandPage", "\"%1\" is empty when trying to run checkout.") .arg(QLatin1String(VCSCOMMAND_CHECKOUTNAME)); return; } const QString runMessage = wiz->expander()->expand(m_runMessage); if (!runMessage.isEmpty()) setStartedStatus(runMessage); QStringList extraArgs; foreach (const QString &in, m_arguments) { const QString tmp = wiz->expander()->expand(in); if (tmp.isEmpty()) continue; if (tmp == QStringLiteral("\"\"")) extraArgs << QString(); extraArgs << tmp; } ShellCommand *command = vc->createInitialCheckoutCommand(repo, Utils::FileName::fromString(base), name, extraArgs); foreach (const JobData &job, m_additionalJobs) { QTC_ASSERT(!job.job.isEmpty(), continue); if (!JsonWizard::boolFromVariant(job.condition, wiz->expander())) continue; QString commandString = wiz->expander()->expand(job.job.at(0)); if (commandString.isEmpty()) continue; QStringList args; for (int i = 1; i < job.job.count(); ++i) { const QString tmp = wiz->expander()->expand(job.job.at(i)); if (tmp.isEmpty() && job.skipEmptyArguments) continue; args << tmp; } const QString dir = wiz->expander()->expand(job.workDirectory); const int timeoutS = command->defaultTimeoutS() * job.timeOutFactor; command->addJob(Utils::FileName::fromUserInput(commandString), args, timeoutS, dir); }
bool VcsJsExtension::isConfigured(const QString &vcsId) const { IVersionControl *vc = VcsManager::versionControl(Id::fromString(vcsId)); return vc && vc->isConfigured(); }