aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-06-13 22:20:15 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-06-15 14:32:28 +0300
commit338d8065f1b681da841fa0d79cc9265776ff1e1e (patch)
tree3d38dc4353a4c161518921b8bd6ee98f24bdb2eb
parent481f9ba1aee62fea092184f2243d210a8686781f (diff)
Default standard version epoch to one
-rw-r--r--libbutl/standard-version.cxx5
-rw-r--r--libbutl/standard-version.mxx2
-rw-r--r--tests/standard-version/driver.cxx4
3 files changed, 7 insertions, 4 deletions
diff --git a/libbutl/standard-version.cxx b/libbutl/standard-version.cxx
index dbf6f30..e4180d1 100644
--- a/libbutl/standard-version.cxx
+++ b/libbutl/standard-version.cxx
@@ -226,7 +226,10 @@ namespace butl
(p == n || s[p] == '+'));
if (stub)
+ {
+ r.epoch = 0;
r.version = uint64_t (~0);
+ }
else
{
if (s[p] != '.')
@@ -499,7 +502,7 @@ namespace butl
{
std::string r;
- if (epoch != 0)
+ if (epoch != 1 && !stub ())
{
r += '+';
r += to_string (epoch);
diff --git a/libbutl/standard-version.mxx b/libbutl/standard-version.mxx
index 384b8f0..5f019c4 100644
--- a/libbutl/standard-version.mxx
+++ b/libbutl/standard-version.mxx
@@ -62,7 +62,7 @@ LIBBUTL_MODEXPORT namespace butl
//
static const std::uint64_t latest_sn = std::uint64_t (~0);
- std::uint16_t epoch = 0; // 0 if not specified.
+ std::uint16_t epoch = 1; // 0 if a stub, 1 if not specified.
std::uint64_t version = 0; // AAABBBCCCDDDE
std::uint64_t snapshot_sn = 0; // 0 if not specifed, latest_sn if 'z'.
std::string snapshot_id; // Empty if not specified.
diff --git a/tests/standard-version/driver.cxx b/tests/standard-version/driver.cxx
index bd20c40..3bc1d31 100644
--- a/tests/standard-version/driver.cxx
+++ b/tests/standard-version/driver.cxx
@@ -49,7 +49,7 @@ version (const string& s,
assert (r == v);
- if (r.epoch == 0 && r.revision == 0)
+ if (r.epoch == 1 && r.revision == 0)
{
standard_version v (r.version,
r.snapshot ()
@@ -80,7 +80,7 @@ version (const string& s,
{
auto max_ver = [&v] (char c) -> string
{
- string e (v.epoch != 0 ? '+' + to_string (v.epoch) + '-' : string ());
+ string e (v.epoch != 1 ? '+' + to_string (v.epoch) + '-' : string ());
return c == '~' || v.major () == 0
? e + to_string (v.major ()) + '.' + to_string (v.minor () + 1) + ".0-"