aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-09-17 16:14:33 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-09-17 16:14:33 +0200
commit450702a232bf07a82c6ac74fe28dc7bc9cffe67c (patch)
tree88c1549e9fa8510cc8d4af270b6e9ffc9686fec5
parenta38c7a609c85b54b31e4a50c3da4d39b7a338c1d (diff)
Add ignore_revision to version::string()
-rw-r--r--bpkg/manifest8
-rw-r--r--bpkg/manifest.cxx16
2 files changed, 17 insertions, 7 deletions
diff --git a/bpkg/manifest b/bpkg/manifest
index 0bbb0dc..35ff650 100644
--- a/bpkg/manifest
+++ b/bpkg/manifest
@@ -68,13 +68,7 @@ namespace bpkg
canonical_upstream () const noexcept {return canonical_upstream_;}
std::string
- string () const
- {
- const std::string& v (
- epoch_ != 0 ? std::to_string (epoch_) + "+" + upstream_ : upstream_);
-
- return revision_ != 0 ? v + "-" + std::to_string (revision_) : v;
- }
+ string (bool ignore_revision = false) const;
bool
operator< (const version& v) const noexcept {return compare (v) < 0;}
diff --git a/bpkg/manifest.cxx b/bpkg/manifest.cxx
index 40f362e..b66d5d4 100644
--- a/bpkg/manifest.cxx
+++ b/bpkg/manifest.cxx
@@ -326,6 +326,22 @@ namespace bpkg
canonical_upstream_.resize (cl);
}
+ string version::
+ string (bool ignore_revision) const
+ {
+ std::string v (epoch_ != 0
+ ? to_string (epoch_) + "+" + upstream_
+ : upstream_);
+
+ if (!ignore_revision && revision_ != 0)
+ {
+ v += '-';
+ v += to_string (revision_);
+ }
+
+ return v;
+ }
+
// package_manifest
//
package_manifest::