~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

  • Committer: Martin Pool
  • Date: 2005-09-06 07:39:09 UTC
  • Revision ID: mbp@sourcefrog.net-20050906073909-234eb078dfff15d9
- improved check for branch version

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""bzr library"""
18
18
 
19
 
from branch import Branch, ScratchBranch, find_branch
20
 
from errors import BzrError
21
 
 
22
19
BZRDIR = ".bzr"
23
20
 
24
21
DEFAULT_IGNORE = ['.bzr.log',
41
38
 
42
39
__copyright__ = "Copyright 2005 Canonical Development Ltd."
43
40
__author__ = "Martin Pool <mbp@canonical.com>"
44
 
__version__ = '0.0.5'
 
41
__version__ = '0.1pre'
45
42
 
46
43
 
47
44
def get_bzr_revision():
48
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
49
    try:
50
50
        branch = Branch(__path__[0])
51
51
        rh = branch.revision_history()
53
53
            return len(rh), rh[-1]
54
54
        else:
55
55
            return None
56
 
    except BzrError:
 
56
    except bzrlib.errors.BzrError:
57
57
        return None
58
58
    
 
59
def test_suite():
 
60
    import selftest
 
61
    return selftest.test_suite()