Commit 0b91b77c authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Subversion: Replace Subversion Checkout wizard



Replace the subversion checkout wizard with a Json wizard.

Change-Id: I969ff00e2e6fdc8088f8c7a928f80454cd987164
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@theqtcompany.com>
Reviewed-by: default avatarLeena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 4f4c6b62
{
"version": 1,
"kind": "project",
"id": "J.Subversion",
"category": "T.Import",
"trDescription": "Checks out a Subversion repository and tries to load the contained project.",
"trDisplayName": "Subversion Checkout",
"trDisplayCategory": "Import Project",
"icon": "icon.png",
"featuresRequired": [ "Plugin.Subversion" ],
"options":
[
{ "key": "vcsId", "value": "J.Subversion" },
{ "key": "vcsName", "value": "%{JS: Vcs.displayName('%{vcsId}')}" },
{ "key": "SR", "value": "%{JS: '%{Repo}'.replace(/\\/trunk$/, '').replace(/\\/$/, '') }"},
{ "key": "defaultDir", "value": "%{JS: '%{SR}'.substr('%{SR}'.lastIndexOf('/') + 1).replace(/\\./, '-') }"},
{ "key": "TargetPath", "value": "%{Path}/%{Dir}" }
],
"pages":
[
{
"trDisplayName": "Configuration",
"trShortTitle": "Configuration",
"trSubTitle": "Please configure <b>%{vcsName}</b> now.",
"typeId": "VcsConfiguration",
"enabled": "%{JS: !Vcs.isConfigured('%{vcsId}')}",
"data": { "vcsId": "%{vcsId}" }
},
{
"trDisplayName": "Location",
"trShortTitle": "Location",
"trSubTitle": "Specify repository URL, checkout directory, and path.",
"typeId": "Fields",
"data" :
[
{
"name": "Repo",
"trDisplayName": "Repository:",
"mandatory": true,
"type": "LineEdit"
},
{
"name": "Sp1",
"type": "Spacer",
"data": { "factor": 2 }
},
{
"name": "Path",
"trDisplayName": "Path:",
"type": "PathChooser",
"data":
{
"kind": "existingDirectory",
"basePath": "%{InitialPath}",
"path": "%{InitialPath}"
}
},
{
"name": "Dir",
"trDisplayName": "Directory:",
"mandatory": true,
"type": "LineEdit",
"isComplete": "%{JS: '%{Dir}' === '' || !Util.exists('%{TargetPath}')}",
"trIncompleteMessage": "\"%{JS: Util.toNativeSeparators('%{TargetPath}')}\" exists in the filesystem.",
"data":
{
"trText": "%{defaultDir}"
}
},
{
"name": "TrustCert",
"trDisplayName": "Trust Server Certificate",
"type": "CheckBox",
"data":
{
"checkedValue": "--trust-server-cert",
"uncheckedValue": ""
}
}
]
},
{
"trDisplayName": "Checkout",
"trShortTitle": "Checkout",
"typeId": "VcsCommand",
"data" :
{
"vcsId": "%{vcsId}",
"trRunMessage": "Running Subversion checkout...",
"repository": "%{Repo}",
"baseDirectory": "%{Path}",
"checkoutName": "%{Dir}",
"extraArguments": [ "%{TrustCert}" ]
}
}
],
"generators":
[
{
"typeId": "Scanner",
"data": {
"subdirectoryPatterns": [ "^src$" ]
}
}
]
}
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qt Creator.
**
** 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 The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** 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.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "checkoutwizard.h"
#include "checkoutwizardpage.h"
#include "subversionconstants.h"
#include "subversionplugin.h"
#include "subversionclient.h"
#include <coreplugin/iversioncontrol.h>
#include <vcsbase/vcscommand.h>
#include <vcsbase/vcsbaseconstants.h>
#include <vcsbase/wizard/vcsconfigurationpage.h>
#include <utils/qtcassert.h>
using namespace Utils;
using namespace VcsBase;
namespace Subversion {
namespace Internal {
// --------------------------------------------------------------------
// CheckoutWizard:
// --------------------------------------------------------------------
CheckoutWizard::CheckoutWizard(const FileName &path, QWidget *parent) :
BaseCheckoutWizard(VcsBase::Constants::VCS_ID_SUBVERSION, parent)
{
auto cwp = new CheckoutWizardPage;
cwp->setPath(path.toString());
addPage(cwp);
}
VcsCommand *CheckoutWizard::createCommand(FileName *checkoutDir)
{
// Collect parameters for the checkout command.
const CheckoutWizardPage *cwp = find<CheckoutWizardPage>();
QTC_ASSERT(cwp, return 0);
QStringList args;
if (cwp->trustServerCert())
args << QLatin1String("--trust-server-cert");
const QString directory = cwp->directory();
const QString workingDirectory = cwp->path();
*checkoutDir = FileName::fromString(workingDirectory + QLatin1Char('/') + directory);
return createCommandImpl(cwp->repository(), Utils::FileName::fromString(workingDirectory),
directory, args);
}
} // namespace Internal
} // namespace Subversion
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qt Creator.
**
** 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 The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** 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.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef CHECKOUTWIZARD_H
#define CHECKOUTWIZARD_H
#include <vcsbase/basecheckoutwizardfactory.h>
#include <vcsbase/basecheckoutwizard.h>
namespace Subversion {
namespace Internal {
class CheckoutWizard : public VcsBase::BaseCheckoutWizard
{
Q_OBJECT
public:
CheckoutWizard(const Utils::FileName &path, QWidget *parent = 0);
protected:
VcsBase::VcsCommand *createCommand(Utils::FileName *checkoutDir);
};
} // namespace Internal
} // namespace Subversion
#endif // CHECKOUTWIZARD_H
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qt Creator.
**
** 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 The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** 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.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "checkoutwizardpage.h"
#include <QCheckBox>
namespace Subversion {
namespace Internal {
CheckoutWizardPage::CheckoutWizardPage(QWidget *parent) :
VcsBase::BaseCheckoutWizardPage(parent),
m_trustServerCertBox(new QCheckBox(tr("Trust Server Certificate")))
{
setTitle(tr("Location"));
setSubTitle(tr("Specify repository URL, checkout directory and path."));
setRepositoryLabel(tr("Repository:"));
setBranchSelectorVisible(false);
addLocalControl(m_trustServerCertBox);
}
bool CheckoutWizardPage::trustServerCert() const
{
return m_trustServerCertBox->isChecked();
}
QString CheckoutWizardPage::directoryFromRepository(const QString &repoIn) const
{
/* Try to figure out a good directory name from something like:
* "svn://<server>/path1/project" -> project */
QString repo = repoIn.trimmed();
const QChar slash = QLatin1Char('/');
// remove host
const int slashPos = repo.lastIndexOf(slash);
if (slashPos != -1)
repo.remove(0, slashPos + 1);
// fix invalid characters
repo.replace(QLatin1Char('.'), QLatin1Char('-'));
return repo;
}
} // namespace Internal
} // namespace Subversion
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qt Creator.
**
** 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 The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** 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.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef CHECKOUTWIZARDPAGE_H
#define CHECKOUTWIZARDPAGE_H
#include <vcsbase/basecheckoutwizardpage.h>
QT_BEGIN_NAMESPACE
class QCheckBox;
QT_END_NAMESPACE
namespace Subversion {
namespace Internal {
class CheckoutWizardPage : public VcsBase::BaseCheckoutWizardPage {
Q_OBJECT
public:
CheckoutWizardPage(QWidget *parent = 0);
bool trustServerCert() const;
protected:
QString directoryFromRepository(const QString &r) const;
private:
QCheckBox *m_trustServerCertBox;
};
} // namespace Internal
} // namespace Subversion
#endif // CHECKOUTWIZARDPAGE_H
......@@ -8,8 +8,6 @@ HEADERS += annotationhighlighter.h \
subversioneditor.h \
subversionsubmiteditor.h \
subversionsettings.h \
checkoutwizard.h \
checkoutwizardpage.h \
subversionconstants.h
SOURCES += annotationhighlighter.cpp \
......@@ -19,9 +17,7 @@ SOURCES += annotationhighlighter.cpp \
settingspage.cpp \
subversioneditor.cpp \
subversionsubmiteditor.cpp \
subversionsettings.cpp \
checkoutwizard.cpp \
checkoutwizardpage.cpp
subversionsettings.cpp
FORMS += settingspage.ui
......
......@@ -14,10 +14,6 @@ QtcPlugin {
files: [
"annotationhighlighter.cpp",
"annotationhighlighter.h",
"checkoutwizard.cpp",
"checkoutwizard.h",
"checkoutwizardpage.cpp",
"checkoutwizardpage.h",
"settingspage.cpp",
"settingspage.h",
"settingspage.ui",
......
<RCC>
<qresource prefix="/subversion">
<file>images/subversion.png</file>
</qresource>
<qresource prefix="/trolltech.subversion">
<file>Subversion.mimetypes.xml</file>
</qresource>
......
......@@ -37,7 +37,6 @@
#include "subversionclient.h"
#include "subversionconstants.h"
#include "subversioncontrol.h"
#include "checkoutwizard.h"
#include <vcsbase/basevcseditorfactory.h>
#include <vcsbase/vcscommand.h>
......@@ -260,16 +259,6 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
for (int i = 0; i < editorCount; i++)
addAutoReleasedObject(new VcsEditorFactory(editorParameters + i, widgetCreator, this, describeSlot));
auto checkoutWizardFactory = new BaseCheckoutWizardFactory;
checkoutWizardFactory->setId(QLatin1String(VcsBase::Constants::VCS_ID_SUBVERSION));
checkoutWizardFactory->setIcon(QIcon(QLatin1String(":/subversion/images/subversion.png")));
checkoutWizardFactory->setDescription(tr("Checks out a Subversion repository and tries to load the contained project."));
checkoutWizardFactory->setDisplayName(tr("Subversion Checkout"));
checkoutWizardFactory->setWizardCreator([this] (const FileName &path, QWidget *parent) {
return new CheckoutWizard(path, parent);
});
addAutoReleasedObject(checkoutWizardFactory);
const QString prefix = QLatin1String("svn");
m_commandLocator = new CommandLocator("Subversion", prefix, prefix);
addAutoReleasedObject(m_commandLocator);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment