~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-16 16:27:58 UTC
  • mto: This revision was merged to the branch mainline in revision 1938.
  • Revision ID: john@arbash-meinel.com-20060816162758-752ad5818bc063c9
Move out the blackbox testament tests into a real blackbox module

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# (C) 2005 Canonical Development Ltd
 
1
# Copyright (C) 2005, 2006 Canonical Development Ltd
2
2
 
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
16
16
 
17
17
"""bzr library"""
18
18
 
19
 
BZRDIR = ".bzr"
20
 
 
21
 
DEFAULT_IGNORE = ['.bzr.log',
22
 
                  '*~', '#*#', '*$', '.#*',
23
 
                  '.*.sw[nop]', '.*.tmp',
24
 
                  '*.tmp', '*.bak', '*.BAK', '*.orig',
25
 
                  '*.o', '*.obj', '*.a', '*.py[oc]', '*.so', '*.exe', '*.elc', 
26
 
                  '{arch}', 'CVS', 'CVS.adm', '.svn', '_darcs', 'SCCS', 'RCS',
27
 
                  '*,v',
28
 
                  'BitKeeper',
29
 
                  '.git',
30
 
                  'TAGS', '.make.state', '.sconsign', '.tmp*',
31
 
                  '.del-*']
32
19
 
33
20
IGNORE_FILENAME = ".bzrignore"
34
21
 
35
 
import locale
 
22
import os
 
23
import sys
 
24
if sys.platform == 'darwin':
 
25
    # work around egregious python 2.4 bug
 
26
    sys.platform = 'posix'
 
27
    import locale
 
28
    sys.platform = 'darwin'
 
29
else:
 
30
    import locale
 
31
# XXX: This probably belongs in osutils instead
36
32
user_encoding = locale.getpreferredencoding() or 'ascii'
37
33
del locale
38
34
 
39
 
__copyright__ = "Copyright 2005 Canonical Development Ltd."
40
 
__author__ = "Martin Pool <mbp@canonical.com>"
41
 
__version__ = '0.1pre'
42
 
 
43
 
 
44
 
def get_bzr_revision():
45
 
    """If bzr is run from a branch, return (revno,revid) or None"""
46
 
    import bzrlib.errors
47
 
    from bzrlib.branch import Branch
48
 
    
49
 
    try:
50
 
        branch = Branch(__path__[0])
51
 
        rh = branch.revision_history()
52
 
        if rh:
53
 
            return len(rh), rh[-1]
54
 
        else:
55
 
            return None
56
 
    except bzrlib.errors.BzrError:
57
 
        return None
58
 
    
 
35
__copyright__ = "Copyright 2005, 2006 Canonical Development Ltd."
 
36
 
 
37
# same format as sys.version_info: "A tuple containing the five components of
 
38
# the version number: major, minor, micro, releaselevel, and serial. All
 
39
# values except releaselevel are integers; the release level is 'alpha',
 
40
# 'beta', 'candidate', or 'final'. The version_info value corresponding to the
 
41
# Python version 2.0 is (2, 0, 0, 'final', 0)."  Additionally we use a
 
42
# releaselevel of 'dev' for unreleased under-development code.
 
43
 
 
44
version_info = (0, 10, 0, 'dev', 0)
 
45
 
 
46
if version_info[3] == 'final':
 
47
    version_string = '%d.%d.%d' % version_info[:3]
 
48
else:
 
49
    version_string = '%d.%d.%d%s%d' % version_info
 
50
__version__ = version_string
 
51
 
 
52
from bzrlib.symbol_versioning import (deprecated_function,
 
53
                                      zero_seven,
 
54
                                      zero_nine,
 
55
                                      deprecated_list,
 
56
                                     )
 
57
 
 
58
# Kept for compatibility with 0.8, it is considered deprecated to modify it
 
59
DEFAULT_IGNORE = deprecated_list(zero_nine, 'DEFAULT_IGNORE', [],
 
60
                    'Consider using bzrlib.ignores.add_unique_user_ignores'
 
61
                    ' or bzrlib.ignores.add_runtime_ignores')
 
62
 
59
63
def test_suite():
60
 
    import selftest
61
 
    return selftest.test_suite()
 
64
    import tests
 
65
    return tests.test_suite()