forked from qt-creator/qt-creator
VCS[hg]: Mercurial forgets working directory from commit #2 on.
Do not clear variable containing submit repository. Fix potential crash (closing diff editor before command termination), use proper temp file name. Pass --non-interactive to "commit" to suppress editors being launched (despite -l). Reviewed-by: Marco Bubke <marco.bubke@nokia.com> Task-number: QTCREATORBUG-1503
This commit is contained in:
@@ -61,6 +61,8 @@ inline Core::IEditor* locateEditor(const Core::ICore *core, const char *property
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char nonInteractiveOptionC[] = "--noninteractive";
|
||||||
|
|
||||||
namespace Mercurial {
|
namespace Mercurial {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -533,7 +535,8 @@ void MercurialClient::commit(const QString &repositoryRoot, const QStringList &f
|
|||||||
// refuse to do "autoadd" on a commit with working directory only, as this will
|
// refuse to do "autoadd" on a commit with working directory only, as this will
|
||||||
// add all the untracked stuff.
|
// add all the untracked stuff.
|
||||||
QTC_ASSERT(!(autoAddRemove && files.isEmpty()), return)
|
QTC_ASSERT(!(autoAddRemove && files.isEmpty()), return)
|
||||||
QStringList args(QLatin1String("commit"));
|
QStringList args = QStringList(QLatin1String(nonInteractiveOptionC));
|
||||||
|
args.append(QLatin1String("commit"));
|
||||||
if (!committerInfo.isEmpty())
|
if (!committerInfo.isEmpty())
|
||||||
args << QLatin1String("-u") << committerInfo;
|
args << QLatin1String("-u") << committerInfo;
|
||||||
args << QLatin1String("-l") << commitMessageFile;
|
args << QLatin1String("-l") << commitMessageFile;
|
||||||
|
@@ -69,6 +69,11 @@ HgTask::HgTask(const QString &repositoryRoot,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VCSBase::VCSBaseEditor* HgTask::displayEditor() const
|
||||||
|
{
|
||||||
|
return editor;
|
||||||
|
}
|
||||||
|
|
||||||
void HgTask::emitSucceeded()
|
void HgTask::emitSucceeded()
|
||||||
{
|
{
|
||||||
emit succeeded(m_cookie);
|
emit succeeded(m_cookie);
|
||||||
@@ -221,7 +226,7 @@ void MercurialJobRunner::task(const QSharedPointer<HgTask> &job)
|
|||||||
*/
|
*/
|
||||||
if (stdOutput.isEmpty())
|
if (stdOutput.isEmpty())
|
||||||
stdOutput = stdErr;
|
stdOutput = stdErr;
|
||||||
emit output(stdOutput);
|
emit output(stdOutput); // This will clear the diff "Working..." text.
|
||||||
taskData->emitSucceeded();
|
taskData->emitSucceeded();
|
||||||
} else {
|
} else {
|
||||||
emit error(QString::fromLocal8Bit(stdErr));
|
emit error(QString::fromLocal8Bit(stdErr));
|
||||||
|
@@ -38,6 +38,7 @@
|
|||||||
#include <QtCore/QSharedPointer>
|
#include <QtCore/QSharedPointer>
|
||||||
#include <QtCore/QVariant>
|
#include <QtCore/QVariant>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
|
#include <QtCore/QPointer>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QProcess;
|
class QProcess;
|
||||||
@@ -64,10 +65,10 @@ public:
|
|||||||
VCSBase::VCSBaseEditor *editor,
|
VCSBase::VCSBaseEditor *editor,
|
||||||
const QVariant &cookie = QVariant());
|
const QVariant &cookie = QVariant());
|
||||||
|
|
||||||
bool shouldEmit() { return emitRaw; }
|
bool shouldEmit() const { return emitRaw; }
|
||||||
VCSBase::VCSBaseEditor* displayEditor() { return editor; }
|
VCSBase::VCSBaseEditor* displayEditor() const;
|
||||||
QStringList args() { return arguments; }
|
QStringList args() const { return arguments; }
|
||||||
QString repositoryRoot() { return m_repositoryRoot; }
|
QString repositoryRoot() const { return m_repositoryRoot; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void succeeded(const QVariant &cookie); // Use a queued connection
|
void succeeded(const QVariant &cookie); // Use a queued connection
|
||||||
@@ -81,7 +82,7 @@ private:
|
|||||||
const QStringList arguments;
|
const QStringList arguments;
|
||||||
const bool emitRaw;
|
const bool emitRaw;
|
||||||
const QVariant m_cookie;
|
const QVariant m_cookie;
|
||||||
VCSBase::VCSBaseEditor *editor;
|
QPointer<VCSBase::VCSBaseEditor> editor; // User might close it.
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A job queue running in a separate thread, executing commands
|
/* A job queue running in a separate thread, executing commands
|
||||||
|
@@ -581,7 +581,12 @@ void MercurialPlugin::showCommitWidget(const QList<QPair<QString, QString> > &st
|
|||||||
|
|
||||||
deleteCommitLog();
|
deleteCommitLog();
|
||||||
|
|
||||||
changeLog = new QTemporaryFile(this);
|
// Open commit log
|
||||||
|
QString changeLogPattern = QDir::tempPath();
|
||||||
|
if (!changeLogPattern.endsWith(QLatin1Char('/')))
|
||||||
|
changeLogPattern += QLatin1Char('/');
|
||||||
|
changeLogPattern += QLatin1String("qtcreator-hg-XXXXXX.msg");
|
||||||
|
changeLog = new QTemporaryFile(changeLogPattern, this);
|
||||||
if (!changeLog->open()) {
|
if (!changeLog->open()) {
|
||||||
outputWindow->appendError(tr("Unable to generate a temporary file for the commit editor."));
|
outputWindow->appendError(tr("Unable to generate a temporary file for the commit editor."));
|
||||||
return;
|
return;
|
||||||
@@ -673,7 +678,6 @@ void MercurialPlugin::deleteCommitLog()
|
|||||||
if (changeLog) {
|
if (changeLog) {
|
||||||
delete changeLog;
|
delete changeLog;
|
||||||
changeLog = 0;
|
changeLog = 0;
|
||||||
m_submitRepository.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user