~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

  • Committer: Martin Pool
  • Date: 2005-07-11 03:40:02 UTC
  • Revision ID: mbp@sourcefrog.net-20050711034002-575d84b4c7514542
- commit command refuses unless something is changed or --unchanged is given

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