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

Simplify ref handling in remote.py.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
from dulwich.objects import (
26
26
    Blob,
27
27
    )
28
 
from dulwich.protocol import (
29
 
    ZERO_SHA,
30
 
    )
31
28
import os
32
29
import stat
33
30
 
53
50
    changes_from_git_changes,
54
51
    tree_delta_from_git_changes,
55
52
    )
56
 
from bzrlib.plugins.git.mapping import (
57
 
    GitFileIdMap,
58
 
    )
 
53
 
59
54
 
60
55
IGNORE_FILENAME = ".gitignore"
61
56
 
150
145
        # TODO: Maybe this should only write on dirty ?
151
146
        if self._control_files._lock_mode != 'w':
152
147
            raise errors.NotWriteLocked(self)
153
 
        self._rewrite_index()
 
148
        self._rewrite_index()           
154
149
        self.index.write()
155
150
        self._inventory_is_modified = False
156
151
 
182
177
            raise errors.NotBranchError("branch %s at %s" % (name, self.repository.base))
183
178
        basis_inv = self.repository.get_inventory(self.branch.lookup_foreign_revision_id(head))
184
179
        store = self.repository._git.object_store
185
 
        if head == ZERO_SHA:
186
 
            fileid_map = GitFileIdMap({}, self.mapping)
187
 
            basis_inv = None
188
 
        else:
189
 
            fileid_map = self.mapping.get_fileid_map(store.__getitem__,
190
 
                store[head].tree)
 
180
        fileid_map = self.mapping.get_fileid_map(store.__getitem__,
 
181
            store[head].tree)
191
182
        result = GitIndexInventory(basis_inv, fileid_map, self.index, store)
192
183
        self._set_inventory(result, dirty=False)
193
184
 
215
206
 
216
207
    @property
217
208
    def _matchingbzrdir(self):
218
 
        from bzrlib.plugins.git import LocalGitControlDirFormat
219
 
        return LocalGitControlDirFormat()
 
209
        from bzrlib.plugins.git import LocalGitBzrDirFormat
 
210
        return LocalGitBzrDirFormat()
220
211
 
221
212
    def get_format_description(self):
222
213
        return "Git Working Tree"
241
232
        changes = self._index.changes_from_tree(
242
233
            self.source._repository._git.object_store, self.source.tree, 
243
234
            want_unchanged=want_unchanged)
244
 
        source_fileid_map = self.source.mapping.get_fileid_map(
 
235
        source_fileid_map = self.source.get_fileid_map(
245
236
            self.source._repository._git.object_store.__getitem__,
246
237
            self.source.tree)
247
 
        if self.target.mapping.BZR_FILE_IDS_FILE is not None:
248
 
            file_id = self.target.path2id(
249
 
                self.target.mapping.BZR_FILE_IDS_FILE)
250
 
            if file_id is None:
251
 
                target_fileid_map = {}
252
 
            else:
253
 
                target_fileid_map = self.target.mapping.import_fileid_map(Blob.from_string(self.target.get_file_text(file_id)))
254
 
        else:
255
 
            target_fileid_map = {}
256
 
        target_fileid_map = GitFileIdMap(target_fileid_map, self.target.mapping)
257
 
        ret = tree_delta_from_git_changes(changes, self.target.mapping,
 
238
        target_fileid_map = self.target.get_fileid_map(
 
239
            self.target._repository._git.object_store.__getitem__,
 
240
            self.target.tree)
 
241
        ret = tree_delta_from_git_changes(changes, self.target.mapping, 
258
242
            (source_fileid_map, target_fileid_map),
259
243
            specific_file=specific_files, require_versioned=require_versioned)
260
244
        if want_unversioned: