2009-11-02 18:50:06 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (c) 2014 Brian McGillion
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2009-11-02 18:50:06 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-11-02 18:50:06 +01: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-11-02 18:50:06 +01: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-11-02 18:50:06 +01:00
|
|
|
|
2009-09-15 13:03:13 +03:00
|
|
|
#include "clonewizard.h"
|
|
|
|
|
#include "clonewizardpage.h"
|
|
|
|
|
#include "mercurialplugin.h"
|
|
|
|
|
#include "mercurialsettings.h"
|
|
|
|
|
|
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-09-15 13:03:13 +03:00
|
|
|
|
|
|
|
|
using namespace Mercurial::Internal;
|
2012-01-07 14:32:59 +01:00
|
|
|
using namespace VcsBase;
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2014-05-05 16:00:20 +02:00
|
|
|
CloneWizardFactory::CloneWizardFactory()
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
2012-01-07 14:32:59 +01:00
|
|
|
setId(QLatin1String(Constants::VCS_ID_MERCURIAL));
|
2013-08-29 13:37:45 +03:00
|
|
|
setCustomLabels(tr("Cloning"), tr("Cloning started..."));
|
2013-09-20 15:12:44 +02:00
|
|
|
setIcon(QIcon(QLatin1String(":/mercurial/images/hg.png")));
|
|
|
|
|
setDescription(tr("Clones a Mercurial repository and tries to load the contained project."));
|
|
|
|
|
setDisplayName(tr("Mercurial Clone"));
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
|
2014-05-05 16:00:20 +02:00
|
|
|
QList<QWizardPage *> CloneWizardFactory::createParameterPages(const QString &path)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
2012-01-07 14:32:59 +01:00
|
|
|
QList<QWizardPage *> wizardPageList;
|
2011-04-20 15:49:06 +02:00
|
|
|
const Core::IVersionControl *vc = MercurialPlugin::instance()->versionControl();
|
|
|
|
|
if (!vc->isConfigured())
|
2012-01-07 14:32:59 +01:00
|
|
|
wizardPageList.append(new VcsConfigurationPage(vc));
|
2009-09-15 13:03:13 +03:00
|
|
|
CloneWizardPage *page = new CloneWizardPage;
|
|
|
|
|
page->setPath(path);
|
2011-04-20 15:49:06 +02:00
|
|
|
wizardPageList.append(page);
|
2009-09-15 13:03:13 +03:00
|
|
|
return wizardPageList;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-05 16:00:20 +02:00
|
|
|
Command *CloneWizardFactory::createCommand(const QList<QWizardPage *> ¶meterPages,
|
2013-08-28 21:27:47 +03:00
|
|
|
QString *checkoutPath)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
|
|
|
|
const CloneWizardPage *page = qobject_cast<const CloneWizardPage *>(parameterPages.front());
|
|
|
|
|
|
|
|
|
|
if (!page)
|
2013-08-28 21:27:47 +03:00
|
|
|
return 0;
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2013-08-02 12:23:56 +02:00
|
|
|
const MercurialSettings &settings = MercurialPlugin::settings();
|
2009-09-15 13:03:13 +03:00
|
|
|
|
|
|
|
|
QString path = page->path();
|
|
|
|
|
QString directory = page->directory();
|
|
|
|
|
|
2011-09-14 09:13:44 +00:00
|
|
|
QStringList args;
|
2009-11-03 14:21:48 +01:00
|
|
|
args << QLatin1String("clone") << page->repository() << directory;
|
|
|
|
|
*checkoutPath = path + QLatin1Char('/') + directory;
|
2013-08-28 21:27:47 +03:00
|
|
|
VcsBase::Command *command = new VcsBase::Command(settings.binaryPath(), path,
|
|
|
|
|
QProcessEnvironment::systemEnvironment());
|
|
|
|
|
command->addJob(args, -1);
|
|
|
|
|
return command;
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|