~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

  • Committer: Martin Pool
  • Date: 2005-05-10 06:00:59 UTC
  • Revision ID: mbp@sourcefrog.net-20050510060059-bae67a465325f650
- Use AtomicFile to update statcache.
- New closed property on AtomicFile

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, open_tracefile
 
25
from log import show_log
 
26
import add
 
27
 
19
28
BZRDIR = ".bzr"
20
29
 
21
30
DEFAULT_IGNORE = ['.bzr.log',
22
31
                  '*~', '#*#', '*$', '.#*',
23
 
                  '.*.sw[nop]', '.*.tmp',
 
32
                  '.*.swp', '.*.tmp',
24
33
                  '*.tmp', '*.bak', '*.BAK', '*.orig',
25
34
                  '*.o', '*.obj', '*.a', '*.py[oc]', '*.so', '*.exe', '*.elc', 
26
35
                  '{arch}', 'CVS', 'CVS.adm', '.svn', '_darcs', 'SCCS', 'RCS',
27
36
                  '*,v',
28
37
                  'BitKeeper',
29
 
                  '.git',
30
38
                  'TAGS', '.make.state', '.sconsign', '.tmp*',
31
 
                  '.del-*',
32
 
                  '.DS_Store',]
 
39
                  '.del-*']
33
40
 
34
41
IGNORE_FILENAME = ".bzrignore"
35
42
 
36
 
import os
37
43
import locale
38
 
user_encoding = locale.getpreferredencoding() or 'ascii'
39
 
del locale
 
44
user_encoding = locale.getpreferredencoding()
40
45
 
41
46
__copyright__ = "Copyright 2005 Canonical Development Ltd."
42
 
__version__ = '0.10pre(newformat)'
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()
 
47
__author__ = "Martin Pool <mbp@canonical.com>"
 
48
__version__ = '0.0.5pre'
 
49