#
#
# add_file "src/monotone/MonotoneResourceFile.cpp"
# content [d72192b5cef3c01834d24f40781bbca515525a4f]
#
# add_file "src/monotone/MonotoneResourceFile.h"
# content [d62db44e72b0fed18107a20dffdc4b3f422729f9]
#
# patch "guitone.pro"
# from [8819a394eeff1b31d1077696920bf2397365d130]
# to [591a4cd75b85654586140eb93827f37df739f375]
#
# patch "src/monotone/MonotoneProcess.cpp"
# from [3073ca21fabac70475a9b433aa5c56beb3184010]
# to [6e2dfba67bb29b2f0d93717720b5563d6b9c346f]
#
# patch "src/monotone/MonotoneProcess.h"
# from [547aa8e0fd0a45f3c0edae16784a84d2e13b06a0]
# to [51bdb9f10ae2e07c2e52150a041ad04e5cb31f00]
#
# patch "src/monotone/MonotoneThread.cpp"
# from [7f66c2e34aece73bbffa63813658990ff23747aa]
# to [54f25692d5b1c89a4bd4ed42783bb4066a2b2e25]
#
============================================================
--- src/monotone/MonotoneResourceFile.cpp d72192b5cef3c01834d24f40781bbca515525a4f
+++ src/monotone/MonotoneResourceFile.cpp d72192b5cef3c01834d24f40781bbca515525a4f
@@ -0,0 +1,77 @@
+/***************************************************************************
+ * Copyright (C) 2010 by Thomas Keller *
+ * address@hidden *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ ***************************************************************************/
+
+#include "MonotoneResourceFile.h"
+#include "Platform.h"
+#include "Settings.h"
+
+#include
+#include
+#include
+
+MonotoneResourceFile::MonotoneResourceFile() : QFile(0)
+{
+ QByteArray data;
+ data.append(QDateTime::currentDateTime().toString());
+ data.append(Platform::getUsername());
+ QByteArray hash = QCryptographicHash::hash(data, QCryptographicHash::Md5);
+
+ QString tempPath = QDir::tempPath();
+ tempPath.append(QDir::separator()).append(hash.toHex()).append(".lua");
+ setFileName(tempPath);
+
+ open(QIODevice::ReadWrite);
+ setPermissions(QFile::ReadOwner | QFile::WriteOwner);
+
+ write(
+ "-- this is an automatically created configuration file\n"
+ "-- for a running monotone instance of guitone\n\n"
+ );
+
+ QMap keyPasswords = Settings::getItemMap("KeyPasswords");
+ if (keyPasswords.size() > 0)
+ {
+ write("if type(get_passphrase) == 'function' then\n");
+ write(" old_get_passphrase = get_passphrase\n");
+ write("end\n\n");
+ write("function get_passphrase(key_identity)\n");
+ write(" if type(old_get_passphrase) == 'function' then\n");
+ write(" phrase = old_get_passphrase(key_identity)\n");
+ write(" if phrase ~= nil then\n");
+ write(" return phrase\n");
+ write(" end\n");
+ write(" end\n");
+
+ QMapIterator it(keyPasswords);
+ while (it.hasNext())
+ {
+ it.next();
+ write(" if key_identity.id == \"" + it.key().toUtf8() + "\" then\n");
+ write(" return \"" + it.value().toString().toUtf8() + "\"\n");
+ write(" end\n");
+ }
+ write("end\n");
+ }
+ close();
+}
+
+MonotoneResourceFile::~MonotoneResourceFile()
+{
+ remove();
+}
+
============================================================
--- src/monotone/MonotoneResourceFile.h d62db44e72b0fed18107a20dffdc4b3f422729f9
+++ src/monotone/MonotoneResourceFile.h d62db44e72b0fed18107a20dffdc4b3f422729f9
@@ -0,0 +1,32 @@
+/***************************************************************************
+ * Copyright (C) 2010 by Thomas Keller *
+ * address@hidden *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ ***************************************************************************/
+
+#ifndef MONOTONE_RESOURCE_FILE_H
+#define MONOTONE_RESOURCE_FILE_H
+
+#include
+
+class MonotoneResourceFile : public QFile
+{
+public:
+ MonotoneResourceFile();
+ ~MonotoneResourceFile();
+};
+
+#endif
+
============================================================
--- guitone.pro 8819a394eeff1b31d1077696920bf2397365d130
+++ guitone.pro 591a4cd75b85654586140eb93827f37df739f375
@@ -77,6 +77,7 @@ HEADERS = src/view/widgets/TreeView.h \
src/monotone/MonotoneManager.h \
src/monotone/MonotoneUtil.h \
src/monotone/MonotoneProcess.h \
+ src/monotone/MonotoneResourceFile.h \
src/model/AutomateCommand.h \
src/model/Inventory.h \
src/model/InventoryItem.h \
@@ -168,6 +169,7 @@ SOURCES += src/view/widgets/TreeView.cpp
src/monotone/MonotoneManager.cpp \
src/monotone/MonotoneUtil.cpp \
src/monotone/MonotoneProcess.cpp \
+ src/monotone/MonotoneResourceFile.cpp \
src/model/AutomateCommand.cpp \
src/model/Inventory.cpp \
src/model/InventoryItem.cpp \
============================================================
--- src/monotone/MonotoneProcess.cpp 3073ca21fabac70475a9b433aa5c56beb3184010
+++ src/monotone/MonotoneProcess.cpp 6e2dfba67bb29b2f0d93717720b5563d6b9c346f
@@ -85,6 +85,8 @@ void MonotoneProcess::start(const QStrin
args << "--norc";
}
+ args << "--rcfile" << rcFile.fileName();
+
L(QString("starting external monotone process %1 %2")
.arg(mtnBinaryPath).arg(args.join(" ")));
============================================================
--- src/monotone/MonotoneProcess.h 547aa8e0fd0a45f3c0edae16784a84d2e13b06a0
+++ src/monotone/MonotoneProcess.h 51bdb9f10ae2e07c2e52150a041ad04e5cb31f00
@@ -19,6 +19,8 @@
#ifndef MONOTONE_PROCESS_H
#define MONOTONE_PROCESS_H
+#include "MonotoneResourceFile.h"
+
#include
#include
@@ -49,6 +51,7 @@ private:
private:
QString mtnBinaryPath;
QString bufferedOutput;
+ MonotoneResourceFile rcFile;
};
#endif
============================================================
--- src/monotone/MonotoneThread.cpp 7f66c2e34aece73bbffa63813658990ff23747aa
+++ src/monotone/MonotoneThread.cpp 54f25692d5b1c89a4bd4ed42783bb4066a2b2e25
@@ -19,6 +19,7 @@
#include "MonotoneThread.h"
#include "StdioParser.h"
#include "BasicIOParser.h"
+#include "MonotoneResourceFile.h"
#include "Settings.h"
#include
@@ -254,6 +255,9 @@ void MonotoneThread::run()
args << "--norc";
}
+ MonotoneResourceFile rcFile;
+ args << "--rcfile" << rcFile.fileName();
+
// check whether we need to work on a specific workspace directory or not
if (!workspacePath.isEmpty())
{