/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: Jelmer Vernooij
  • Date: 2019-05-29 03:28:14 UTC
  • mfrom: (7303 work)
  • mto: This revision was merged to the branch mainline in revision 7305.
  • Revision ID: jelmer@jelmer.uk-20190529032814-fzqbrgf9647u9ptq
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
    NULL_REVISION,
48
48
    )
49
49
from ..sixish import viewitems
50
 
from ..testament import (
 
50
from ..bzr.testament import (
51
51
    StrictTestament3,
52
52
    )
53
53
 
235
235
            except errors.NoSuchId:
236
236
                pass
237
237
            else:
238
 
                pkind = ptree.kind(ppath, file_id)
 
238
                pkind = ptree.kind(ppath)
239
239
                if kind == "file":
240
240
                    if (pkind == "file" and
241
 
                            ptree.get_file_sha1(ppath, file_id) == other):
 
241
                            ptree.get_file_sha1(ppath) == other):
242
242
                        return (
243
 
                            file_id, ptree.get_file_revision(ppath, file_id))
 
243
                            file_id, ptree.get_file_revision(ppath))
244
244
                if kind == "symlink":
245
245
                    if (pkind == "symlink" and
246
 
                            ptree.get_symlink_target(ppath, file_id) == other):
 
246
                            ptree.get_symlink_target(ppath) == other):
247
247
                        return (
248
 
                            file_id, ptree.get_file_revision(ppath, file_id))
 
248
                            file_id, ptree.get_file_revision(ppath))
249
249
        raise KeyError
250
250
 
251
251
    # Find all the changed blobs
254
254
        if name[1] in BANNED_FILENAMES:
255
255
            continue
256
256
        if kind[1] == "file":
257
 
            sha1 = tree.get_file_sha1(path[1], file_id)
 
257
            sha1 = tree.get_file_sha1(path[1])
258
258
            blob_id = None
259
259
            try:
260
260
                (pfile_id, prevision) = find_unchanged_parent_ie(
271
271
                    if not changed_content:
272
272
                        # no-change merge ?
273
273
                        blob = Blob()
274
 
                        blob.data = tree.get_file_text(path[1], file_id)
 
274
                        blob.data = tree.get_file_text(path[1])
275
275
                        blob_id = blob.id
276
276
            if blob_id is None:
277
277
                new_blobs.append((path[1], file_id))
282
282
                        ("blob", blob_id),
283
283
                        (file_id, tree.get_file_revision(path[1])), path[1])
284
284
        elif kind[1] == "symlink":
285
 
            target = tree.get_symlink_target(path[1], file_id)
 
285
            target = tree.get_symlink_target(path[1])
286
286
            blob = symlink_to_blob(target)
287
287
            shamap[path[1]] = blob.id
288
288
            if add_cache_entry is not None:
294
294
            except KeyError:
295
295
                if changed_content:
296
296
                    yield (path[1], blob,
297
 
                           (file_id, tree.get_file_revision(path[1], file_id)))
 
297
                           (file_id, tree.get_file_revision(path[1])))
298
298
        elif kind[1] is None:
299
299
            shamap[path[1]] = None
300
300
        elif kind[1] != 'directory':
338
338
            except KeyError:
339
339
                # no-change merge ?
340
340
                blob = Blob()
341
 
                blob.data = tree.get_file_text(path, ie.file_id)
 
341
                blob.data = tree.get_file_text(path)
342
342
                if add_cache_entry is not None:
343
343
                    add_cache_entry(blob, (ie.file_id, ie.revision), path)
344
344
                return blob.id
359
359
            continue
360
360
 
361
361
        if tree.kind(path) != 'directory':
362
 
            raise AssertionError
 
362
            continue
363
363
 
364
364
        obj = Tree()
365
365
        for value in tree.iter_child_entries(path):
589
589
        for (file_id, revision, expected_sha), chunks in stream:
590
590
            blob = Blob()
591
591
            blob.chunked = chunks
592
 
            if blob.id != expected_sha and blob.data == "":
 
592
            if blob.id != expected_sha and blob.data == b"":
593
593
                # Perhaps it's a symlink ?
594
594
                tree = self.tree_cache.revision_tree(revision)
595
595
                path = tree.id2path(file_id)
596
 
                if tree.kind(path, file_id) == 'symlink':
597
 
                    blob = symlink_to_blob(
598
 
                        tree.get_symlink_target(path, file_id))
 
596
                if tree.kind(path) == 'symlink':
 
597
                    blob = symlink_to_blob(tree.get_symlink_target(path))
599
598
            _check_expected_sha(expected_sha, blob)
600
599
            yield blob
601
600