~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

  • Committer: Martin Pool
  • Date: 2005-06-21 06:10:18 UTC
  • Revision ID: mbp@sourcefrog.net-20050621061017-12e8f0ff45228338
- move whitebox/blackbox modules into bzrlib.selftest subdirectory

Show diffs side-by-side

added added

removed removed

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