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

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-06-15 17:53:40 UTC
  • mfrom: (7322.1.8 objects-1)
  • Revision ID: breezy.the.bot@gmail.com-20190615175340-yxo036zu96wh8lcz
Use the new attributes on TreeChange rather than indexing.

Merged from https://code.launchpad.net/~jelmer/brz/objects-1/+merge/368859

Show diffs side-by-side

added added

removed removed

Lines of Context:
249
249
        raise KeyError
250
250
 
251
251
    # Find all the changed blobs
252
 
    for (file_id, path, changed_content, versioned, parent, name, kind,
253
 
         executable) in tree.iter_changes(base_tree):
254
 
        if name[1] in BANNED_FILENAMES:
 
252
    for change in tree.iter_changes(base_tree):
 
253
        if change.name[1] in BANNED_FILENAMES:
255
254
            continue
256
 
        if kind[1] == "file":
257
 
            sha1 = tree.get_file_sha1(path[1])
 
255
        if change.kind[1] == "file":
 
256
            sha1 = tree.get_file_sha1(change.path[1])
258
257
            blob_id = None
259
258
            try:
260
259
                (pfile_id, prevision) = find_unchanged_parent_ie(
261
 
                    file_id, kind[1], sha1, other_parent_trees)
 
260
                    change.file_id, change.kind[1], sha1, other_parent_trees)
262
261
            except KeyError:
263
262
                pass
264
263
            else:
271
270
                    if not changed_content:
272
271
                        # no-change merge ?
273
272
                        blob = Blob()
274
 
                        blob.data = tree.get_file_text(path[1])
 
273
                        blob.data = tree.get_file_text(change.path[1])
275
274
                        blob_id = blob.id
276
275
            if blob_id is None:
277
 
                new_blobs.append((path[1], file_id))
 
276
                new_blobs.append((change.path[1], change.file_id))
278
277
            else:
279
278
                shamap[path[1]] = blob_id
280
279
                if add_cache_entry is not None:
281
280
                    add_cache_entry(
282
281
                        ("blob", blob_id),
283
 
                        (file_id, tree.get_file_revision(path[1])), path[1])
284
 
        elif kind[1] == "symlink":
285
 
            target = tree.get_symlink_target(path[1])
 
282
                        (file_id, tree.get_file_revision(change.path[1])), change.path[1])
 
283
        elif change.kind[1] == "symlink":
 
284
            target = tree.get_symlink_target(change.path[1])
286
285
            blob = symlink_to_blob(target)
287
 
            shamap[path[1]] = blob.id
 
286
            shamap[change.path[1]] = blob.id
288
287
            if add_cache_entry is not None:
289
288
                add_cache_entry(
290
 
                    blob, (file_id, tree.get_file_revision(path[1])), path[1])
 
289
                    blob, (change.file_id, tree.get_file_revision(change.path[1])), change.path[1])
291
290
            try:
292
291
                find_unchanged_parent_ie(
293
 
                    file_id, kind[1], target, other_parent_trees)
 
292
                    change.file_id, change.kind[1], target, other_parent_trees)
294
293
            except KeyError:
295
 
                if changed_content:
296
 
                    yield (path[1], blob,
297
 
                           (file_id, tree.get_file_revision(path[1])))
298
 
        elif kind[1] is None:
299
 
            shamap[path[1]] = None
300
 
        elif kind[1] != 'directory':
301
 
            raise AssertionError(kind[1])
302
 
        for p in path:
 
294
                if change.changed_content:
 
295
                    yield (change.path[1], blob,
 
296
                           (change.file_id, tree.get_file_revision(change.path[1])))
 
297
        elif change.kind[1] is None:
 
298
            shamap[change.path[1]] = None
 
299
        elif change.kind[1] != 'directory':
 
300
            raise AssertionError(change.kind[1])
 
301
        for p in change.path:
303
302
            if p is None:
304
303
                continue
305
304
            dirty_dirs.add(osutils.dirname(p))