/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-06-03 23:48:08 UTC
  • mfrom: (7316 work)
  • mto: This revision was merged to the branch mainline in revision 7328.
  • Revision ID: jelmer@jelmer.uk-20190603234808-15yk5c7054tj8e2b
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
332
332
        except KeyError:
333
333
            pass
334
334
        # FIXME: Should be the same as in parent
335
 
        if ie.kind in ("file", "symlink"):
 
335
        if ie.kind == "file":
336
336
            try:
337
337
                return idmap.lookup_blob_id(ie.file_id, ie.revision)
338
338
            except KeyError:
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
 
345
        elif ie.kind == "symlink":
 
346
            try:
 
347
                return idmap.lookup_blob_id(ie.file_id, ie.revision)
 
348
            except KeyError:
 
349
                # no-change merge ?
 
350
                target = tree.get_symlink_target(path)
 
351
                blob = symlink_to_blob(target)
 
352
                if add_cache_entry is not None:
 
353
                    add_cache_entry(blob, (ie.file_id, ie.revision), path)
 
354
                return blob.id
345
355
        elif ie.kind == "directory":
346
356
            # Not all cache backends store the tree information,
347
357
            # calculate again from scratch
361
371
        if tree.kind(path) != 'directory':
362
372
            continue
363
373
 
364
 
        obj = Tree()
365
 
        for value in tree.iter_child_entries(path):
366
 
            if value.name in BANNED_FILENAMES:
367
 
                trace.warning('not exporting %s with banned filename %s',
368
 
                              value.kind, value.name)
369
 
                continue
370
 
            child_path = osutils.pathjoin(path, value.name)
371
 
            try:
372
 
                mode = unusual_modes[child_path]
373
 
            except KeyError:
374
 
                mode = entry_mode(value)
375
 
            hexsha = ie_to_hexsha(child_path, value)
376
 
            if hexsha is not None:
377
 
                obj.add(value.name.encode("utf-8"), mode, hexsha)
 
374
        obj = directory_to_tree(
 
375
            path, tree.iter_child_entries(path), ie_to_hexsha, unusual_modes,
 
376
            dummy_file_name, path == '')
378
377
 
379
 
        if len(obj) > 0:
 
378
        if obj is not None:
380
379
            file_id = tree.path2id(path)
381
380
            if add_cache_entry is not None:
382
381
                add_cache_entry(obj, (file_id, tree.get_revision_id()), path)