# # # patch "src/monotone/MonotoneUtil.cpp" # from [55cfbc5317d3301b2617d9035a01078069453668] # to [5facc35299eb887b32b3fb083d1016eee34e5d83] # # patch "src/monotone/MonotoneUtil.h" # from [bdf904b7474e98f2fc430d5c6f79ffdaf94ca044] # to [0053455adf0e5730fa991a59d705ff978ff60ec0] # ============================================================ --- src/monotone/MonotoneUtil.cpp 55cfbc5317d3301b2617d9035a01078069453668 +++ src/monotone/MonotoneUtil.cpp 5facc35299eb887b32b3fb083d1016eee34e5d83 @@ -22,6 +22,11 @@ #include "Guitone.h" #include "BasicIOParser.h" +// including this version +const QString MonotoneUtil::MinInterfaceVersion = "5.0"; +// excluding this version +const QString MonotoneUtil::MaxInterfaceVersion = "6.0"; + MonotoneUtil::MonotoneUtil(MonotoneThread * thread, const MonotoneTask & in) { connect( @@ -80,35 +85,6 @@ bool MonotoneUtil::runCommand(const QStr output.append(proc.readAll()); return true; } - -bool MonotoneUtil::checkProgramVersion(const QString & path) -{ - QString output; - QStringList opts; - opts << "--version"; - - if (!runCommand(path, opts, output)) - { - return false; - } - - QRegExp regex("^monotone (\\d+(?:\\.\\d+))"); - - if (regex.indexIn(output) == -1) - { - D(QString("couldn't parse output: %1").arg(output)); - return false; - } - - QString curVersion = regex.cap(1); - - D(QString("monotone version: %1, need: %2") - .arg(curVersion) - .arg(REQ_MTN_VERSION) - ); - - return versionCompare(curVersion, REQ_MTN_VERSION) >= 0; -} bool MonotoneUtil::checkInterfaceVersion(const QString & path) { @@ -131,12 +107,14 @@ bool MonotoneUtil::checkInterfaceVersion QString curVersion = regex.cap(1); - D(QString("interface version: %1, need: %2") + D(QString("interface version: %1, need one between ['%2' .. '%3'[") .arg(curVersion) - .arg(REQ_MTN_INT_VERSION) + .arg(MinInterfaceVersion) + .arg(MaxInterfaceVersion) ); - return versionCompare(curVersion, REQ_MTN_INT_VERSION) >= 0; + return versionCompare(curVersion, MinInterfaceVersion) >= 0 && + versionCompare(curVersion, MaxInterfaceVersion) < 0; } // strip mtn: warning: and alike from error strings coming from mtn @@ -166,7 +144,6 @@ QString MonotoneUtil::stripMtnPrefix(con // -1 if right is greater // 0 if both are equal // 1 if left is greater -// FIXME: this should be moved somewhere else int MonotoneUtil::versionCompare(const QString & left, const QString & right) { QStringList leftParts = left.split("."); ============================================================ --- src/monotone/MonotoneUtil.h bdf904b7474e98f2fc430d5c6f79ffdaf94ca044 +++ src/monotone/MonotoneUtil.h 0053455adf0e5730fa991a59d705ff978ff60ec0 @@ -37,6 +37,9 @@ public: static int versionCompare(const QString &, const QString &); static QString stripMtnPrefix(const QString &); + static const QString MinInterfaceVersion; + static const QString MaxInterfaceVersion; + // synchronous commands static MonotoneTask runSynchronousTask(const QString &, const MonotoneTask &); static QString getBaseWorkspaceRevision(const QString &);