summaryrefslogtreecommitdiffstats
path: root/src/bmclient/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bmclient/main.cpp')
-rw-r--r--src/bmclient/main.cpp100
1 files changed, 99 insertions, 1 deletions
diff --git a/src/bmclient/main.cpp b/src/bmclient/main.cpp
index 391a7b7..745f799 100644
--- a/src/bmclient/main.cpp
+++ b/src/bmclient/main.cpp
@@ -115,6 +115,7 @@ private:
const QString &command = "index get values") const;
BMRequest * createIndexPutConfigRequest(const QStringList &args, QString *error) const;
BMRequest * createGetHistoriesRequest(const QStringList &args, QString *error) const;
+ BMRequest * createGetIXHistoriesRequest(const QStringList &args, QString *error) const;
mutable BMRequest::OutputFormat explicitOutputFormat;
mutable bool useExplicitOutputFormat;
BMRequest::OutputFormat outputFormat() const;
@@ -762,6 +763,31 @@ BMRequest * Executor::createRequest(const QStringList &args, QString *error) con
return new BMRequest_GetBMTree();
+ } else if (
+ (args.size() >= 3) && (args.at(0) == "get") && (args.at(1) == "ixhistories")
+ && (args.at(2) != "plot") && (args.at(2) != "detailspage")) {
+ // --- 'get ixhistories' command ---
+
+ return createGetIXHistoriesRequest(args, error);
+
+ } else if (
+ (args.size() >= 3) && (args.at(0) == "get") && (args.at(1) == "ixhistories")
+ && (args.at(2) == "plot")) {
+ // --- 'get ixhistories plot' command ---
+
+ BMRequest *request = createGetIXHistoriesRequest(args, error);
+ setOutputFormat(BMRequest::Image);
+ return request;
+
+ } else if (
+ (args.size() >= 3) && (args.at(0) == "get") && (args.at(1) == "ixhistories")
+ && (args.at(2) == "detailspage")) {
+ // --- 'get ixhistories detailspage' command ---
+
+ BMRequest *request = createGetIXHistoriesRequest(args, error);
+ setOutputFormat(BMRequest::HTML);
+ return request;
+
} else if ((args.size() >= 2) && (args.at(0) == "get") && (args.at(1) == "detailspage")) {
// --- 'get detailspage' command ---
@@ -1227,6 +1253,65 @@ BMRequest * Executor::createGetHistoriesRequest(const QStringList &args, QString
return new BMRequest_GetHistories(testCase, testFunction, dataTag, cacheKey);
}
+BMRequest * Executor::createGetIXHistoriesRequest(const QStringList &args, QString *error) const
+{
+ QStringList values;
+ bool ok;
+
+ // Get evaluation timestamp ...
+ if (!BMMisc::getOption(args, "-evaltimestamp", &values, 1, 0, error)) {
+ if (error->isEmpty())
+ *error = "-evaltimestamp option not found";
+ return 0;
+ }
+ const int evalTimestamp = values.first().toInt(&ok);
+ if ((!ok) || (evalTimestamp < 0)) {
+ *error = "failed to extract eval timestamp as a non-negative integer";
+ return 0;
+ }
+
+ // Get ranked infos ...
+ QList<QStringList> rankedStrings;
+ if (!BMMisc::getMultiOption2(args, "-rankedinfo", &rankedStrings, 5, error))
+ return 0;
+ if (rankedStrings.isEmpty()) {
+ *error = "no ranked infos specified";
+ return 0;
+ }
+ QList<Index::RankedInfo> rankedInfos;
+ for (int i = 0; i < rankedStrings.size(); ++i) {
+ QStringList strings = rankedStrings.at(i);
+ Q_ASSERT(strings.size() == 5);
+ const int bmcontextId = strings.at(0).toInt(&ok);
+ Q_ASSERT(ok);
+ const int basePos = strings.at(1).toInt(&ok);
+ Q_ASSERT(ok);
+ const int diffPos1 = strings.at(2).toInt(&ok);
+ Q_ASSERT(ok);
+ const int diffPos2 = strings.at(3).toInt(&ok);
+ Q_ASSERT(ok);
+ const QString descr = strings.at(4);
+
+ rankedInfos.append(Index::RankedInfo(bmcontextId, basePos, diffPos1, diffPos2, descr));
+ }
+
+ // Get cache key ...
+ QString cacheKey;
+ if (BMMisc::getOption(args, "-cachekey", &values, 1, 0, error)) {
+ cacheKey = values.at(0).trimmed();
+ bool ok;
+ cacheKey.toInt(&ok);
+ if (!ok) {
+ *error = "failed to extract cache key as an integer";
+ return 0;
+ }
+ } else if (!error->isEmpty()) {
+ return 0;
+ }
+
+ return new BMRequest_GetIXHistories(evalTimestamp, rankedInfos, cacheKey);
+}
+
// ### 2 B DOCUMENTED!
static void splitQuotedArgs(const QString &arg_s, QStringList *args)
{
@@ -1629,11 +1714,24 @@ class DirectExecutor : public Executor
<<
"get histories detailspage <SAME AS 'get histories'> except that the mandatory \\\n"
- " -stylesheet option is recognized\n"
+ " -stylesheet option is recognized\n"
<<
"get bmtree\n"
+ <<
+ "get ixhistories -evaltimestamp <...> \\\n"
+ " -rankedinfo <BM context ID> <base pos> <diff pos 1> <diff pos 2> \\\n"
+ " <descr> ...\n"
+
+ <<
+ "get ixhistories plot <SAME AS 'get ixhistories' except that the optional \\\n"
+ " -httpHeader and -cachekey options are recognized>\n"
+
+ <<
+ "get ixhistories detailspage <SAME AS 'get ixhistories'> except that the mandatory \\\n"
+ " -stylesheet option is recognized\n"
+
;
qDebug() << "\nNote: the -server option may be replaced by a BMSERVER=<host>:<port> "