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

  • Committer: Jelmer Vernooij
  • Date: 2019-06-03 23:48:08 UTC
  • mfrom: (7316 work)
  • mto: This revision was merged to the branch mainline in revision 7328.
  • Revision ID: jelmer@jelmer.uk-20190603234808-15yk5c7054tj8e2b
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    )
31
31
 
32
32
from .. import (
33
 
    bedding,
34
33
    errors as bzr_errors,
35
34
    osutils,
36
35
    registry,
47
46
    viewvalues,
48
47
    )
49
48
from ..transport import (
50
 
    get_transport_from_path,
 
49
    get_transport,
51
50
    )
52
51
 
53
52
 
54
53
def get_cache_dir():
55
 
    path = os.path.join(bedding.cache_dir(), "git")
56
 
    if not os.path.isdir(path):
57
 
        os.mkdir(path)
58
 
    return path
 
54
    try:
 
55
        from xdg.BaseDirectory import xdg_cache_home
 
56
    except ImportError:
 
57
        from ..config import config_dir
 
58
        ret = os.path.join(config_dir(), "git")
 
59
    else:
 
60
        ret = os.path.join(xdg_cache_home, "breezy", "git")
 
61
    if not os.path.isdir(ret):
 
62
        os.makedirs(ret)
 
63
    return ret
59
64
 
60
65
 
61
66
def get_remote_cache_transport(repository):
69
74
        path = os.path.join(get_cache_dir(), uuid)
70
75
        if not os.path.isdir(path):
71
76
            os.mkdir(path)
72
 
    return get_transport_from_path(path)
 
77
    return get_transport(path)
73
78
 
74
79
 
75
80
def check_pysqlite_version(sqlite3):
843
848
            except bzr_errors.FileExists:
844
849
                pass
845
850
            return cls(transport.clone('git'))
846
 
        return cls(get_transport_from_path(get_cache_dir()))
 
851
        from ..transport import get_transport
 
852
        return cls(get_transport(get_cache_dir()))
847
853
 
848
854
    def __repr__(self):
849
855
        if self._transport is not None: