~bzr/ubuntu/maverick/bzr-svn/bzr-ppa

« back to all changes in this revision

Viewing changes to cache.py

  • Committer: Jelmer Vernooij
  • Date: 2008-05-11 19:29:26 UTC
  • mfrom: (220.36.144 0.4)
  • Revision ID: jelmer@samba.org-20080511192926-7mh02j45r25qmzkz
Merge 0.4 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
# This program is free software; you can redistribute it and/or modify
4
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
 
5
# the Free Software Foundation; either version 3 of the License, or
6
6
# (at your option) any later version.
7
7
 
8
8
# This program is distributed in the hope that it will be useful,
16
16
"""Subversion cache directory access."""
17
17
 
18
18
import bzrlib
 
19
from bzrlib import debug
19
20
from bzrlib.config import config_dir, ensure_config_dir_exists
20
 
from bzrlib.trace import warning
 
21
from bzrlib.trace import mutter, warning
 
22
from bzrlib.plugins.svn import version_info
21
23
 
22
24
import os
23
25
 
27
29
    :return: Path to cache directory.
28
30
    """
29
31
    ensure_config_dir_exists()
30
 
    cache_dir = os.path.join(config_dir(), 'svn-cache')
 
32
    if version_info[3] == 'exp':
 
33
        name = 'svn-cache-exp'
 
34
        extra = "This is the directory used by the experimental version of bzr-svn.\n"
 
35
    else:
 
36
        name = 'svn-cache'
 
37
        extra = ""
 
38
    cache_dir = os.path.join(config_dir(), name)
31
39
 
32
40
    if not os.path.exists(cache_dir):
33
41
        os.mkdir(cache_dir)
39
47
without losing data.
40
48
 
41
49
See http://bazaar-vcs.org/BzrForeignBranches/Subversion for details.
42
 
""")
 
50
""" + extra)
43
51
    return cache_dir
44
52
 
45
53
 
66
74
    raise bzrlib.errors.BzrError("missing sqlite library")
67
75
 
68
76
 
69
 
class CacheTable:
 
77
class CacheTable(object):
70
78
    """Simple base class for SQLite-based caches."""
71
79
    def __init__(self, cache_db=None):
72
80
        if cache_db is None:
78
86
 
79
87
    def _create_table(self):
80
88
        pass
 
89
 
 
90
    def mutter(self, text):
 
91
        if "cache" in debug.debug_flags:
 
92
            mutter(text)