Snapshots: Disable activation of incompatible snapshots

This commit is contained in:
Vojtech Kral 2018-04-25 13:44:06 +02:00
parent df3e84d580
commit bbc3c890ea
5 changed files with 38 additions and 30 deletions

View file

@ -4,6 +4,7 @@
#include <string>
#include <cstring>
#include <ostream>
#include <stdexcept>
#include <boost/optional.hpp>
#include <boost/format.hpp>
@ -33,6 +34,16 @@ public:
set_prerelease(prerelease);
}
Semver(const std::string &str) : ver(semver_zero())
{
auto parsed = parse(str);
if (! parsed) {
throw std::runtime_error(std::string("Could not parse version string: ") + str);
}
ver = parsed->ver;
parsed->ver = semver_zero();
}
static boost::optional<Semver> parse(const std::string &str)
{
semver_t ver = semver_zero();