~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

  • Committer: Aaron Bentley
  • Date: 2005-09-19 02:52:24 UTC
  • mto: (1185.1.29)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: aaron.bentley@utoronto.ca-20050919025224-1cc3c70640086e09
TODO re tests

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
21
 
from osutils import format_date
22
 
from tree import Tree
23
 
from diff import diff_trees
24
 
from trace import mutter, warning
25
 
import add
26
 
 
27
19
BZRDIR = ".bzr"
28
20
 
29
21
DEFAULT_IGNORE = ['.bzr.log',
30
22
                  '*~', '#*#', '*$', '.#*',
 
23
                  '.*.sw[nop]', '.*.tmp',
31
24
                  '*.tmp', '*.bak', '*.BAK', '*.orig',
32
25
                  '*.o', '*.obj', '*.a', '*.py[oc]', '*.so', '*.exe', '*.elc', 
33
 
                  '{arch}', 'CVS', '.svn', '_darcs', 'SCCS', 'RCS',
34
 
                  'TAGS', '.make.state', '.sconsign']
 
26
                  '{arch}', 'CVS', 'CVS.adm', '.svn', '_darcs', 'SCCS', 'RCS',
 
27
                  '*,v',
 
28
                  'BitKeeper',
 
29
                  '.git',
 
30
                  'TAGS', '.make.state', '.sconsign', '.tmp*',
 
31
                  '.del-*',
 
32
                  '.DS_Store',]
35
33
 
36
34
IGNORE_FILENAME = ".bzrignore"
37
35
 
 
36
import locale
 
37
user_encoding = locale.getpreferredencoding() or 'ascii'
 
38
del locale
38
39
 
39
40
__copyright__ = "Copyright 2005 Canonical Development Ltd."
40
41
__author__ = "Martin Pool <mbp@canonical.com>"
41
 
__version__ = '0.0.3pre'
42
 
 
 
42
__version__ = '0.1pre'
 
43
 
 
44
 
 
45
def get_bzr_revision():
 
46
    """If bzr is run from a branch, return (revno,revid) or None"""
 
47
    import bzrlib.errors
 
48
    from bzrlib.branch import Branch
 
49
    
 
50
    try:
 
51
        branch = Branch.open(__path__[0])
 
52
        rh = branch.revision_history()
 
53
        if rh:
 
54
            return len(rh), rh[-1]
 
55
        else:
 
56
            return None
 
57
    except bzrlib.errors.BzrError:
 
58
        return None
 
59
    
 
60
def test_suite():
 
61
    import selftest
 
62
    return selftest.test_suite()