Repository: mesos
Updated Branches:
  refs/heads/master 26baf5531 -> 717a56bce


Discard label/tag when parsing Version string.

Review: https://reviews.apache.org/r/27115


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/717a56bc
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/717a56bc
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/717a56bc

Branch: refs/heads/master
Commit: 717a56bce762e28c13eb8cc68dc54c2e1da5003b
Parents: 26baf55
Author: Kapil Arya <[email protected]>
Authored: Thu Oct 23 17:29:15 2014 -0700
Committer: Benjamin Mahler <[email protected]>
Committed: Thu Oct 23 17:29:15 2014 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/stout/include/stout/version.hpp | 7 ++++++-
 3rdparty/libprocess/3rdparty/stout/tests/version_tests.cpp   | 6 ++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/717a56bc/3rdparty/libprocess/3rdparty/stout/include/stout/version.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/version.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/version.hpp
index 53b14e2..090fcf0 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/version.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/version.hpp
@@ -37,7 +37,12 @@ public:
   {
     const size_t maxComponents = 3;
 
-    std::vector<std::string> split = strings::split(s, ".");
+    // Use only the part before '-', i.e. strip and discard the tags
+    // and labels.
+    // TODO(karya): Once we have support for labels and tags, we
+    // should not discard the remaining string.
+    std::vector<std::string> split =
+      strings::split(strings::split(s, "-")[0], ".");
 
     if (split.size() > maxComponents) {
       return Error("Version string has " + stringify(split.size()) +

http://git-wip-us.apache.org/repos/asf/mesos/blob/717a56bc/3rdparty/libprocess/3rdparty/stout/tests/version_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/version_tests.cpp 
b/3rdparty/libprocess/3rdparty/stout/tests/version_tests.cpp
index 9f53431..e8f8358 100644
--- a/3rdparty/libprocess/3rdparty/stout/tests/version_tests.cpp
+++ b/3rdparty/libprocess/3rdparty/stout/tests/version_tests.cpp
@@ -51,6 +51,12 @@ TEST(VersionTest, Parse)
   EXPECT_EQ(stringify(version2.get()), "1.20.0");
   EXPECT_EQ(stringify(version3.get()), "1.0.0");
 
+  // Verify that tagged/labeled versions work.
+  Try<Version> version4 = Version::parse("1.20.3-rc1");
+  EXPECT_SOME(version4);
+  EXPECT_EQ(version4.get(), version1.get());
+  EXPECT_EQ(stringify(version4.get()), "1.20.3");
+
   EXPECT_ERROR(Version::parse("0.a.b"));
   EXPECT_ERROR(Version::parse(""));
   EXPECT_ERROR(Version::parse("a"));

Reply via email to