/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

  • Committer: Martin Pool
  • Date: 2005-08-24 08:59:32 UTC
  • Revision ID: mbp@sourcefrog.net-20050824085932-c61f1f1f1c930e13
- Add a simple UIFactory 

  The idea of this is to let a client of bzrlib set some 
  policy about how output is displayed.

  In this revision all that's done is that progress bars
  are constructed by a policy established by the application
  rather than being randomly constructed in the library 
  or passed down the calls.  This avoids progress bars
  popping up while running the test suite and cleans up
  some code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# (C) 2005 Canonical Development Ltd
 
2
 
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
 
7
 
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
 
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
 
 
17
"""bzr library"""
 
18
 
 
19
# TODO: Do less imports here
 
20
from branch import Branch, ScratchBranch, find_branch
 
21
from errors import BzrError
 
22
 
 
23
BZRDIR = ".bzr"
 
24
 
 
25
DEFAULT_IGNORE = ['.bzr.log',
 
26
                  '*~', '#*#', '*$', '.#*',
 
27
                  '.*.sw[nop]', '.*.tmp',
 
28
                  '*.tmp', '*.bak', '*.BAK', '*.orig',
 
29
                  '*.o', '*.obj', '*.a', '*.py[oc]', '*.so', '*.exe', '*.elc', 
 
30
                  '{arch}', 'CVS', 'CVS.adm', '.svn', '_darcs', 'SCCS', 'RCS',
 
31
                  '*,v',
 
32
                  'BitKeeper',
 
33
                  '.git',
 
34
                  'TAGS', '.make.state', '.sconsign', '.tmp*',
 
35
                  '.del-*']
 
36
 
 
37
IGNORE_FILENAME = ".bzrignore"
 
38
 
 
39
import locale
 
40
user_encoding = locale.getpreferredencoding() or 'ascii'
 
41
del locale
 
42
 
 
43
__copyright__ = "Copyright 2005 Canonical Development Ltd."
 
44
__author__ = "Martin Pool <mbp@canonical.com>"
 
45
__version__ = '0.0.7pre'
 
46
 
 
47
 
 
48
def get_bzr_revision():
 
49
    """If bzr is run from a branch, return (revno,revid) or None"""
 
50
    try:
 
51
        branch = Branch(__path__[0])
 
52
        rh = branch.revision_history()
 
53
        if rh:
 
54
            return len(rh), rh[-1]
 
55
        else:
 
56
            return None
 
57
    except BzrError:
 
58
        return None
 
59