/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 cache.py

More performance hacking, introduce sqlite cache, escape characters in commits that break serializers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
import os
22
22
 
23
 
import bzrlib
 
23
import sqlite3
 
24
 
24
25
from bzrlib.config import config_dir, ensure_config_dir_exists
25
 
from bzrlib.trace import warning
26
26
 
27
27
 
28
28
def create_cache_dir():
44
44
 
45
45
""")
46
46
    return cache_dir
47
 
 
48
 
 
49
 
def check_pysqlite_version(sqlite3):
50
 
    """Check that sqlite library is compatible.
51
 
 
52
 
    """
53
 
    if (sqlite3.sqlite_version_info[0] < 3 or 
54
 
            (sqlite3.sqlite_version_info[0] == 3 and 
55
 
             sqlite3.sqlite_version_info[1] < 3)):
56
 
        warning('Needs at least sqlite 3.3.x')
57
 
        raise bzrlib.errors.BzrError("incompatible sqlite library")
58
 
 
59
 
try:
60
 
    try:
61
 
        import sqlite3
62
 
        check_pysqlite_version(sqlite3)
63
 
    except (ImportError, bzrlib.errors.BzrError), e: 
64
 
        from pysqlite2 import dbapi2 as sqlite3
65
 
        check_pysqlite_version(sqlite3)
66
 
except:
67
 
    warning('Needs at least Python2.5 or Python2.4 with the pysqlite2 '
68
 
            'module')
69
 
    raise bzrlib.errors.BzrError("missing sqlite library")