~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

  • Committer: Robert Collins
  • Date: 2005-10-11 07:21:00 UTC
  • mto: This revision was merged to the branch mainline in revision 1443.
  • Revision ID: robertc@robertcollins.net-20051011072100-16996b55c43ff24f
move editor into the config file too

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
 
                  '.del-*']
 
31
                  '.del-*',
 
32
                  '.DS_Store',]
40
33
 
41
34
IGNORE_FILENAME = ".bzrignore"
42
35
 
 
36
import os
43
37
import locale
44
 
user_encoding = locale.getpreferredencoding()
 
38
user_encoding = locale.getpreferredencoding() or 'ascii'
45
39
del locale
46
40
 
47
41
__copyright__ = "Copyright 2005 Canonical Development Ltd."
48
 
__author__ = "Martin Pool <mbp@canonical.com>"
49
 
__version__ = '0.0.5pre'
 
42
__version__ = '0.1rc2'
 
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(os.path.dirname(__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()