/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 gitlib/git_dir.py

More refactoring. Add some direct tests for GitModel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""An adapter between a Git control dir and a Bazaar BzrDir"""
18
18
 
 
19
from bzrlib.lazy_import import lazy_import
19
20
from bzrlib import (
20
21
    bzrdir,
21
 
    errors,
22
22
    lockable_files,
23
23
    urlutils,
24
24
    )
25
25
 
 
26
lazy_import(globals(), """
26
27
from bzrlib.plugins.git.gitlib import (
 
28
    errors,
27
29
    git_branch,
28
30
    git_repository,
29
31
    )
 
32
""")
30
33
 
31
34
 
32
35
class GitLock(object):
66
69
            return self.transport
67
70
        if isinstance(branch_format, GitBzrDirFormat):
68
71
            return self.transport
69
 
        raise errors.IncompatibleFormat(branch_format, self._format)
 
72
        raise errors.bzr_errors.IncompatibleFormat(branch_format, self._format)
70
73
 
71
74
    get_repository_transport = get_branch_transport
72
75
    get_workingtree_transport = get_branch_transport
84
87
 
85
88
    def open_workingtree(self):
86
89
        loc = urlutils.unescape_for_display(self.root_transport.base, 'ascii')
87
 
        raise errors.NoWorkingTree(loc)
 
90
        raise errors.bzr_errors.NoWorkingTree(loc)
88
91
 
89
92
 
90
93
class GitBzrDirFormat(bzrdir.BzrDirFormat):
105
108
            url = url[len('readonly+'):]
106
109
        path = urlutils.local_path_from_url(url)
107
110
        if not transport.has('.git'):
108
 
            raise errors.NotBranchError(path=transport.base)
 
111
            raise errors.bzr_errors.NotBranchError(path=transport.base)
109
112
        lockfiles = GitLockableFiles(GitLock())
110
113
        return GitDir(transport, lockfiles, self)
111
114
 
122
125
            format.open(transport)
123
126
            return format
124
127
        except Exception, e:
125
 
            raise errors.NotBranchError(path=transport.base)
126
 
        raise errors.NotBranchError(path=transport.base)
 
128
            raise errors.bzr_errors.NotBranchError(path=transport.base)
 
129
        raise errors.bzr_errors.NotBranchError(path=transport.base)
127
130
 
128
131
 
129
132
bzrdir.BzrDirFormat.register_control_format(GitBzrDirFormat)