~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

  • Committer: mbp at sourcefrog
  • Date: 2005-03-23 23:52:10 UTC
  • Revision ID: mbp@sourcefrog.net-20050323235210-5464746b93c39ed0
more notes on darcs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# (C) 2005 Canonical Development Ltd
 
1
#! /usr/bin/env python
 
2
# -*- coding: UTF-8 -*-
2
3
 
3
4
# This program is free software; you can redistribute it and/or modify
4
5
# it under the terms of the GNU General Public License as published by
16
17
 
17
18
"""bzr library"""
18
19
 
 
20
from inventory import Inventory, InventoryEntry
 
21
from branch import Branch, ScratchBranch
 
22
from osutils import format_date
 
23
from tree import Tree
 
24
from diff import diff_trees
 
25
from trace import mutter, warning
 
26
import add
 
27
 
19
28
BZRDIR = ".bzr"
20
29
 
21
 
DEFAULT_IGNORE = ['.bzr.log',
22
 
                  '*~', '#*#', '*$', '.#*',
23
 
                  '.*.sw[nop]', '.*.tmp',
24
 
                  '*.tmp', '*.bak', '*.BAK', '*.orig',
25
 
                  '*.o', '*.obj', '*.a', '*.py[oc]', '*.so', '*.exe', '*.elc', 
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',]
 
30
DEFAULT_IGNORE = ['.*', '*~', '#*#', '*.tmp', '*.o', '*.a', '*.py[oc]',
 
31
                  '{arch}']
33
32
 
34
33
IGNORE_FILENAME = ".bzrignore"
35
34
 
36
 
import locale
37
 
user_encoding = locale.getpreferredencoding() or 'ascii'
38
 
del locale
39
 
 
40
 
__copyright__ = "Copyright 2005 Canonical Development Ltd."
41
 
__author__ = "Martin Pool <mbp@canonical.com>"
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()
 
35