From 670a3115c1dd5a285d273d39bd38f466f06dde7c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 25 Jan 2019 11:54:14 +0200 Subject: Add --open-base option to bdep-release --- bdep/release.cxx | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'bdep/release.cxx') diff --git a/bdep/release.cxx b/bdep/release.cxx index 232df64..cf9438d 100644 --- a/bdep/release.cxx +++ b/bdep/release.cxx @@ -189,6 +189,31 @@ namespace bdep fail << "current version " << cv << " is a snapshot"; } + else if (o.open_base_specified ()) + { + const string& vs (o.open_base ()); + + try + { + standard_version v (vs); + + if (!v.release ()) + throw invalid_argument ("pre-release"); + + if (v.revision != 0) + throw invalid_argument ("contains revision"); + + if (v <= cv) + fail << "base version " << vs << " is less than or equal to " + << "current version " << cv; + + ov = make_snapshot (v.major (), v.minor (), v.patch ()); + } + catch (const invalid_argument& e) + { + fail << "invalid base version '" << vs << "': " << e; + } + } else if (cv.alpha ()) { if (const char* n = (o.open_patch () ? "--open-patch" : @@ -482,7 +507,8 @@ namespace bdep verify ("--open-patch", o.open_patch ()); verify ("--open-minor", o.open_minor ()); verify ("--open-major", o.open_major ()); - verify ("--no-open", o.no_open ()); // Releasing only (see above). + verify ("--open-base", o.open_base_specified ()); + verify ("--no-open", o.no_open ()); // Releasing only (see above). // There is no sense to push without committing the version change first. // Meaningful for all modes. @@ -601,10 +627,10 @@ namespace bdep v = standard_version (vv.value, f); } - catch (const invalid_argument&) + catch (const invalid_argument& e) { - fail << "current package " << n << " version " << vv.value - << " is not standard"; + fail << "current package " << n << " version '" << vv.value + << "' is not standard: " << e; } prj.packages.push_back ( -- cgit v1.1