~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

  • Committer: Martin Pool
  • Date: 2005-05-17 07:01:47 UTC
  • Revision ID: mbp@sourcefrog.net-20050517070147-c38da17418ea6711
- Add patch to give symlink support

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""bzr library"""
18
18
 
19
19
from inventory import Inventory, InventoryEntry
20
 
from branch import Branch, ScratchBranch, find_branch
 
20
from branch import Branch, ScratchBranch
21
21
from osutils import format_date
22
22
from tree import Tree
23
23
from diff import compare_trees
29
29
 
30
30
DEFAULT_IGNORE = ['.bzr.log',
31
31
                  '*~', '#*#', '*$', '.#*',
32
 
                  '.*.sw[nop]', '.*.tmp',
 
32
                  '.*.swp', '.*.tmp',
33
33
                  '*.tmp', '*.bak', '*.BAK', '*.orig',
34
34
                  '*.o', '*.obj', '*.a', '*.py[oc]', '*.so', '*.exe', '*.elc', 
35
35
                  '{arch}', 'CVS', 'CVS.adm', '.svn', '_darcs', 'SCCS', 'RCS',
36
36
                  '*,v',
37
37
                  'BitKeeper',
38
 
                  '.git',
39
38
                  'TAGS', '.make.state', '.sconsign', '.tmp*',
40
39
                  '.del-*']
41
40
 
43
42
 
44
43
import locale
45
44
user_encoding = locale.getpreferredencoding()
46
 
del locale
47
45
 
48
46
__copyright__ = "Copyright 2005 Canonical Development Ltd."
49
47
__author__ = "Martin Pool <mbp@canonical.com>"
50
48
__version__ = '0.0.5pre'
51
49
 
52
 
 
53
 
def get_bzr_revision():
54
 
    """If bzr is run from a branch, return (revno,revid) or None"""
55
 
    from errors import BzrError
56
 
    try:
57
 
        branch = Branch(__path__[0])
58
 
        rh = branch.revision_history()
59
 
        if rh:
60
 
            return len(rh), rh[-1]
61
 
        else:
62
 
            return None
63
 
    except BzrError:
64
 
        return None
65