~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2005-09-19 03:26:14 UTC
  • mto: (1393.2.1)
  • mto: This revision was merged to the branch mainline in revision 1396.
  • Revision ID: john@arbash-meinel.com-20050919032614-79751b0510f24929
Major refactoring of testtransport.
Rewrote test_transport() as a class which can be subclassed which provides
many test_* functions, rather than one large function.
Much easier to debug.

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',
31
28
                  'BitKeeper',
32
29
                  '.git',
33
30
                  'TAGS', '.make.state', '.sconsign', '.tmp*',
34
 
                  '.del-*']
 
31
                  '.del-*',
 
32
                  '.DS_Store',]
35
33
 
36
34
IGNORE_FILENAME = ".bzrignore"
37
35
 
41
39
 
42
40
__copyright__ = "Copyright 2005 Canonical Development Ltd."
43
41
__author__ = "Martin Pool <mbp@canonical.com>"
44
 
__version__ = '0.0.5'
 
42
__version__ = '0.1pre'
45
43
 
46
44
 
47
45
def get_bzr_revision():
48
46
    """If bzr is run from a branch, return (revno,revid) or None"""
 
47
    import bzrlib.errors
 
48
    from bzrlib.branch import Branch
 
49
    
49
50
    try:
50
 
        branch = Branch(__path__[0])
 
51
        import os
 
52
        branch = Branch.open(os.path.dirname(__path__[0]))
51
53
        rh = branch.revision_history()
52
54
        if rh:
53
55
            return len(rh), rh[-1]
54
56
        else:
55
57
            return None
56
 
    except BzrError:
 
58
    except bzrlib.errors.BzrError:
57
59
        return None
58
60
    
 
61
def test_suite():
 
62
    import selftest
 
63
    return selftest.test_suite()