/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

  • 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:
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
 
49
46
from bzrlib.plugins.git.inventory import (
50
47
    GitIndexInventory,
51
48
    )
 
49
from bzrlib.plugins.git.mapping import (
 
50
    GitFileIdMap,
 
51
    )
52
52
from bzrlib.plugins.git.tree import (
53
53
    changes_from_git_changes,
54
54
    tree_delta_from_git_changes,
55
55
    )
56
 
from bzrlib.plugins.git.mapping import (
57
 
    GitFileIdMap,
58
 
    )
 
56
 
59
57
 
60
58
IGNORE_FILENAME = ".gitignore"
61
59
 
150
148
        # TODO: Maybe this should only write on dirty ?
151
149
        if self._control_files._lock_mode != 'w':
152
150
            raise errors.NotWriteLocked(self)
153
 
        self._rewrite_index()
 
151
        self._rewrite_index()           
154
152
        self.index.write()
155
153
        self._inventory_is_modified = False
156
154
 
180
178
            head = self.repository._git.head()
181
179
        except KeyError, name:
182
180
            raise errors.NotBranchError("branch %s at %s" % (name, self.repository.base))
183
 
        basis_inv = self.repository.get_inventory(self.branch.lookup_foreign_revision_id(head))
 
181
        basis_inv = self.repository.get_inventory(self.mapping.revision_id_foreign_to_bzr(head))
184
182
        store = self.repository._git.object_store
185
 
        if head == ZERO_SHA:
186
 
            fileid_map = GitFileIdMap({}, self.mapping)
187
 
            basis_inv = None
 
183
        commit = store[head]
 
184
        try:
 
185
            file_id_map_sha = store[commit.tree][self.mapping.BZR_FILE_IDS_FILE][1]
 
186
        except KeyError:
 
187
            file_ids = {}
188
188
        else:
189
 
            fileid_map = self.mapping.get_fileid_map(store.__getitem__,
190
 
                store[head].tree)
 
189
            file_ids = self.mapping.import_fileid_map(store[file_id_map_sha])
 
190
        fileid_map = GitFileIdMap(file_ids, self.mapping)
191
191
        result = GitIndexInventory(basis_inv, fileid_map, self.index, store)
192
192
        self._set_inventory(result, dirty=False)
193
193
 
215
215
 
216
216
    @property
217
217
    def _matchingbzrdir(self):
218
 
        from bzrlib.plugins.git import LocalGitControlDirFormat
219
 
        return LocalGitControlDirFormat()
 
218
        from bzrlib.plugins.git import LocalGitBzrDirFormat
 
219
        return LocalGitBzrDirFormat()
220
220
 
221
221
    def get_format_description(self):
222
222
        return "Git Working Tree"
241
241
        changes = self._index.changes_from_tree(
242
242
            self.source._repository._git.object_store, self.source.tree, 
243
243
            want_unchanged=want_unchanged)
244
 
        source_fileid_map = self.source.mapping.get_fileid_map(
245
 
            self.source._repository._git.object_store.__getitem__,
246
 
            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,
258
 
            (source_fileid_map, target_fileid_map),
 
244
        ret = tree_delta_from_git_changes(changes, self.target.mapping, 
259
245
            specific_file=specific_files, require_versioned=require_versioned)
260
246
        if want_unversioned:
261
247
            for e in self.target.extras():