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

  • Committer: Jelmer Vernooij
  • Date: 2018-12-18 20:55:37 UTC
  • mfrom: (7223 work)
  • mto: This revision was merged to the branch mainline in revision 7231.
  • Revision ID: jelmer@jelmer.uk-20181218205537-td8qyejigxki0xmn
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
409
409
                    store, from_dir.encode("utf-8"),
410
410
                    posixpath.basename(from_dir), mode, hexsha)
411
411
        if include_root:
412
 
            yield (from_dir, "V", root_ie.kind, root_ie.file_id, root_ie)
 
412
            yield (from_dir, "V", root_ie.kind, root_ie)
413
413
        todo = []
414
414
        if root_ie.kind == 'directory':
415
415
            todo.append((store, from_dir.encode("utf-8"),
431
431
                else:
432
432
                    ie = self._get_file_ie(
433
433
                        store, child_path, name, mode, hexsha, parent_id)
434
 
                yield (child_relpath.decode('utf-8'), "V", ie.kind, ie.file_id,
435
 
                       ie)
 
434
                yield (child_relpath.decode('utf-8'), "V", ie.kind, ie)
436
435
 
437
436
    def _get_file_ie(self, store, path, name, mode, hexsha, parent_id):
438
437
        if not isinstance(path, bytes):
461
460
        file_id = self._fileid_map.lookup_file_id(path)
462
461
        return GitTreeDirectory(file_id, posixpath.basename(path), parent_id)
463
462
 
464
 
    def iter_child_entries(self, path, file_id=None):
 
463
    def iter_child_entries(self, path):
465
464
        (store, mode, tree_sha) = self._lookup_path(path)
466
465
 
467
466
        if mode is not None and not stat.S_ISDIR(mode):
680
679
    if target_extras is None:
681
680
        target_extras = set()
682
681
    ret = delta.TreeDelta()
 
682
    added = []
683
683
    for (oldpath, newpath), (oldmode, newmode), (oldsha, newsha) in changes:
684
684
        if newpath == b'' and not include_root:
685
685
            continue
706
706
        if oldpath is None and newpath is None:
707
707
            continue
708
708
        if oldpath is None:
709
 
            if newpath in target_extras:
710
 
                ret.unversioned.append(
711
 
                    (osutils.normalized_filename(newpath)[0], None,
712
 
                     mode_kind(newmode)))
713
 
            else:
714
 
                file_id = new_fileid_map.lookup_file_id(newpath_decoded)
715
 
                ret.added.append(
716
 
                    (newpath_decoded, file_id, mode_kind(newmode)))
 
709
            added.append((newpath, mode_kind(newmode)))
717
710
        elif newpath is None or newmode == 0:
718
711
            file_id = old_fileid_map.lookup_file_id(oldpath_decoded)
719
712
            ret.removed.append((oldpath_decoded, file_id, mode_kind(oldmode)))
740
733
            ret.unchanged.append(
741
734
                (newpath_decoded, file_id, mode_kind(newmode)))
742
735
 
 
736
    implicit_dirs = {b''}
 
737
    for path, kind in added:
 
738
        if kind == 'directory' or path in target_extras:
 
739
            continue
 
740
        implicit_dirs.update(osutils.parent_directories(path))
 
741
 
 
742
    for path, kind in added:
 
743
        if kind == 'directory' and path not in implicit_dirs:
 
744
            continue
 
745
        path_decoded = osutils.normalized_filename(path)[0]
 
746
        if path in target_extras:
 
747
            ret.unversioned.append((path_decoded, None, kind))
 
748
        else:
 
749
            file_id = new_fileid_map.lookup_file_id(path_decoded)
 
750
            ret.added.append((path_decoded, file_id, kind))
 
751
 
743
752
    return ret
744
753
 
745
754