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

Merge thin-pack work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
"""An adapter between a Git control dir and a Bazaar BzrDir."""
 
17
"""An adapter between a Git control dir and a Bazaar BzrDir"""
18
18
 
19
19
import os
20
20
 
27
27
    )
28
28
 
29
29
lazy_import(globals(), """
30
 
from bzrlib.lockable_files import (
31
 
    TransportLock,
32
 
    )
 
30
from bzrlib.lockable_files import TransportLock
33
31
from bzrlib.plugins.git import (
34
32
    errors,
35
33
    branch,
36
 
    get_rich_root_format,
37
34
    repository,
38
35
    workingtree,
39
36
    )
69
66
        self._lock = lock
70
67
        self._transaction = None
71
68
        self._lock_mode = None
 
69
        self._lock_count = 0
72
70
        self._transport = transport
73
 
        self._lock_count = 0
74
71
 
75
72
 
76
73
class GitDir(bzrdir.BzrDir):
80
77
        return True
81
78
 
82
79
    def cloning_metadir(self, stacked=False):
83
 
        return get_rich_root_format()
 
80
        return bzrlib.bzrdir.format_registry.make_bzrdir("1.9-rich-root")
84
81
 
85
82
 
86
83
class LocalGitDir(GitDir):
111
108
    def open_branch(self, ignored=None):
112
109
        """'create' a branch for this dir."""
113
110
        repo = self.open_repository()
114
 
        return branch.LocalGitBranch(self, repo, "HEAD", repo._git.head(),
115
 
            self._lockfiles)
 
111
        return branch.LocalGitBranch(self, repo, "HEAD", repo._git.head(), self._lockfiles)
116
112
 
117
113
    def open_repository(self, shared=False):
118
114
        """'open' a repository for this dir."""
119
115
        return self._gitrepository_class(self, self._lockfiles)
120
116
 
121
117
    def open_workingtree(self, recommend_upgrade=True):
122
 
        loc = urlutils.unescape_for_display(self.root_transport.base, 'ascii')
123
 
        raise errors.bzr_errors.NoWorkingTree(loc)
124
118
        if (not self._git.bare and 
125
119
            os.path.exists(os.path.join(self._git.controldir(), "index"))):
126
120
            return workingtree.GitWorkingTree(self, self.open_repository(), 
127
121
                                                  self.open_branch())
 
122
        loc = urlutils.unescape_for_display(self.root_transport.base, 'ascii')
 
123
        raise errors.bzr_errors.NoWorkingTree(loc)
128
124
 
129
125
    def create_repository(self, shared=False):
130
126
        return self.open_repository()