Rev 4665: Fix the tests. in http://bazaar.launchpad.net/~jameinel/bzr/2.0-full-version

John Arbash Meinel john at arbash-meinel.com
Fri Sep 11 19:19:05 BST 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.0-full-version

------------------------------------------------------------
revno: 4665
revision-id: john at arbash-meinel.com-20090911181847-ii1ktvh0m3e8ptb1
parent: john at arbash-meinel.com-20090910154631-m89rnpctaohkzfhg
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.0-full-version
timestamp: Fri 2009-09-11 13:18:47 -0500
message:
  Fix the tests.
  
  While I'm here, handle the fact that bzr-gtk used formats of the form:
    version_info = (0, 97, 0, 'dev', 1)
  Which would break formatting because we didn't allow >0 with 'dev'
  or 'final'. We still don't allow final. but now we print
   0.97.0.dev.1 rather than failing
-------------- next part --------------
=== modified file 'bzrlib/__init__.py'
--- a/bzrlib/__init__.py	2009-09-10 15:46:31 +0000
+++ b/bzrlib/__init__.py	2009-09-11 18:18:47 +0000
@@ -65,17 +65,23 @@
     zero for final releases.
 
     >>> print _format_version_tuple((1, 0, 0, 'final', 0))
-    1.0
+    1.0.0
     >>> print _format_version_tuple((1, 2, 0, 'dev', 0))
-    1.2dev
+    1.2.0dev
+    >>> print bzrlib._format_version_tuple((1, 2, 0, 'dev', 1))
+    1.2.0dev1
     >>> print _format_version_tuple((1, 1, 1, 'candidate', 2))
     1.1.1rc2
     >>> print bzrlib._format_version_tuple((2, 1, 0, 'beta', 1))
-    2.1b1
+    2.1.0b1
     >>> print _format_version_tuple((1, 4, 0))
-    1.4
+    1.4.0
     >>> print _format_version_tuple((1, 4))
     1.4
+    >>> print bzrlib._format_version_tuple((2, 1, 0, 'final', 1))
+    Traceback (most recent call last):
+    ...
+    ValueError: version_info (2, 1, 0, 'final', 1) not valid
     >>> print _format_version_tuple((1, 4, 0, 'wibble', 0))
     Traceback (most recent call last):
     ...
@@ -96,6 +102,8 @@
         sub_string = ''
     elif release_type == 'dev' and sub == 0:
         sub_string = 'dev'
+    elif release_type == 'dev':
+        sub_string = 'dev' + str(sub)
     elif release_type in ('alpha', 'beta'):
         sub_string = release_type[0] + str(sub)
     elif release_type == 'candidate':
@@ -103,7 +111,6 @@
     else:
         raise ValueError("version_info %r not valid" % (version_info,))
 
-    version_string = '%d.%d.%d.%s.%d' % tuple(version_info)
     return main_version + sub_string
 
 



More information about the bazaar-commits mailing list