[asterisk-commits] kpfleming: testsuite/asterisk/trunk r3145 - /asterisk/trunk/lib/python/asterisk/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 23 17:20:38 CDT 2012


Author: kpfleming
Date: Fri Mar 23 17:20:34 2012
New Revision: 3145

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3145
Log:
Fix minor version matching for Subversion checkouts.

When the four-component version number handling was added, the logic to make
Subversion checkouts be considered a 'higher' version than all numbered
versions was broken. This patch corrects that behavior, and adds two unit tests
to ensure it won't get broken again.


Modified:
    asterisk/trunk/lib/python/asterisk/version.py

Modified: asterisk/trunk/lib/python/asterisk/version.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/version.py?view=diff&rev=3145&r1=3144&r2=3145
==============================================================================
--- asterisk/trunk/lib/python/asterisk/version.py (original)
+++ asterisk/trunk/lib/python/asterisk/version.py Fri Mar 23 17:20:34 2012
@@ -49,12 +49,12 @@
     def __int__(self):
         if self.svn is True:
             if self.branch == "trunk":
-                return 9999999999
+                res = 9999999999
             elif self.branch[:6] == "branch":
-                return int(AsteriskVersion(self.branch[7:])) + 99
+                res = int(AsteriskVersion(self.branch[7:])) + 99999
             else:
                 # team branch XXX (may not be off of trunk)
-                return 9999999999
+                res = 9999999999
         else:
             res = int(self.concept) * 100000000
             if self.major is not None:
@@ -66,7 +66,7 @@
                             res += self.patch
                         else:
                             res += int(self.__parse_version_patch(self.patch))
-            return res
+        return res
 
     def __cmp__(self, other):
         res = cmp(int(self), int(other))
@@ -345,6 +345,16 @@
         v2 = AsteriskVersion("1.8.5.1")
         self.assertTrue(v1 < v2)
 
+    def test_cmp21(self):
+        v1 = AsteriskVersion("1.8.9")
+        v2 = AsteriskVersion("SVN-branch-1.8-r360138")
+        self.assertTrue(v1 < v2)
+
+    def test_cmp22(self):
+        v1 = AsteriskVersion("1.8.9")
+        v2 = AsteriskVersion("SVN-branch-1.8-r360138M")
+        self.assertTrue(v1 < v2)
+
 def main():
     unittest.main()
 




More information about the asterisk-commits mailing list