2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-07-17 17:19:23 +02:00
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2009-07-17 17:19:23 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-07-17 17:19:23 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2009-07-17 17:19:23 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-07-17 17:19:23 +02:00
|
|
|
|
|
|
|
|
#include "checkoutwizard.h"
|
|
|
|
|
#include "checkoutwizardpage.h"
|
|
|
|
|
#include "subversionplugin.h"
|
2013-09-27 15:39:16 +02:00
|
|
|
#include "subversionclient.h"
|
2009-07-17 17:19:23 +02:00
|
|
|
|
2011-04-20 15:49:06 +02:00
|
|
|
#include <coreplugin/iversioncontrol.h>
|
2013-08-28 21:27:47 +03:00
|
|
|
#include <vcsbase/command.h>
|
2009-11-27 10:33:24 +01:00
|
|
|
#include <vcsbase/vcsbaseconstants.h>
|
2011-04-20 15:49:06 +02:00
|
|
|
#include <vcsbase/vcsconfigurationpage.h>
|
2009-07-17 17:19:23 +02:00
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QIcon>
|
2009-07-17 17:19:23 +02:00
|
|
|
|
|
|
|
|
namespace Subversion {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2014-05-05 16:00:20 +02:00
|
|
|
CheckoutWizardFactory::CheckoutWizardFactory()
|
2009-07-17 17:19:23 +02:00
|
|
|
{
|
2012-01-07 12:31:48 +01:00
|
|
|
setId(QLatin1String(VcsBase::Constants::VCS_ID_SUBVERSION));
|
2013-09-20 15:12:44 +02:00
|
|
|
setIcon(QIcon(QLatin1String(":/subversion/images/subversion.png")));
|
|
|
|
|
setDescription(tr("Checks out a Subversion repository and tries to load the contained project."));
|
|
|
|
|
setDisplayName(tr("Subversion Checkout"));
|
2009-07-17 17:19:23 +02:00
|
|
|
}
|
|
|
|
|
|
2014-05-05 16:00:20 +02:00
|
|
|
QList<QWizardPage*> CheckoutWizardFactory::createParameterPages(const QString &path)
|
2009-07-17 17:19:23 +02:00
|
|
|
{
|
2011-04-20 15:49:06 +02:00
|
|
|
QList<QWizardPage*> rc;
|
|
|
|
|
const Core::IVersionControl *vc = SubversionPlugin::instance()->versionControl();
|
|
|
|
|
if (!vc->isConfigured())
|
2012-01-07 12:31:48 +01:00
|
|
|
rc.append(new VcsBase::VcsConfigurationPage(vc));
|
2009-07-17 17:19:23 +02:00
|
|
|
CheckoutWizardPage *cwp = new CheckoutWizardPage;
|
|
|
|
|
cwp->setPath(path);
|
2011-04-20 15:49:06 +02:00
|
|
|
rc.append(cwp);
|
2009-07-21 11:14:48 +02:00
|
|
|
return rc;
|
2009-07-17 17:19:23 +02:00
|
|
|
}
|
|
|
|
|
|
2014-05-05 16:00:20 +02:00
|
|
|
VcsBase::Command *CheckoutWizardFactory::createCommand(const QList<QWizardPage*> ¶meterPages,
|
2013-08-28 21:27:47 +03:00
|
|
|
QString *checkoutPath)
|
2009-07-17 17:19:23 +02:00
|
|
|
{
|
|
|
|
|
// Collect parameters for the checkout command.
|
2014-05-05 16:48:02 +02:00
|
|
|
const CheckoutWizardPage *cwp = 0;
|
|
|
|
|
foreach (const QWizardPage *p, parameterPages) {
|
|
|
|
|
if ((cwp = qobject_cast<const CheckoutWizardPage *>(p)))
|
|
|
|
|
break;
|
|
|
|
|
}
|
2013-08-28 21:27:47 +03:00
|
|
|
QTC_ASSERT(cwp, return 0);
|
2011-04-20 15:49:06 +02:00
|
|
|
const SubversionSettings settings = SubversionPlugin::instance()->settings();
|
2013-02-27 13:25:21 +01:00
|
|
|
const QString binary = settings.binaryPath();
|
2009-07-17 17:19:23 +02:00
|
|
|
const QString directory = cwp->directory();
|
|
|
|
|
QStringList args;
|
|
|
|
|
args << QLatin1String("checkout") << cwp->repository() << directory;
|
|
|
|
|
const QString workingDirectory = cwp->path();
|
|
|
|
|
*checkoutPath = workingDirectory + QLatin1Char('/') + directory;
|
2013-02-27 13:25:21 +01:00
|
|
|
if (settings.hasAuthentication()) {
|
|
|
|
|
const QString user = settings.stringValue(SubversionSettings::userKey);
|
|
|
|
|
const QString pwd = settings.stringValue(SubversionSettings::passwordKey);
|
2013-09-27 15:39:16 +02:00
|
|
|
args = SubversionClient::addAuthenticationOptions(args, user, pwd);
|
2013-02-27 13:25:21 +01:00
|
|
|
}
|
2013-08-28 21:27:47 +03:00
|
|
|
VcsBase::Command *command = new VcsBase::Command(binary, workingDirectory,
|
|
|
|
|
QProcessEnvironment::systemEnvironment());
|
|
|
|
|
command->addJob(args, -1);
|
|
|
|
|
return command;
|
2009-07-17 17:19:23 +02:00
|
|
|
}
|
|
|
|
|
|
2014-05-05 16:17:21 +02:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
// CheckoutWizard:
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
CheckoutWizard::CheckoutWizard(const QList<QWizardPage *> ¶meterPages, QWidget *parent) :
|
|
|
|
|
VcsBase::BaseCheckoutWizard(parameterPages, parent)
|
|
|
|
|
{ }
|
|
|
|
|
|
2009-07-17 17:19:23 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Subversion
|