aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-06-20 20:39:15 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-06-21 15:45:48 +0300
commit5b549d176ba6eff19400c5edbd100eec825f6200 (patch)
tree2546b0a0482aeb996fc303e3e8bf94866dd73c79
parent6bad683716510e148852856417bd8558a7735195 (diff)
Make standard_version::string_project() to optionally include the revision
-rw-r--r--libbutl/standard-version.cxx16
-rw-r--r--libbutl/standard-version.mxx8
2 files changed, 14 insertions, 10 deletions
diff --git a/libbutl/standard-version.cxx b/libbutl/standard-version.cxx
index f4517ef..b01ebb9 100644
--- a/libbutl/standard-version.cxx
+++ b/libbutl/standard-version.cxx
@@ -496,13 +496,19 @@ namespace butl
}
string standard_version::
- string_project () const
+ string_project (bool rev) const
{
std::string r (string_version ());
if (snapshot ())
r += string_snapshot (); // string_version() includes trailing dot.
+ if (rev && revision != 0)
+ {
+ r += '+';
+ r += to_string (revision);
+ }
+
return r;
}
@@ -533,13 +539,7 @@ namespace butl
r += '-';
}
- r += string_project ();
-
- if (revision != 0)
- {
- r += '+';
- r += to_string (revision);
- }
+ r += string_project (true /* revision */);
return r;
}
diff --git a/libbutl/standard-version.mxx b/libbutl/standard-version.mxx
index 3c38242..83e9442 100644
--- a/libbutl/standard-version.mxx
+++ b/libbutl/standard-version.mxx
@@ -116,8 +116,12 @@ LIBBUTL_MODEXPORT namespace butl
//
// Note: return empty if the corresponding component is unspecified.
//
- std::string string () const; // Package version.
- std::string string_project () const; // Project version (no epoch/rev).
+ std::string string () const; // Package version.
+
+ // Project version (no epoch).
+ //
+ std::string string_project (bool revision = false) const;
+
std::string string_project_id () const; // Project version id (no snapsn).
std::string string_version () const; // Version only (no snapshot).
std::string string_pre_release () const; // Pre-release part only (a.1).