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

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-07-15 10:19:11 UTC
  • mfrom: (7027.5.4 python3-git-more)
  • Revision ID: breezy.the.bot@gmail.com-20180715101911-hmg5n20a7ifuv7uk
Fix some more git-specific tests on Python 3.

Merged from https://code.launchpad.net/~jelmer/brz/python3-git-more/+merge/349623

Show diffs side-by-side

added added

removed removed

Lines of Context:
477
477
                specific_files = None
478
478
            else:
479
479
                specific_files = set([p.encode('utf-8') for p in specific_files])
480
 
        todo = [(self.store, "", self.tree, None)]
 
480
        todo = [(self.store, b"", self.tree, None)]
481
481
        while todo:
482
482
            store, path, tree_sha, parent_id = todo.pop()
483
483
            ie = self._get_dir_ie(path, parent_id)
623
623
    for (oldpath, newpath), (oldmode, newmode), (oldsha, newsha) in changes:
624
624
        if newpath == b'' and not include_root:
625
625
            continue
 
626
        if oldpath is None:
 
627
            oldpath_encoded = None
 
628
        else:
 
629
            oldpath_decoded = oldpath.decode('utf-8')
 
630
        if newpath is None:
 
631
            newpath_decoded = None
 
632
        else:
 
633
            newpath_decoded = newpath.decode('utf-8')
626
634
        if not (specific_files is None or
627
 
                (oldpath is not None and osutils.is_inside_or_parent_of_any(specific_files, oldpath)) or
628
 
                (newpath is not None and osutils.is_inside_or_parent_of_any(specific_files, newpath))):
 
635
                (oldpath is not None and osutils.is_inside_or_parent_of_any(specific_files, oldpath_decoded)) or
 
636
                (newpath is not None and osutils.is_inside_or_parent_of_any(specific_files, newpath_decoded))):
629
637
            continue
630
638
        if mapping.is_special_file(oldpath):
631
639
            oldpath = None
638
646
                ret.unversioned.append(
639
647
                    (osutils.normalized_filename(newpath)[0], None, mode_kind(newmode)))
640
648
            else:
641
 
                newpath_decoded = newpath.decode('utf-8')
642
649
                file_id = new_fileid_map.lookup_file_id(newpath_decoded)
643
650
                ret.added.append((newpath_decoded, file_id, mode_kind(newmode)))
644
651
        elif newpath is None or newmode == 0:
645
 
            oldpath_decoded = oldpath.decode('utf-8')
646
652
            file_id = old_fileid_map.lookup_file_id(oldpath_decoded)
647
653
            ret.removed.append((oldpath_decoded, file_id, mode_kind(oldmode)))
648
654
        elif oldpath != newpath:
649
 
            oldpath_decoded = oldpath.decode('utf-8')
650
655
            file_id = old_fileid_map.lookup_file_id(oldpath_decoded)
651
656
            ret.renamed.append(
652
657
                (oldpath_decoded, newpath.decode('utf-8'), file_id,
653
658
                mode_kind(newmode), (oldsha != newsha),
654
659
                (oldmode != newmode)))
655
660
        elif mode_kind(oldmode) != mode_kind(newmode):
656
 
            newpath_decoded = newpath.decode('utf-8')
657
661
            file_id = new_fileid_map.lookup_file_id(newpath_decoded)
658
662
            ret.kind_changed.append(
659
663
                (newpath_decoded, file_id, mode_kind(oldmode),
661
665
        elif oldsha != newsha or oldmode != newmode:
662
666
            if stat.S_ISDIR(oldmode) and stat.S_ISDIR(newmode):
663
667
                continue
664
 
            newpath_decoded = newpath.decode('utf-8')
665
668
            file_id = new_fileid_map.lookup_file_id(newpath_decoded)
666
669
            ret.modified.append(
667
670
                (newpath, file_id, mode_kind(newmode),
668
671
                (oldsha != newsha), (oldmode != newmode)))
669
672
        else:
670
 
            newpath_decoded = newpath.decode('utf-8')
671
673
            file_id = new_fileid_map.lookup_file_id(newpath_decoded)
672
674
            ret.unchanged.append((newpath, file_id, mode_kind(newmode)))
673
675