~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

  • Committer: Robert Collins
  • Date: 2005-08-23 10:44:48 UTC
  • mto: (974.1.50) (1185.1.10) (1092.3.1)
  • mto: This revision was merged to the branch mainline in revision 1139.
  • Revision ID: robertc@robertcollins.net-20050823104448-fb5d448e7a5a8ee3
relace runTest with test_foo in blackbox tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""bzr library"""
18
18
 
 
19
# TODO: Do less imports here
 
20
from branch import Branch, ScratchBranch, find_branch
 
21
from errors import BzrError
 
22
 
19
23
BZRDIR = ".bzr"
20
24
 
21
25
DEFAULT_IGNORE = ['.bzr.log',
28
32
                  'BitKeeper',
29
33
                  '.git',
30
34
                  'TAGS', '.make.state', '.sconsign', '.tmp*',
31
 
                  '.del-*',
32
 
                  '.DS_Store',]
 
35
                  '.del-*']
33
36
 
34
37
IGNORE_FILENAME = ".bzrignore"
35
38
 
36
 
import os
37
39
import locale
38
40
user_encoding = locale.getpreferredencoding() or 'ascii'
39
41
del locale
40
42
 
41
43
__copyright__ = "Copyright 2005 Canonical Development Ltd."
42
44
__author__ = "Martin Pool <mbp@canonical.com>"
43
 
__version__ = '0.1pre'
 
45
__version__ = '0.0.7pre'
44
46
 
45
47
 
46
48
def get_bzr_revision():
47
49
    """If bzr is run from a branch, return (revno,revid) or None"""
48
 
    import bzrlib.errors
49
 
    from bzrlib.branch import Branch
50
 
    
51
50
    try:
52
 
        branch = Branch.open(os.path.dirname(__path__[0]))
 
51
        branch = Branch(__path__[0])
53
52
        rh = branch.revision_history()
54
53
        if rh:
55
54
            return len(rh), rh[-1]
56
55
        else:
57
56
            return None
58
 
    except bzrlib.errors.BzrError:
 
57
    except BzrError:
59
58
        return None
60
59
    
61
 
def test_suite():
62
 
    import selftest
63
 
    return selftest.test_suite()