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
|
2014-10-01 13:21:18 +02:00
|
|
|
** conditions see http://www.qt.io/licensing. For further information
|
|
|
|
|
** use the contact form at http://www.qt.io/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
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2012-10-02 09:12:39 +02:00
|
|
|
**
|
|
|
|
|
** 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>
|
2014-08-27 18:55:41 +02:00
|
|
|
#include <vcsbase/vcscommand.h>
|
2009-11-27 10:33:24 +01:00
|
|
|
#include <vcsbase/vcsbaseconstants.h>
|
2015-01-20 12:30:35 +01:00
|
|
|
#include <vcsbase/wizard/vcsconfigurationpage.h>
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2012-01-07 14:32:59 +01:00
|
|
|
using namespace VcsBase;
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2014-08-27 18:55:41 +02:00
|
|
|
namespace Mercurial {
|
|
|
|
|
namespace Internal {
|
2014-05-05 16:17:21 +02:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
// CloneWizard:
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
2014-05-05 18:17:46 +02:00
|
|
|
CloneWizard::CloneWizard(const Utils::FileName &path, QWidget *parent) :
|
2014-08-27 18:55:41 +02:00
|
|
|
BaseCheckoutWizard(path, parent)
|
2014-05-05 16:24:00 +02:00
|
|
|
{
|
|
|
|
|
setTitle(tr("Cloning"));
|
|
|
|
|
setStartedStatus(tr("Cloning started..."));
|
2014-05-05 17:24:51 +02:00
|
|
|
|
|
|
|
|
const Core::IVersionControl *vc = MercurialPlugin::instance()->versionControl();
|
2015-01-20 14:46:10 +01:00
|
|
|
if (!vc->isConfigured()) {
|
|
|
|
|
VcsConfigurationPage *configPage = new VcsConfigurationPage;
|
|
|
|
|
configPage->setVersionControl(vc);
|
|
|
|
|
addPage(configPage);
|
|
|
|
|
}
|
2014-05-05 17:24:51 +02:00
|
|
|
CloneWizardPage *page = new CloneWizardPage;
|
2014-05-05 18:17:46 +02:00
|
|
|
page->setPath(path.toString());
|
2014-05-05 17:24:51 +02:00
|
|
|
addPage(page);
|
2014-05-05 16:24:00 +02:00
|
|
|
}
|
2014-05-05 17:56:54 +02:00
|
|
|
|
2014-08-27 18:55:41 +02:00
|
|
|
VcsCommand *CloneWizard::createCommand(Utils::FileName *checkoutDir)
|
2014-05-05 17:56:54 +02:00
|
|
|
{
|
|
|
|
|
const CloneWizardPage *cwp = 0;
|
|
|
|
|
foreach (int pageId, pageIds()) {
|
|
|
|
|
if ((cwp = qobject_cast<const CloneWizardPage *>(page(pageId))))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!cwp)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
const MercurialSettings &settings = MercurialPlugin::settings();
|
|
|
|
|
|
|
|
|
|
QString path = cwp->path();
|
|
|
|
|
QString directory = cwp->directory();
|
|
|
|
|
|
|
|
|
|
QStringList args;
|
|
|
|
|
args << QLatin1String("clone") << cwp->repository() << directory;
|
2014-05-05 18:17:46 +02:00
|
|
|
*checkoutDir = Utils::FileName::fromString(path + QLatin1Char('/') + directory);
|
2014-08-27 18:55:41 +02:00
|
|
|
VcsCommand *command = new VcsCommand(settings.binaryPath(), path,
|
|
|
|
|
QProcessEnvironment::systemEnvironment());
|
2014-05-05 17:56:54 +02:00
|
|
|
command->addJob(args, -1);
|
|
|
|
|
return command;
|
|
|
|
|
}
|
2014-08-27 18:55:41 +02:00
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Mercurial
|