2009-11-02 18:50:06 +01:00
|
|
|
/**************************************************************************
|
|
|
|
**
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
**
|
|
|
|
** Copyright (c) 2009 Brian McGillion
|
|
|
|
**
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** No Commercial Usage
|
2009-11-02 18:50:06 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** This file contains pre-release code and may not be distributed.
|
|
|
|
** You may use this file in accordance with the terms and conditions
|
|
|
|
** contained in the Technology Preview License Agreement accompanying
|
|
|
|
** this package.
|
2009-11-02 18:50:06 +01:00
|
|
|
**
|
|
|
|
** 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 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.
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
** Nokia at qt-info@nokia.com.
|
2009-11-02 18:50:06 +01:00
|
|
|
**
|
|
|
|
**************************************************************************/
|
|
|
|
|
2009-09-15 13:03:13 +03:00
|
|
|
#include "mercurialclient.h"
|
|
|
|
#include "mercurialjobrunner.h"
|
|
|
|
#include "constants.h"
|
|
|
|
#include "mercurialsettings.h"
|
|
|
|
#include "mercurialplugin.h"
|
|
|
|
|
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
#include <coreplugin/editormanager/editormanager.h>
|
|
|
|
|
|
|
|
#include <utils/qtcassert.h>
|
2010-03-01 10:06:05 +01:00
|
|
|
#include <utils/synchronousprocess.h>
|
2009-09-15 13:03:13 +03:00
|
|
|
#include <vcsbase/vcsbaseeditor.h>
|
2009-11-05 12:45:02 +01:00
|
|
|
#include <vcsbase/vcsbaseoutputwindow.h>
|
2009-09-15 13:03:13 +03:00
|
|
|
|
|
|
|
#include <QtCore/QStringList>
|
|
|
|
#include <QtCore/QSharedPointer>
|
|
|
|
#include <QtCore/QDir>
|
|
|
|
#include <QtCore/QProcess>
|
|
|
|
#include <QtCore/QTextCodec>
|
|
|
|
#include <QtCore/QtDebug>
|
2009-11-03 14:21:48 +01:00
|
|
|
#include <QtCore/QFileInfo>
|
|
|
|
#include <QtCore/QByteArray>
|
2009-12-04 12:58:01 +01:00
|
|
|
#include <QtCore/QMetaType>
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-12-04 12:58:01 +01:00
|
|
|
Q_DECLARE_METATYPE(QVariant)
|
2009-09-15 13:03:13 +03:00
|
|
|
|
|
|
|
inline Core::IEditor* locateEditor(const Core::ICore *core, const char *property, const QString &entry)
|
|
|
|
{
|
|
|
|
foreach (Core::IEditor *ed, core->editorManager()->openedEditors())
|
|
|
|
if (ed->file()->property(property).toString() == entry)
|
|
|
|
return ed;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-08-19 16:26:47 +02:00
|
|
|
static const char nonInteractiveOptionC[] = "--noninteractive";
|
|
|
|
|
2009-12-04 12:58:01 +01:00
|
|
|
namespace Mercurial {
|
|
|
|
namespace Internal {
|
|
|
|
|
2009-11-06 12:32:38 +01:00
|
|
|
MercurialClient::MercurialClient() :
|
|
|
|
jobManager(0),
|
|
|
|
core(Core::ICore::instance())
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
2009-12-04 12:58:01 +01:00
|
|
|
qRegisterMetaType<QVariant>();
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
MercurialClient::~MercurialClient()
|
|
|
|
{
|
|
|
|
if (jobManager) {
|
|
|
|
delete jobManager;
|
|
|
|
jobManager = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
bool MercurialClient::add(const QString &workingDir, const QString &filename)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
|
|
|
QStringList args;
|
2009-12-08 14:28:00 +01:00
|
|
|
args << QLatin1String("add") << filename;
|
2010-03-01 10:06:05 +01:00
|
|
|
QByteArray stdOut;
|
2010-05-25 12:24:18 +02:00
|
|
|
return executeHgFullySynchronously(workingDir, args, &stdOut);
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
bool MercurialClient::remove(const QString &workingDir, const QString &filename)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
|
|
|
QStringList args;
|
2009-12-08 14:28:00 +01:00
|
|
|
args << QLatin1String("remove") << filename;
|
2010-03-01 10:06:05 +01:00
|
|
|
QByteArray stdOut;
|
2010-05-25 12:24:18 +02:00
|
|
|
return executeHgFullySynchronously(workingDir, args, &stdOut);
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
2010-05-11 14:13:38 +02:00
|
|
|
bool MercurialClient::move(const QString &workingDir, const QString &from, const QString &to)
|
|
|
|
{
|
|
|
|
QStringList args;
|
|
|
|
args << QLatin1String("rename") << from << to;
|
|
|
|
QByteArray stdOut;
|
2010-05-25 12:24:18 +02:00
|
|
|
return executeHgFullySynchronously(workingDir, args, &stdOut);
|
2010-05-11 14:13:38 +02:00
|
|
|
}
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
bool MercurialClient::manifestSync(const QString &repository, const QString &relativeFilename)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
2009-12-08 14:28:00 +01:00
|
|
|
// This only works when called from the repo and outputs paths relative to it.
|
|
|
|
const QStringList args(QLatin1String("manifest"));
|
2009-09-15 13:03:13 +03:00
|
|
|
|
|
|
|
QByteArray output;
|
2010-05-25 12:24:18 +02:00
|
|
|
executeHgFullySynchronously(repository, args, &output);
|
2009-12-08 14:28:00 +01:00
|
|
|
const QDir repositoryDir(repository);
|
|
|
|
const QFileInfo needle = QFileInfo(repositoryDir, relativeFilename);
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-11-03 16:38:39 +01:00
|
|
|
const QStringList files = QString::fromLocal8Bit(output).split(QLatin1Char('\n'));
|
|
|
|
foreach (const QString &fileName, files) {
|
2009-12-08 14:28:00 +01:00
|
|
|
const QFileInfo managedFile(repositoryDir, fileName);
|
|
|
|
if (needle == managedFile)
|
2009-09-15 13:03:13 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-05-25 12:24:18 +02:00
|
|
|
Utils::SynchronousProcessResponse
|
|
|
|
MercurialClient::executeHgSynchronously(const QString &workingDirectory,
|
|
|
|
const QStringList &hgArgs,
|
|
|
|
unsigned flags,
|
|
|
|
QTextCodec *outputCodec)
|
|
|
|
{
|
|
|
|
const MercurialSettings &settings = MercurialPlugin::instance()->settings();
|
|
|
|
const QString binary = settings.binary();
|
|
|
|
const QStringList arguments = settings.standardArguments() + hgArgs;
|
|
|
|
return VCSBase::VCSBasePlugin::runVCS(workingDirectory, binary, arguments,
|
|
|
|
settings.timeoutMilliSeconds(),
|
|
|
|
flags, outputCodec);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MercurialClient::executeHgFullySynchronously(const QString &workingDir,
|
2009-12-08 14:28:00 +01:00
|
|
|
const QStringList &args,
|
2009-11-05 12:45:02 +01:00
|
|
|
QByteArray *output) const
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
|
|
|
QProcess hgProcess;
|
2009-12-08 14:28:00 +01:00
|
|
|
if (!workingDir.isEmpty())
|
|
|
|
hgProcess.setWorkingDirectory(workingDir);
|
2010-03-01 10:32:32 +01:00
|
|
|
MercurialJobRunner::setProcessEnvironment(hgProcess);
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-11-06 12:32:38 +01:00
|
|
|
const MercurialSettings &settings = MercurialPlugin::instance()->settings();
|
|
|
|
const QString binary = settings.binary();
|
|
|
|
const QStringList arguments = settings.standardArguments() + args;
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-11-05 12:45:02 +01:00
|
|
|
VCSBase::VCSBaseOutputWindow *outputWindow = VCSBase::VCSBaseOutputWindow::instance();
|
2010-05-21 17:46:00 +02:00
|
|
|
outputWindow->appendCommand(workingDir, binary, args);
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-11-05 12:45:02 +01:00
|
|
|
hgProcess.start(binary, arguments);
|
|
|
|
|
|
|
|
if (!hgProcess.waitForStarted()) {
|
|
|
|
outputWindow->appendError(MercurialJobRunner::msgStartFailed(binary, hgProcess.errorString()));
|
2009-09-15 13:03:13 +03:00
|
|
|
return false;
|
2009-11-05 12:45:02 +01:00
|
|
|
}
|
2009-09-15 13:03:13 +03:00
|
|
|
|
|
|
|
hgProcess.closeWriteChannel();
|
|
|
|
|
2010-03-01 10:06:05 +01:00
|
|
|
QByteArray stdErr;
|
|
|
|
if (!Utils::SynchronousProcess::readDataFromProcess(hgProcess, settings.timeoutMilliSeconds(),
|
2010-05-21 17:46:00 +02:00
|
|
|
output, &stdErr, true)) {
|
2010-03-01 10:06:05 +01:00
|
|
|
Utils::SynchronousProcess::stopProcess(hgProcess);
|
2009-11-06 12:32:38 +01:00
|
|
|
outputWindow->appendError(MercurialJobRunner::msgTimeout(settings.timeoutSeconds()));
|
2009-09-15 13:03:13 +03:00
|
|
|
return false;
|
|
|
|
}
|
2010-03-01 10:06:05 +01:00
|
|
|
if (!stdErr.isEmpty())
|
|
|
|
outputWindow->append(QString::fromLocal8Bit(stdErr));
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2010-03-01 10:06:05 +01:00
|
|
|
return hgProcess.exitStatus() == QProcess::NormalExit && hgProcess.exitCode() == 0;
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
QString MercurialClient::branchQuerySync(const QString &repositoryRoot)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
|
|
|
QByteArray output;
|
2010-05-25 12:24:18 +02:00
|
|
|
if (executeHgFullySynchronously(repositoryRoot, QStringList(QLatin1String("branch")), &output))
|
2009-09-15 13:03:13 +03:00
|
|
|
return QTextCodec::codecForLocale()->toUnicode(output).trimmed();
|
|
|
|
|
2009-11-03 16:38:39 +01:00
|
|
|
return QLatin1String("Unknown Branch");
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
2010-01-08 09:44:07 +01:00
|
|
|
static inline QString msgParentRevisionFailed(const QString &workingDirectory,
|
|
|
|
const QString &revision,
|
|
|
|
const QString &why)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
2010-07-05 09:52:32 +02:00
|
|
|
return MercurialClient::tr("Unable to find parent revisions of %1 in %2: %3").
|
|
|
|
arg(revision, QDir::toNativeSeparators(workingDirectory), why);
|
2010-01-08 09:44:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline QString msgParseParentsOutputFailed(const QString &output)
|
|
|
|
{
|
|
|
|
return MercurialClient::tr("Cannot parse output: %1").arg(output);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MercurialClient::parentRevisionsSync(const QString &workingDirectory,
|
|
|
|
const QString &file /* = QString() */,
|
|
|
|
const QString &revision,
|
|
|
|
QStringList *parents)
|
|
|
|
{
|
|
|
|
parents->clear();
|
|
|
|
QStringList args;
|
|
|
|
args << QLatin1String("parents") << QLatin1String("-r") <<revision;
|
|
|
|
if (!file.isEmpty())
|
|
|
|
args << file;
|
|
|
|
QByteArray outputData;
|
2010-05-25 12:24:18 +02:00
|
|
|
if (!executeHgFullySynchronously(workingDirectory, args, &outputData))
|
2010-01-08 09:44:07 +01:00
|
|
|
return false;
|
|
|
|
QString output = QString::fromLocal8Bit(outputData);
|
|
|
|
output.remove(QLatin1Char('\r'));
|
|
|
|
/* Looks like: \code
|
|
|
|
changeset: 0:031a48610fba
|
|
|
|
user: ...
|
|
|
|
\endcode */
|
|
|
|
// Obtain first line and split by blank-delimited tokens
|
|
|
|
VCSBase::VCSBaseOutputWindow *outputWindow = VCSBase::VCSBaseOutputWindow::instance();
|
|
|
|
const QStringList lines = output.split(QLatin1Char('\n'));
|
|
|
|
if (lines.size() < 1) {
|
|
|
|
outputWindow->appendSilently(msgParentRevisionFailed(workingDirectory, revision, msgParseParentsOutputFailed(output)));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
QStringList changeSets = lines.front().simplified().split(QLatin1Char(' '));
|
|
|
|
if (changeSets.size() < 2) {
|
|
|
|
outputWindow->appendSilently(msgParentRevisionFailed(workingDirectory, revision, msgParseParentsOutputFailed(output)));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// Remove revision numbers
|
|
|
|
const QChar colon = QLatin1Char(':');
|
|
|
|
const QStringList::iterator end = changeSets.end();
|
|
|
|
QStringList::iterator it = changeSets.begin();
|
|
|
|
for (++it; it != end; ++it) {
|
|
|
|
const int colonIndex = it->indexOf(colon);
|
|
|
|
if (colonIndex != -1)
|
|
|
|
parents->push_back(it->mid(colonIndex + 1));
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Describe a change using an optional format
|
|
|
|
bool MercurialClient::shortDescriptionSync(const QString &workingDirectory,
|
|
|
|
const QString &revision,
|
|
|
|
const QString &format,
|
|
|
|
QString *description)
|
|
|
|
{
|
|
|
|
description->clear();
|
|
|
|
QStringList args;
|
|
|
|
args << QLatin1String("log") << QLatin1String("-r") <<revision;
|
|
|
|
if (!format.isEmpty())
|
|
|
|
args << QLatin1String("--template") << format;
|
|
|
|
QByteArray outputData;
|
2010-05-25 12:24:18 +02:00
|
|
|
if (!executeHgFullySynchronously(workingDirectory, args, &outputData))
|
2010-01-08 09:44:07 +01:00
|
|
|
return false;
|
|
|
|
*description = QString::fromLocal8Bit(outputData);
|
|
|
|
description->remove(QLatin1Char('\r'));
|
|
|
|
if (description->endsWith(QLatin1Char('\n')))
|
|
|
|
description->truncate(description->size() - 1);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Default format: "SHA1 (author summmary)"
|
|
|
|
static const char defaultFormatC[] = "{node} ({author|person} {desc|firstline})";
|
|
|
|
|
|
|
|
bool MercurialClient::shortDescriptionSync(const QString &workingDirectory,
|
|
|
|
const QString &revision,
|
|
|
|
QString *description)
|
|
|
|
{
|
|
|
|
if (!shortDescriptionSync(workingDirectory, revision, QLatin1String(defaultFormatC), description))
|
|
|
|
return false;
|
|
|
|
description->remove(QLatin1Char('\n'));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Convenience to format a list of changes
|
|
|
|
bool MercurialClient::shortDescriptionsSync(const QString &workingDirectory, const QStringList &revisions,
|
|
|
|
QStringList *descriptions)
|
|
|
|
{
|
|
|
|
descriptions->clear();
|
|
|
|
foreach(const QString &revision, revisions) {
|
|
|
|
QString description;
|
|
|
|
if (!shortDescriptionSync(workingDirectory, revision, &description))
|
|
|
|
return false;
|
|
|
|
descriptions->push_back(description);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MercurialClient::slotAnnotateRevisionRequested(const QString &source, QString change, int lineNumber)
|
|
|
|
{
|
|
|
|
// This might be invoked with a verbose revision description
|
|
|
|
// "SHA1 author subject" from the annotation context menu. Strip the rest.
|
|
|
|
const int blankPos = change.indexOf(QLatin1Char(' '));
|
|
|
|
if (blankPos != -1)
|
|
|
|
change.truncate(blankPos);
|
2010-01-07 17:29:58 +01:00
|
|
|
const QFileInfo fi(source);
|
|
|
|
annotate(fi.absolutePath(), fi.fileName(), change, lineNumber);
|
|
|
|
}
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2010-01-07 17:29:58 +01:00
|
|
|
void MercurialClient::annotate(const QString &workingDir, const QString &file,
|
|
|
|
const QString revision /* = QString() */,
|
|
|
|
int lineNumber /* = -1 */)
|
|
|
|
{
|
|
|
|
Q_UNUSED(lineNumber)
|
|
|
|
QStringList args;
|
|
|
|
args << QLatin1String("annotate") << QLatin1String("-u") << QLatin1String("-c") << QLatin1String("-d");
|
|
|
|
if (!revision.isEmpty())
|
|
|
|
args << QLatin1String("-r") << revision;
|
|
|
|
args << file;
|
2009-11-03 16:38:39 +01:00
|
|
|
const QString kind = QLatin1String(Constants::ANNOTATELOG);
|
2009-12-08 14:28:00 +01:00
|
|
|
const QString id = VCSBase::VCSBaseEditor::getSource(workingDir, QStringList(file));
|
|
|
|
const QString title = tr("Hg Annotate %1").arg(id);
|
|
|
|
const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, file);
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, source, true,
|
|
|
|
"annotate", id);
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
QSharedPointer<HgTask> job(new HgTask(workingDir, args, editor));
|
2009-11-06 12:32:38 +01:00
|
|
|
enqueueJob(job);
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
void MercurialClient::diff(const QString &workingDir, const QStringList &files)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
|
|
|
QStringList args;
|
2009-11-03 16:38:39 +01:00
|
|
|
args << QLatin1String("diff") << QLatin1String("-g") << QLatin1String("-p")
|
|
|
|
<< QLatin1String("-U 8");
|
2009-12-08 14:28:00 +01:00
|
|
|
if (!files.isEmpty())
|
|
|
|
args.append(files);
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-11-03 16:38:39 +01:00
|
|
|
const QString kind = QLatin1String(Constants::DIFFLOG);
|
2009-12-08 14:28:00 +01:00
|
|
|
const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir,files);
|
|
|
|
const QString title = tr("Hg diff %1").arg(id);
|
|
|
|
const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, files);
|
|
|
|
VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, source, true,
|
2009-09-15 13:03:13 +03:00
|
|
|
"diff", id);
|
2009-12-09 12:41:10 +01:00
|
|
|
editor->setDiffBaseDirectory(workingDir);
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
QSharedPointer<HgTask> job(new HgTask(workingDir, args, editor));
|
2009-11-06 12:32:38 +01:00
|
|
|
enqueueJob(job);
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
|
2010-01-07 17:29:58 +01:00
|
|
|
void MercurialClient::log(const QString &workingDir, const QStringList &files,
|
|
|
|
bool enableAnnotationContextMenu)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
2009-11-03 16:38:39 +01:00
|
|
|
QStringList args(QLatin1String("log"));
|
2009-12-08 14:28:00 +01:00
|
|
|
if (!files.empty())
|
|
|
|
args.append(files);
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-11-03 16:38:39 +01:00
|
|
|
const QString kind = QLatin1String(Constants::FILELOG);
|
2009-12-08 14:28:00 +01:00
|
|
|
const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir,files);
|
|
|
|
const QString title = tr("Hg log %1").arg(id);
|
|
|
|
const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, files);
|
2009-09-15 13:03:13 +03:00
|
|
|
|
|
|
|
VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, workingDir, true,
|
|
|
|
"log", id);
|
2010-01-07 17:29:58 +01:00
|
|
|
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
|
2009-09-15 13:03:13 +03:00
|
|
|
|
|
|
|
QSharedPointer<HgTask> job(new HgTask(workingDir, args, editor));
|
2009-11-06 12:32:38 +01:00
|
|
|
enqueueJob(job);
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
void MercurialClient::revertFile(const QString &workingDir,
|
|
|
|
const QString &file,
|
|
|
|
const QString &revision)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
2009-12-08 14:28:00 +01:00
|
|
|
const QStringList cookieList(workingDir + QLatin1Char('/') + file);
|
|
|
|
revert(workingDir, file, revision, QVariant(cookieList));
|
|
|
|
}
|
|
|
|
|
|
|
|
void MercurialClient::revertRepository(const QString &workingDir,
|
|
|
|
const QString &revision)
|
|
|
|
{
|
|
|
|
revert(workingDir, QLatin1String("--all"), revision, QVariant(workingDir));
|
|
|
|
}
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
void MercurialClient::revert(const QString &workingDir,
|
|
|
|
const QString &argument,
|
|
|
|
const QString &revision,
|
|
|
|
const QVariant &cookie)
|
|
|
|
{
|
2010-01-29 22:49:55 +01:00
|
|
|
QStringList args(QLatin1String("revert"));
|
2009-09-15 13:03:13 +03:00
|
|
|
if (!revision.isEmpty())
|
2009-11-03 16:38:39 +01:00
|
|
|
args << QLatin1String("-r") << revision;
|
2009-12-08 14:28:00 +01:00
|
|
|
args.append(argument);
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-12-04 12:58:01 +01:00
|
|
|
// Indicate repository change or file list
|
|
|
|
QSharedPointer<HgTask> job(new HgTask(workingDir, args, false, cookie));
|
|
|
|
connect(job.data(), SIGNAL(succeeded(QVariant)), this, SIGNAL(changed(QVariant)), Qt::QueuedConnection);
|
2009-11-06 12:32:38 +01:00
|
|
|
enqueueJob(job);
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
2010-01-12 16:45:21 +01:00
|
|
|
bool MercurialClient::createRepositorySync(const QString &workingDirectory)
|
|
|
|
{
|
|
|
|
const QStringList args(QLatin1String("init"));
|
|
|
|
QByteArray outputData;
|
2010-05-25 12:24:18 +02:00
|
|
|
if (!executeHgFullySynchronously(workingDirectory, args, &outputData))
|
2010-01-12 16:45:21 +01:00
|
|
|
return false;
|
|
|
|
QString output = QString::fromLocal8Bit(outputData);
|
|
|
|
output.remove(QLatin1Char('\r'));
|
|
|
|
VCSBase::VCSBaseOutputWindow::instance()->append(output);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
void MercurialClient::status(const QString &workingDir, const QString &file)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
2009-11-05 12:45:02 +01:00
|
|
|
QStringList args(QLatin1String("status"));
|
2009-12-08 14:28:00 +01:00
|
|
|
if (!file.isEmpty())
|
|
|
|
args.append(file);
|
2009-12-15 14:20:06 +01:00
|
|
|
VCSBase::VCSBaseOutputWindow *outwin = VCSBase::VCSBaseOutputWindow::instance();
|
|
|
|
outwin->setRepository(workingDir);
|
2009-12-08 14:28:00 +01:00
|
|
|
QSharedPointer<HgTask> job(new HgTask(workingDir, args, false));
|
2009-12-15 14:20:06 +01:00
|
|
|
connect(job.data(), SIGNAL(succeeded(QVariant)), outwin, SLOT(clearRepository()),
|
|
|
|
Qt::QueuedConnection);
|
2009-11-06 12:32:38 +01:00
|
|
|
enqueueJob(job);
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
void MercurialClient::statusWithSignal(const QString &repositoryRoot)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
2009-11-03 14:21:48 +01:00
|
|
|
const QStringList args(QLatin1String("status"));
|
2009-12-08 14:28:00 +01:00
|
|
|
QSharedPointer<HgTask> job(new HgTask(repositoryRoot, args, true));
|
2009-11-03 14:21:48 +01:00
|
|
|
connect(job.data(), SIGNAL(rawData(QByteArray)),
|
|
|
|
this, SLOT(statusParser(QByteArray)));
|
2009-11-06 12:32:38 +01:00
|
|
|
enqueueJob(job);
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void MercurialClient::statusParser(const QByteArray &data)
|
|
|
|
{
|
|
|
|
QList<QPair<QString, QString> > statusList;
|
|
|
|
|
|
|
|
QStringList rawStatusList = QTextCodec::codecForLocale()->toUnicode(data).split(QLatin1Char('\n'));
|
|
|
|
|
2009-11-03 16:38:39 +01:00
|
|
|
foreach (const QString &string, rawStatusList) {
|
2009-09-15 13:03:13 +03:00
|
|
|
QPair<QString, QString> status;
|
|
|
|
|
2009-11-03 16:38:39 +01:00
|
|
|
if (string.startsWith(QLatin1Char('M')))
|
|
|
|
status.first = QLatin1String("Modified");
|
|
|
|
else if (string.startsWith(QLatin1Char('A')))
|
|
|
|
status.first = QLatin1String("Added");
|
|
|
|
else if (string.startsWith(QLatin1Char('R')))
|
|
|
|
status.first = QLatin1String("Removed");
|
|
|
|
else if (string.startsWith(QLatin1Char('!')))
|
|
|
|
status.first = QLatin1String("Deleted");
|
|
|
|
else if (string.startsWith(QLatin1Char('?')))
|
|
|
|
status.first = QLatin1String("Untracked");
|
2009-09-15 13:03:13 +03:00
|
|
|
else
|
|
|
|
continue;
|
|
|
|
|
|
|
|
//the status string should be similar to "M file_with_Changes"
|
|
|
|
//so just should take the file name part and store it
|
|
|
|
status.second = string.mid(2);
|
|
|
|
statusList.append(status);
|
|
|
|
}
|
|
|
|
|
|
|
|
emit parsedStatus(statusList);
|
|
|
|
}
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
void MercurialClient::import(const QString &repositoryRoot, const QStringList &files)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
|
|
|
QStringList args;
|
2009-11-03 16:38:39 +01:00
|
|
|
args << QLatin1String("import") << QLatin1String("--no-commit");
|
|
|
|
args += files;
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
QSharedPointer<HgTask> job(new HgTask(repositoryRoot, args, false));
|
2009-11-06 12:32:38 +01:00
|
|
|
enqueueJob(job);
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
2010-05-25 12:24:18 +02:00
|
|
|
bool MercurialClient::pullSync(const QString &repositoryRoot, const QString &repository)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
2009-11-05 12:45:02 +01:00
|
|
|
QStringList args(QLatin1String("pull"));
|
2009-09-15 13:03:13 +03:00
|
|
|
if (!repository.isEmpty())
|
|
|
|
args.append(repository);
|
2010-05-25 12:24:18 +02:00
|
|
|
// Disable UNIX terminals to suppress SSH prompting.
|
|
|
|
const unsigned flags = VCSBase::VCSBasePlugin::SshPasswordPrompt|VCSBase::VCSBasePlugin::ShowStdOutInLogWindow
|
|
|
|
|VCSBase::VCSBasePlugin::ShowSuccessMessage;
|
|
|
|
const Utils::SynchronousProcessResponse resp =
|
|
|
|
executeHgSynchronously(repositoryRoot, args, flags);
|
|
|
|
const bool ok = resp.result == Utils::SynchronousProcessResponse::Finished;
|
|
|
|
if (ok)
|
|
|
|
emit changed(QVariant(repositoryRoot));
|
|
|
|
return ok;
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
2010-05-25 12:24:18 +02:00
|
|
|
bool MercurialClient::pushSync(const QString &repositoryRoot, const QString &repository)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
2009-11-05 12:45:02 +01:00
|
|
|
QStringList args(QLatin1String("push"));
|
2009-09-15 13:03:13 +03:00
|
|
|
if (!repository.isEmpty())
|
|
|
|
args.append(repository);
|
2010-05-25 12:24:18 +02:00
|
|
|
// Disable UNIX terminals to suppress SSH prompting.
|
|
|
|
const unsigned flags = VCSBase::VCSBasePlugin::SshPasswordPrompt|VCSBase::VCSBasePlugin::ShowStdOutInLogWindow
|
|
|
|
|VCSBase::VCSBasePlugin::ShowSuccessMessage;
|
|
|
|
const Utils::SynchronousProcessResponse resp =
|
|
|
|
executeHgSynchronously(repositoryRoot, args, flags);
|
|
|
|
return resp.result == Utils::SynchronousProcessResponse::Finished;
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
2010-09-29 12:16:35 +02:00
|
|
|
bool MercurialClient::clone(const QString &directory, const QString &url)
|
|
|
|
{
|
|
|
|
QDir workingDirectory(directory);
|
|
|
|
QByteArray output;
|
2010-09-29 12:16:37 +02:00
|
|
|
const unsigned flags = VCSBase::VCSBasePlugin::SshPasswordPrompt |
|
|
|
|
VCSBase::VCSBasePlugin::ShowStdOutInLogWindow |
|
|
|
|
VCSBase::VCSBasePlugin::ShowSuccessMessage;
|
2010-09-29 12:16:35 +02:00
|
|
|
|
|
|
|
if (workingDirectory.exists()) {
|
|
|
|
// Let's make first init
|
|
|
|
QStringList arguments(QLatin1String("init"));
|
|
|
|
if (!executeHgFullySynchronously(workingDirectory.path(), arguments, &output)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Then pull remote repository
|
|
|
|
arguments.clear();
|
|
|
|
arguments << QLatin1String("pull") << url;
|
|
|
|
const Utils::SynchronousProcessResponse resp1 =
|
|
|
|
executeHgSynchronously(workingDirectory.path(), arguments, flags);
|
|
|
|
if (resp1.result != Utils::SynchronousProcessResponse::Finished) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// By now, there is no hgrc file -> create it
|
|
|
|
QFile hgrc(workingDirectory.path()+"/.hg/hgrc");
|
|
|
|
hgrc.open(QIODevice::WriteOnly);
|
|
|
|
hgrc.write(QString("[paths]\ndefault = %1\n").arg(QString(url)).toUtf8());
|
|
|
|
hgrc.close();
|
|
|
|
|
|
|
|
// And last update repository
|
|
|
|
arguments.clear();
|
|
|
|
arguments << QLatin1String("update");
|
|
|
|
const Utils::SynchronousProcessResponse resp2 =
|
|
|
|
executeHgSynchronously(workingDirectory.path(), arguments, flags);
|
|
|
|
return resp2.result == Utils::SynchronousProcessResponse::Finished;
|
|
|
|
} else {
|
|
|
|
QStringList arguments(QLatin1String("clone"));
|
|
|
|
arguments << url << workingDirectory.dirName();
|
|
|
|
workingDirectory.cdUp();
|
|
|
|
const Utils::SynchronousProcessResponse resp =
|
|
|
|
executeHgSynchronously(workingDirectory.path(), arguments, flags);
|
|
|
|
return resp.result == Utils::SynchronousProcessResponse::Finished;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QString MercurialClient::vcsGetRepositoryURL(const QString &directory)
|
|
|
|
{
|
|
|
|
QByteArray output;
|
|
|
|
|
|
|
|
QStringList arguments(QLatin1String("showconfig"));
|
|
|
|
arguments << QLatin1String("paths.default");
|
|
|
|
|
|
|
|
if (executeHgFullySynchronously(directory, arguments, &output))
|
|
|
|
return QString::fromLocal8Bit(output);;
|
|
|
|
return QString();
|
|
|
|
}
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
void MercurialClient::incoming(const QString &repositoryRoot, const QString &repository)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
|
|
|
QStringList args;
|
2009-11-03 16:38:39 +01:00
|
|
|
args << QLatin1String("incoming") << QLatin1String("-g") << QLatin1String("-p");
|
2009-09-15 13:03:13 +03:00
|
|
|
if (!repository.isEmpty())
|
|
|
|
args.append(repository);
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
QString id = repositoryRoot;
|
|
|
|
if (!repository.isEmpty()) {
|
|
|
|
id += QDir::separator();
|
|
|
|
id += repository;
|
|
|
|
}
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-11-03 16:38:39 +01:00
|
|
|
const QString kind = QLatin1String(Constants::DIFFLOG);
|
2009-09-15 13:03:13 +03:00
|
|
|
const QString title = tr("Hg incoming %1").arg(id);
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, repositoryRoot,
|
2009-09-15 13:03:13 +03:00
|
|
|
true, "incoming", id);
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
QSharedPointer<HgTask> job(new HgTask(repositoryRoot, args, editor));
|
2010-05-21 17:46:00 +02:00
|
|
|
// Suppress SSH prompting.
|
|
|
|
if (!repository.isEmpty() && VCSBase::VCSBasePlugin::isSshPromptConfigured())
|
|
|
|
job->setUnixTerminalDisabled(true);
|
2009-11-06 12:32:38 +01:00
|
|
|
enqueueJob(job);
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
void MercurialClient::outgoing(const QString &repositoryRoot)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
|
|
|
QStringList args;
|
2009-11-03 16:38:39 +01:00
|
|
|
args << QLatin1String("outgoing") << QLatin1String("-g") << QLatin1String("-p");
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-11-03 16:38:39 +01:00
|
|
|
const QString kind = QLatin1String(Constants::DIFFLOG);
|
2010-07-05 09:52:32 +02:00
|
|
|
const QString title = tr("Hg outgoing %1").
|
|
|
|
arg(QDir::toNativeSeparators(repositoryRoot));
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, repositoryRoot, true,
|
|
|
|
"outgoing", repositoryRoot);
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
QSharedPointer<HgTask> job(new HgTask(repositoryRoot, args, editor));
|
2010-05-21 17:46:00 +02:00
|
|
|
// Suppress SSH prompting
|
|
|
|
job->setUnixTerminalDisabled(VCSBase::VCSBasePlugin::isSshPromptConfigured());
|
2009-11-06 12:32:38 +01:00
|
|
|
enqueueJob(job);
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void MercurialClient::view(const QString &source, const QString &id)
|
|
|
|
{
|
|
|
|
QStringList args;
|
2009-11-03 16:38:39 +01:00
|
|
|
args << QLatin1String("log") << QLatin1String("-p") << QLatin1String("-g")
|
|
|
|
<< QLatin1String("-r") << id;
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-11-03 16:38:39 +01:00
|
|
|
const QString kind = QLatin1String(Constants::DIFFLOG);
|
2009-09-15 13:03:13 +03:00
|
|
|
const QString title = tr("Hg log %1").arg(id);
|
|
|
|
|
|
|
|
VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, source,
|
|
|
|
true, "view", id);
|
|
|
|
|
|
|
|
QSharedPointer<HgTask> job(new HgTask(source, args, editor));
|
2009-11-06 12:32:38 +01:00
|
|
|
enqueueJob(job);
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
void MercurialClient::update(const QString &repositoryRoot, const QString &revision)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
2009-11-03 16:38:39 +01:00
|
|
|
QStringList args(QLatin1String("update"));
|
2009-09-15 13:03:13 +03:00
|
|
|
if (!revision.isEmpty())
|
|
|
|
args << revision;
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
QSharedPointer<HgTask> job(new HgTask(repositoryRoot, args, false, QVariant(repositoryRoot)));
|
2010-05-21 17:46:00 +02:00
|
|
|
// Suppress SSH prompting
|
|
|
|
job->setUnixTerminalDisabled(VCSBase::VCSBasePlugin::isSshPromptConfigured());
|
2009-12-04 12:58:01 +01:00
|
|
|
connect(job.data(), SIGNAL(succeeded(QVariant)), this, SIGNAL(changed(QVariant)), Qt::QueuedConnection);
|
2009-11-06 12:32:38 +01:00
|
|
|
enqueueJob(job);
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
void MercurialClient::commit(const QString &repositoryRoot, const QStringList &files,
|
2010-01-11 15:43:08 +01:00
|
|
|
const QString &committerInfo, const QString &commitMessageFile,
|
|
|
|
bool autoAddRemove)
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
2010-01-11 15:43:08 +01:00
|
|
|
// refuse to do "autoadd" on a commit with working directory only, as this will
|
|
|
|
// add all the untracked stuff.
|
|
|
|
QTC_ASSERT(!(autoAddRemove && files.isEmpty()), return)
|
2010-08-19 16:26:47 +02:00
|
|
|
QStringList args = QStringList(QLatin1String(nonInteractiveOptionC));
|
|
|
|
args.append(QLatin1String("commit"));
|
2009-11-05 12:45:02 +01:00
|
|
|
if (!committerInfo.isEmpty())
|
|
|
|
args << QLatin1String("-u") << committerInfo;
|
2010-01-11 15:43:08 +01:00
|
|
|
args << QLatin1String("-l") << commitMessageFile;
|
|
|
|
if (autoAddRemove)
|
|
|
|
args << QLatin1String("-A");
|
|
|
|
args << files;
|
2009-12-08 14:28:00 +01:00
|
|
|
QSharedPointer<HgTask> job(new HgTask(repositoryRoot, args, false));
|
2009-11-06 12:32:38 +01:00
|
|
|
enqueueJob(job);
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
QString MercurialClient::findTopLevelForFile(const QFileInfo &file)
|
|
|
|
{
|
2010-05-19 17:41:14 +02:00
|
|
|
const QString repositoryCheckFile = QLatin1String(Constants::MECURIALREPO) + QLatin1String("/requires");
|
|
|
|
return file.isDir() ?
|
|
|
|
VCSBase::VCSBasePlugin::findRepositoryForDirectory(file.absoluteFilePath(), repositoryCheckFile) :
|
|
|
|
VCSBase::VCSBasePlugin::findRepositoryForDirectory(file.absolutePath(), repositoryCheckFile);
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void MercurialClient::settingsChanged()
|
|
|
|
{
|
|
|
|
if (jobManager)
|
|
|
|
jobManager->restart();
|
|
|
|
}
|
|
|
|
|
|
|
|
VCSBase::VCSBaseEditor *MercurialClient::createVCSEditor(const QString &kind, QString title,
|
|
|
|
const QString &source, bool setSourceCodec,
|
|
|
|
const char *registerDynamicProperty,
|
|
|
|
const QString &dynamicPropertyValue) const
|
|
|
|
{
|
|
|
|
VCSBase::VCSBaseEditor *baseEditor = 0;
|
|
|
|
Core::IEditor* outputEditor = locateEditor(core, registerDynamicProperty, dynamicPropertyValue);
|
2009-11-03 16:38:39 +01:00
|
|
|
const QString progressMsg = tr("Working...");
|
2009-09-15 13:03:13 +03:00
|
|
|
if (outputEditor) {
|
|
|
|
// Exists already
|
2009-11-03 16:38:39 +01:00
|
|
|
outputEditor->createNew(progressMsg);
|
2009-09-15 13:03:13 +03:00
|
|
|
baseEditor = VCSBase::VCSBaseEditor::getVcsBaseEditor(outputEditor);
|
|
|
|
QTC_ASSERT(baseEditor, return 0);
|
|
|
|
} else {
|
2009-11-03 16:38:39 +01:00
|
|
|
outputEditor = core->editorManager()->openEditorWithContents(kind, &title, progressMsg);
|
2009-09-15 13:03:13 +03:00
|
|
|
outputEditor->file()->setProperty(registerDynamicProperty, dynamicPropertyValue);
|
|
|
|
baseEditor = VCSBase::VCSBaseEditor::getVcsBaseEditor(outputEditor);
|
2010-01-07 17:29:58 +01:00
|
|
|
connect(baseEditor, SIGNAL(annotateRevisionRequested(QString,QString,int)),
|
|
|
|
this, SLOT(slotAnnotateRevisionRequested(QString,QString,int)));
|
2009-09-15 13:03:13 +03:00
|
|
|
QTC_ASSERT(baseEditor, return 0);
|
|
|
|
baseEditor->setSource(source);
|
|
|
|
if (setSourceCodec)
|
|
|
|
baseEditor->setCodec(VCSBase::VCSBaseEditor::getCodec(source));
|
|
|
|
}
|
|
|
|
|
2010-09-14 15:15:57 +02:00
|
|
|
core->editorManager()->activateEditor(outputEditor, Core::EditorManager::ModeSwitch);
|
2010-06-07 14:53:28 +02:00
|
|
|
baseEditor->setForceReadOnly(true);
|
2009-09-15 13:03:13 +03:00
|
|
|
return baseEditor;
|
|
|
|
}
|
2009-11-06 12:32:38 +01:00
|
|
|
|
|
|
|
void MercurialClient::enqueueJob(const QSharedPointer<HgTask> &job)
|
|
|
|
{
|
|
|
|
if (!jobManager) {
|
|
|
|
jobManager = new MercurialJobRunner();
|
|
|
|
jobManager->start();
|
|
|
|
}
|
|
|
|
jobManager->enqueueJob(job);
|
|
|
|
}
|
2009-12-04 12:58:01 +01:00
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
} // namespace Mercurial
|