forked from qt-creator/qt-creator
VCS: Replace AbstractCheckoutJob with Command
Command now provides the same functionality. Deduplicate code. Change-Id: I789f021050471281870b6ef6a81a94e66fbdf0c7 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
27e53f746f
commit
aefd61478a
@@ -31,7 +31,7 @@
|
||||
#include "gitplugin.h"
|
||||
#include "gitclient.h"
|
||||
|
||||
#include <vcsbase/checkoutjobs.h>
|
||||
#include <vcsbase/command.h>
|
||||
|
||||
namespace Git {
|
||||
|
||||
@@ -112,25 +112,24 @@ QString CloneWizardPage::directoryFromRepository(const QString &urlIn) const
|
||||
return url;
|
||||
}
|
||||
|
||||
QSharedPointer<VcsBase::AbstractCheckoutJob> CloneWizardPage::createCheckoutJob(QString *checkoutPath) const
|
||||
VcsBase::Command *CloneWizardPage::createCheckoutJob(QString *checkoutPath) const
|
||||
{
|
||||
const Internal::GitClient *client = Internal::GitPlugin::instance()->gitClient();
|
||||
const QString workingDirectory = path();
|
||||
const QString checkoutDir = directory();
|
||||
*checkoutPath = workingDirectory + QLatin1Char('/') + checkoutDir;
|
||||
|
||||
const QString binary = client->gitBinaryPath();
|
||||
|
||||
VcsBase::ProcessCheckoutJob *job = new VcsBase::ProcessCheckoutJob;
|
||||
const QProcessEnvironment env = client->processEnvironment();
|
||||
const QString checkoutBranch = branch();
|
||||
|
||||
QStringList args(QLatin1String("clone"));
|
||||
if (!checkoutBranch.isEmpty())
|
||||
args << QLatin1String("--branch") << checkoutBranch;
|
||||
args << repository() << checkoutDir;
|
||||
job->addStep(binary, args, workingDirectory, env);
|
||||
return QSharedPointer<VcsBase::AbstractCheckoutJob>(job);
|
||||
VcsBase::Command *command = new VcsBase::Command(client->gitBinaryPath(), workingDirectory,
|
||||
client->processEnvironment());
|
||||
command->addFlags(VcsBase::VcsBasePlugin::MergeOutputChannels);
|
||||
command->addJob(args, -1);
|
||||
return command;
|
||||
}
|
||||
|
||||
QStringList CloneWizardPage::branches(const QString &repository, int *current)
|
||||
|
||||
Reference in New Issue
Block a user