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

Fill in old entries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    )
35
35
 
36
36
 
 
37
from bzrlib.plugins.git.mapping import (
 
38
    entry_mode,
 
39
    )
 
40
 
 
41
 
37
42
class GitCommitBuilder(CommitBuilder):
38
43
 
39
44
    def __init__(self, *args, **kwargs):
86
91
            self._any_changes = True
87
92
            self._blobs[path[1].encode("utf-8")] = (mode, sha)
88
93
            yield file_id, path, (None, None)
89
 
        # FIXME: Import all blobs not set yet, and eliminate blobs set to None
 
94
        # Fill in entries that were not changed
 
95
        basis_tree = workingtree.basis_tree()
 
96
        assert basis_tree.get_revision_id() == basis_revid
 
97
        for path, entry in basis_tree.iter_entries_by_dir():
 
98
            if entry.kind not in ("file", "symlink"):
 
99
                continue
 
100
            if not path in self._blobs:
 
101
                blob = Blob()
 
102
                if entry.kind == "symlink":
 
103
                    blob.data = basis_tree.get_symlink_target(entry.file_id)
 
104
                else:
 
105
                    blob.data = basis_tree.get_file_text(entry.file_id)
 
106
                self._blobs[path.encode("utf-8")] = (entry_mode(entry), blob.id)
90
107
 
91
108
    def finish_inventory(self):
92
 
        pass
 
109
        # eliminate blobs that were removed
 
110
        for path, entry in self._blobs:
 
111
            if entry is None:
 
112
                del self._blobs[path]
93
113
 
94
114
    def commit(self, message):
95
115
        c = Commit()