/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

  • Committer: Aaron Bentley
  • Date: 2009-09-29 04:40:55 UTC
  • mfrom: (4717 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4718.
  • Revision ID: aaron@aaronbentley.com-20090929044055-e9jtpmz6eyut711h
Merged bzr.dev into fix_get_mtime.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
    import bzrlib.lazy_regex
32
32
    bzrlib.lazy_regex.install_lazy_compile()
33
33
 
34
 
from bzrlib.osutils import get_user_encoding
35
 
 
36
34
 
37
35
IGNORE_FILENAME = ".bzrignore"
38
36
 
39
37
 
40
 
# XXX: Deprecated as of bzr-1.17 use osutils.get_user_encoding() directly
41
 
user_encoding = get_user_encoding()
42
 
 
43
 
 
44
38
__copyright__ = "Copyright 2005, 2006, 2007, 2008, 2009 Canonical Ltd."
45
39
 
46
40
# same format as sys.version_info: "A tuple containing the five components of
50
44
# Python version 2.0 is (2, 0, 0, 'final', 0)."  Additionally we use a
51
45
# releaselevel of 'dev' for unreleased under-development code.
52
46
 
53
 
version_info = (2, 0, 0, 'dev', 0)
 
47
version_info = (2, 1, 0, 'dev', 0)
54
48
 
55
49
# API compatibility version: bzrlib is currently API compatible with 1.15.
56
 
api_minimum_version = (1, 17, 0)
 
50
api_minimum_version = (2, 1, 0)
 
51
 
57
52
 
58
53
def _format_version_tuple(version_info):
59
54
    """Turn a version number 2, 3 or 5-tuple into a short string.
65
60
    zero for final releases.
66
61
 
67
62
    >>> print _format_version_tuple((1, 0, 0, 'final', 0))
68
 
    1.0
 
63
    1.0.0
69
64
    >>> print _format_version_tuple((1, 2, 0, 'dev', 0))
70
 
    1.2dev
 
65
    1.2.0dev
 
66
    >>> print bzrlib._format_version_tuple((1, 2, 0, 'dev', 1))
 
67
    1.2.0dev1
71
68
    >>> print _format_version_tuple((1, 1, 1, 'candidate', 2))
72
69
    1.1.1rc2
 
70
    >>> print bzrlib._format_version_tuple((2, 1, 0, 'beta', 1))
 
71
    2.1.0b1
73
72
    >>> print _format_version_tuple((1, 4, 0))
74
 
    1.4
 
73
    1.4.0
75
74
    >>> print _format_version_tuple((1, 4))
76
75
    1.4
 
76
    >>> print bzrlib._format_version_tuple((2, 1, 0, 'final', 1))
 
77
    Traceback (most recent call last):
 
78
    ...
 
79
    ValueError: version_info (2, 1, 0, 'final', 1) not valid
77
80
    >>> print _format_version_tuple((1, 4, 0, 'wibble', 0))
78
81
    Traceback (most recent call last):
79
82
    ...
80
83
    ValueError: version_info (1, 4, 0, 'wibble', 0) not valid
81
84
    """
82
 
    if len(version_info) == 2 or version_info[2] == 0:
 
85
    if len(version_info) == 2:
83
86
        main_version = '%d.%d' % version_info[:2]
84
87
    else:
85
88
        main_version = '%d.%d.%d' % version_info[:3]
94
97
        sub_string = ''
95
98
    elif release_type == 'dev' and sub == 0:
96
99
        sub_string = 'dev'
 
100
    elif release_type == 'dev':
 
101
        sub_string = 'dev' + str(sub)
97
102
    elif release_type in ('alpha', 'beta'):
98
103
        sub_string = release_type[0] + str(sub)
99
104
    elif release_type == 'candidate':
101
106
    else:
102
107
        raise ValueError("version_info %r not valid" % (version_info,))
103
108
 
104
 
    version_string = '%d.%d.%d.%s.%d' % tuple(version_info)
105
109
    return main_version + sub_string
106
110
 
107
111