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

Support Git rename tracking.

Merged from https://code.launchpad.net/~jelmer/brz/renames/+merge/381006

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
        self.store = self.repository._git.object_store
70
70
        self._blobs = {}
71
71
        self._inv_delta = []
 
72
        self._deleted_paths = set()
72
73
        self._any_changes = False
73
74
        self._mapping = self.repository.get_mapping()
74
75
 
92
93
            self._any_changes = True
93
94
            if change.path[1] is None:
94
95
                self._inv_delta.append((change.path[0], change.path[1], change.file_id, None))
95
 
                self._blobs[change.path[0].encode("utf-8")] = None
 
96
                self._deleted_paths.add(change.path[0].encode("utf-8"))
96
97
                continue
97
98
            try:
98
99
                entry_kls = entry_factory[change.kind[1]]
128
129
                raise AssertionError("Unknown kind %r" % change.kind[1])
129
130
            mode = object_mode(change.kind[1], change.executable[1])
130
131
            self._inv_delta.append((change.path[0], change.path[1], change.file_id, entry))
131
 
            encoded_new_path = change.path[1].encode("utf-8")
132
 
            self._blobs[encoded_new_path] = (mode, sha)
 
132
            if change.path[0] is not None:
 
133
                self._deleted_paths.add(change.path[0].encode("utf-8"))
 
134
            self._blobs[change.path[1].encode("utf-8")] = (mode, sha)
133
135
            if st is not None:
134
136
                yield change.path[1], (entry.text_sha1, st)
135
137
        if not seen_root and len(self.parents) == 0:
146
148
        for entry in basis_tree._iter_tree_contents(include_trees=False):
147
149
            if entry.path in self._blobs:
148
150
                continue
 
151
            if entry.path in self._deleted_paths:
 
152
                continue
149
153
            self._blobs[entry.path] = (entry.mode, entry.sha)
150
154
        self.new_inventory = None
151
155
 
155
159
 
156
160
    def finish_inventory(self):
157
161
        # eliminate blobs that were removed
158
 
        self._blobs = {k: v for (k, v) in viewitems(
159
 
            self._blobs) if v is not None}
 
162
        self._blobs = {k: v for (k, v) in viewitems(self._blobs)}
160
163
 
161
164
    def _iterblobs(self):
162
165
        return ((path, sha, mode) for (path, (mode, sha))