~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

  • Committer: aaron.bentley at utoronto
  • Date: 2005-09-05 01:31:37 UTC
  • mto: (1185.3.4)
  • mto: This revision was merged to the branch mainline in revision 1178.
  • Revision ID: aaron.bentley@utoronto.ca-20050905013137-c8b598b5a90a52a9
Fixed the revno bug in log

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