/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

Add tests for generate_file_id.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
from bzrlib import (
35
35
    errors,
36
36
    ignores,
 
37
    inventory,
37
38
    lockable_files,
38
39
    lockdir,
39
40
    osutils,
150
151
        # TODO: Maybe this should only write on dirty ?
151
152
        if self._control_files._lock_mode != 'w':
152
153
            raise errors.NotWriteLocked(self)
153
 
        self._rewrite_index()
 
154
        self._rewrite_index()           
154
155
        self.index.write()
155
156
        self._inventory_is_modified = False
156
157
 
183
184
        basis_inv = self.repository.get_inventory(self.branch.lookup_foreign_revision_id(head))
184
185
        store = self.repository._git.object_store
185
186
        if head == ZERO_SHA:
186
 
            fileid_map = GitFileIdMap({}, self.mapping)
187
 
            basis_inv = None
 
187
            fileid_map = {}
 
188
            result = inventory.Inventory(root_id=None)
188
189
        else:
189
190
            fileid_map = self.mapping.get_fileid_map(store.__getitem__,
190
191
                store[head].tree)
191
 
        result = GitIndexInventory(basis_inv, fileid_map, self.index, store)
 
192
            result = GitIndexInventory(basis_inv, fileid_map, self.index, store)
192
193
        self._set_inventory(result, dirty=False)
193
194
 
194
195
    @needs_read_lock
215
216
 
216
217
    @property
217
218
    def _matchingbzrdir(self):
218
 
        from bzrlib.plugins.git import LocalGitControlDirFormat
219
 
        return LocalGitControlDirFormat()
 
219
        from bzrlib.plugins.git import LocalGitBzrDirFormat
 
220
        return LocalGitBzrDirFormat()
220
221
 
221
222
    def get_format_description(self):
222
223
        return "Git Working Tree"
245
246
            self.source._repository._git.object_store.__getitem__,
246
247
            self.source.tree)
247
248
        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:
 
249
            try:
 
250
                file_id = self.target.path2id(
 
251
                    self.target.mapping.BZR_FILE_IDS_FILE)
 
252
            except errors.NoSuchId:
251
253
                target_fileid_map = {}
252
254
            else:
253
 
                target_fileid_map = self.target.mapping.import_fileid_map(Blob.from_string(self.target.get_file_text(file_id)))
 
255
                target_fileid_map = self.import_fileid_map(Blob.from_string(self.target.file_text(file_id)))
254
256
        else:
255
257
            target_fileid_map = {}
256
258
        target_fileid_map = GitFileIdMap(target_fileid_map, self.target.mapping)
257
 
        ret = tree_delta_from_git_changes(changes, self.target.mapping,
 
259
        ret = tree_delta_from_git_changes(changes, self.target.mapping, 
258
260
            (source_fileid_map, target_fileid_map),
259
261
            specific_file=specific_files, require_versioned=require_versioned)
260
262
        if want_unversioned: