~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-05-19 06:14:38 UTC
  • mfrom: (1704.2.23 bzr.mbp.integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060519061438-6300caf3926c3cff
(mbp) small fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""bzr library"""
18
18
 
19
 
from bzrlib.osutils import get_user_encoding
20
19
 
 
20
# please keep these sorted (in C locale order) to aid merging
 
21
DEFAULT_IGNORE = [
 
22
                  '#*#',
 
23
                  '*$',
 
24
                  '*,v',
 
25
                  '*.BAK',
 
26
                  '*.a',
 
27
                  '*.bak',
 
28
                  '*.elc',
 
29
                  '*.exe',
 
30
                  '*.la',
 
31
                  '*.lo',
 
32
                  '*.o',
 
33
                  '*.o',
 
34
                  '*.obj',
 
35
                  '*.orig',
 
36
                  '*.py[oc]',
 
37
                  '*.so',
 
38
                  '*.tmp',
 
39
                  '.*.tmp',
 
40
                  '*~',
 
41
                  '.#*',
 
42
                  '.*.sw[nop]',
 
43
                  '.sw[nop]',    # vim editing nameless file
 
44
                  '.DS_Store',
 
45
                  '.arch-ids',
 
46
                  '.arch-inventory',
 
47
                  '.bzr.log',
 
48
                  '.del-*',
 
49
                  '.hg',
 
50
                  '.git',
 
51
                  '.jamdeps'
 
52
                  '.libs',
 
53
                  '.make.state',
 
54
                  '.sconsign*',
 
55
                  '.svn',
 
56
                  '.tmp*',
 
57
                  'BitKeeper',
 
58
                  'CVS',
 
59
                  'CVS.adm',
 
60
                  'RCS',
 
61
                  'SCCS',
 
62
                  'TAGS',
 
63
                  '_darcs',
 
64
                  'aclocal.m4',
 
65
                  'autom4te*',
 
66
                  'config.h',
 
67
                  'config.h.in',
 
68
                  'config.log',
 
69
                  'config.status',
 
70
                  'config.sub',
 
71
                  'stamp-h',
 
72
                  'stamp-h.in',
 
73
                  'stamp-h1',
 
74
                  '{arch}',
 
75
                  ]
21
76
 
22
77
IGNORE_FILENAME = ".bzrignore"
23
78
 
24
 
 
25
 
# XXX: Compatibility. This should probably be deprecated
26
 
user_encoding = get_user_encoding()
27
 
 
 
79
import os
 
80
import sys
 
81
if sys.platform == 'darwin':
 
82
    # work around egregious python 2.4 bug
 
83
    sys.platform = 'posix'
 
84
    import locale
 
85
    sys.platform = 'darwin'
 
86
else:
 
87
    import locale
 
88
user_encoding = locale.getpreferredencoding() or 'ascii'
 
89
del locale
28
90
 
29
91
__copyright__ = "Copyright 2005, 2006 Canonical Development Ltd."
 
92
__version__ = version_string = '0.9'
30
93
 
31
94
# same format as sys.version_info: "A tuple containing the five components of
32
95
# the version number: major, minor, micro, releaselevel, and serial. All
35
98
# Python version 2.0 is (2, 0, 0, 'final', 0)."  Additionally we use a
36
99
# releaselevel of 'dev' for unreleased under-development code.
37
100
 
38
 
version_info = (0, 11, 0, 'dev', 0)
 
101
version_info = (0, 9, 0, 'dev', 0)
39
102
 
40
103
if version_info[3] == 'final':
41
104
    version_string = '%d.%d.%d' % version_info[:3]
42
105
else:
43
106
    version_string = '%d.%d.%d%s%d' % version_info
44
 
__version__ = version_string
45
 
 
46
 
from bzrlib.symbol_versioning import (deprecated_function,
47
 
                                      zero_seven,
48
 
                                      zero_nine,
49
 
                                      deprecated_list,
50
 
                                     )
51
 
 
52
 
# Kept for compatibility with 0.8, it is considered deprecated to modify it
53
 
DEFAULT_IGNORE = deprecated_list(zero_nine, 'DEFAULT_IGNORE', [],
54
 
                    'Consider using bzrlib.ignores.add_unique_user_ignores'
55
 
                    ' or bzrlib.ignores.add_runtime_ignores')
56
 
 
 
107
__version__ = version_string 
 
108
 
 
109
from bzrlib.symbol_versioning import deprecated_function, zero_seven
 
110
 
 
111
@deprecated_function(zero_seven)
 
112
def get_bzr_revision():
 
113
    """If bzr is run from a branch, return (revno,revid) or None."""
 
114
    import bzrlib.errors
 
115
    from bzrlib.branch import Branch
 
116
    
 
117
    try:
 
118
        branch = Branch.open(os.path.dirname(__path__[0]))
 
119
        rh = branch.revision_history()
 
120
        if rh:
 
121
            return len(rh), rh[-1]
 
122
        else:
 
123
            return None
 
124
    except bzrlib.errors.BzrError:
 
125
        return None
 
126
    
57
127
def test_suite():
58
128
    import tests
59
129
    return tests.test_suite()