~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

- merge various windows and other fixes from Ollie Rutherfurd
  
1179: changed diff help example to -r1..2 from deprecated -r1:2
1178: fixed \r\n -> \n conversion in branch._check_format
1177: disable urlgrabber on win32, since it converts / -> \
1176: changed assert path.startswith('./') -> '.'+os.sep in merge.py
1175: replaced os.spawnvp with subprocess.call in msgeditor.py
1174: os.name == 'windows' -> 'nt', check for %EDITOR% on win32
1173: fixed bzr mv filename newfilename, re-enabled test_mv_modes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /usr/bin/env python
2
 
# -*- coding: UTF-8 -*-
 
1
# (C) 2005 Canonical Development Ltd
3
2
 
4
3
# This program is free software; you can redistribute it and/or modify
5
4
# it under the terms of the GNU General Public License as published by
17
16
 
18
17
"""bzr library"""
19
18
 
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
 
 
28
19
BZRDIR = ".bzr"
29
20
 
30
 
DEFAULT_IGNORE = ['.*', '*~', '#*#', '*.tmp', '*.o', '*.a', '*.py[oc]',
31
 
                  '{arch}']
 
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
32
 
33
33
IGNORE_FILENAME = ".bzrignore"
34
34
 
35
 
 
 
35
import locale
 
36
user_encoding = locale.getpreferredencoding() or 'ascii'
 
37
del locale
 
38
 
 
39
__copyright__ = "Copyright 2005 Canonical Development Ltd."
 
40
__author__ = "Martin Pool <mbp@canonical.com>"
 
41
__version__ = '0.1pre'
 
42
 
 
43
 
 
44
def get_bzr_revision():
 
45
    """If bzr is run from a branch, return (revno,revid) or None"""
 
46
    import bzrlib.errors
 
47
    from bzrlib.branch import Branch
 
48
    
 
49
    try:
 
50
        branch = Branch(__path__[0])
 
51
        rh = branch.revision_history()
 
52
        if rh:
 
53
            return len(rh), rh[-1]
 
54
        else:
 
55
            return None
 
56
    except bzrlib.errors.BzrError:
 
57
        return None
 
58
    
 
59
def test_suite():
 
60
    import selftest
 
61
    return selftest.test_suite()