Skip to content
Snippets Groups Projects
Commit abaf2e9f authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

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: default avatarMarco Bubke <marco.bubke@nokia.com>
Task-number: QTCREATORBUG-1503
parent 5b728081
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,8 @@ inline Core::IEditor* locateEditor(const Core::ICore *core, const char *property
return 0;
}
static const char nonInteractiveOptionC[] = "--noninteractive";
namespace Mercurial {
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
// add all the untracked stuff.
QTC_ASSERT(!(autoAddRemove && files.isEmpty()), return)
QStringList args(QLatin1String("commit"));
QStringList args = QStringList(QLatin1String(nonInteractiveOptionC));
args.append(QLatin1String("commit"));
if (!committerInfo.isEmpty())
args << QLatin1String("-u") << committerInfo;
args << QLatin1String("-l") << commitMessageFile;
......
......@@ -69,6 +69,11 @@ HgTask::HgTask(const QString &repositoryRoot,
{
}
VCSBase::VCSBaseEditor* HgTask::displayEditor() const
{
return editor;
}
void HgTask::emitSucceeded()
{
emit succeeded(m_cookie);
......@@ -221,7 +226,7 @@ void MercurialJobRunner::task(const QSharedPointer<HgTask> &job)
*/
if (stdOutput.isEmpty())
stdOutput = stdErr;
emit output(stdOutput);
emit output(stdOutput); // This will clear the diff "Working..." text.
taskData->emitSucceeded();
} else {
emit error(QString::fromLocal8Bit(stdErr));
......
......@@ -38,6 +38,7 @@
#include <QtCore/QSharedPointer>
#include <QtCore/QVariant>
#include <QtCore/QString>
#include <QtCore/QPointer>
QT_BEGIN_NAMESPACE
class QProcess;
......@@ -64,10 +65,10 @@ public:
VCSBase::VCSBaseEditor *editor,
const QVariant &cookie = QVariant());
bool shouldEmit() { return emitRaw; }
VCSBase::VCSBaseEditor* displayEditor() { return editor; }
QStringList args() { return arguments; }
QString repositoryRoot() { return m_repositoryRoot; }
bool shouldEmit() const { return emitRaw; }
VCSBase::VCSBaseEditor* displayEditor() const;
QStringList args() const { return arguments; }
QString repositoryRoot() const { return m_repositoryRoot; }
signals:
void succeeded(const QVariant &cookie); // Use a queued connection
......@@ -81,7 +82,7 @@ private:
const QStringList arguments;
const bool emitRaw;
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
......
......@@ -581,7 +581,12 @@ void MercurialPlugin::showCommitWidget(const QList<QPair<QString, QString> > &st
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()) {
outputWindow->appendError(tr("Unable to generate a temporary file for the commit editor."));
return;
......@@ -673,7 +678,6 @@ void MercurialPlugin::deleteCommitLog()
if (changeLog) {
delete changeLog;
changeLog = 0;
m_submitRepository.clear();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment