/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

  • Committer: Jelmer Vernooij
  • Date: 2010-05-05 09:58:55 UTC
  • mto: (0.200.912 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20100505095855-i0165hooflvk9chy
Ignore control files in inventories.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
from bzrlib.plugins.git import (
31
31
    LocalGitBzrDirFormat,
 
32
    get_rich_root_format,
32
33
    )
33
34
 
34
35
 
75
76
    def is_supported(self):
76
77
        return True
77
78
 
78
 
    def can_convert_format(self):
79
 
        return False
80
 
 
81
79
    def cloning_metadir(self, stacked=False):
82
 
        return bzrdir.format_registry.make_bzrdir("default")
 
80
        return get_rich_root_format(stacked)
83
81
 
84
82
    def _branch_name_to_ref(self, name):
85
83
        raise NotImplementedError(self._branch_name_to_ref)
117
115
 
118
116
    def _branch_name_to_ref(self, name):
119
117
        from bzrlib.plugins.git.refs import branch_name_to_ref
120
 
        ref = branch_name_to_ref(name, None)
121
 
        if ref == "HEAD":
 
118
        if name in (None, "HEAD"):
122
119
            from dulwich.repo import SYMREF
123
 
            refcontents = self._git.refs.read_ref(ref)
 
120
            refcontents = self._git.refs.read_ref("HEAD")
124
121
            if refcontents.startswith(SYMREF):
125
 
                ref = refcontents[len(SYMREF):]
126
 
        return ref
 
122
                name = refcontents[len(SYMREF):]
 
123
            else:
 
124
                name = "HEAD"
 
125
        return branch_name_to_ref(name, "HEAD")
127
126
 
128
127
    def is_control_filename(self, filename):
129
128
        return filename == '.git' or filename.startswith('.git/')
130
129
 
131
 
    def get_branch_transport(self, branch_format, name=None):
 
130
    def get_branch_transport(self, branch_format, name):
132
131
        if branch_format is None:
133
132
            return self.transport
134
133
        if isinstance(branch_format, LocalGitBzrDirFormat):
159
158
    def destroy_branch(self, name=None):
160
159
        del self._git.refs[self._branch_name_to_ref(name)]
161
160
 
162
 
    def destroy_repository(self):
163
 
        raise bzr_errors.UnsupportedOperation(self.destroy_repository, self)
164
 
 
165
 
    def destroy_workingtree(self):
166
 
        raise bzr_errors.UnsupportedOperation(self.destroy_workingtree, self)
167
 
 
168
161
    def list_branches(self):
169
162
        ret = []
170
163
        for name in self._git.get_refs():
186
179
                pass
187
180
            else:
188
181
                from bzrlib.plugins.git.workingtree import GitWorkingTree
189
 
                try:
190
 
                    branch = self.open_branch()
191
 
                except bzr_errors.NotBranchError:
192
 
                    pass
193
 
                else:
194
 
                    return GitWorkingTree(self, repo, branch, index)
 
182
                return GitWorkingTree(self, repo, self.open_branch(), index)
195
183
        loc = urlutils.unescape_for_display(self.root_transport.base, 'ascii')
196
184
        raise bzr_errors.NoWorkingTree(loc)
197
185
 
201
189
    def create_branch(self, name=None):
202
190
        refname = self._branch_name_to_ref(name)
203
191
        from dulwich.protocol import ZERO_SHA
204
 
        self._git.refs[refname or "HEAD"] = ZERO_SHA
 
192
        self._git.refs[refname] = ZERO_SHA
205
193
        return self.open_branch(name)
206
194
 
207
195
    def backup_bzrdir(self):