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

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-07-25 18:15:53 UTC
  • mfrom: (7045.4.7 python3-s)
  • Revision ID: breezy.the.bot@gmail.com-20180725181553-mz6zhncntlovb8ii
Fix another couple of hundred tests on Python 3.

Merged from https://code.launchpad.net/~jelmer/brz/python3-s/+merge/350749

Show diffs side-by-side

added added

removed removed

Lines of Context:
602
602
        except KeyError:
603
603
            return False
604
604
        try:
605
 
            tree_lookup_path(self.store.__getitem__, root_tree, path)
 
605
            tree_lookup_path(self.store.__getitem__, root_tree, path.encode('utf-8'))
606
606
        except KeyError:
607
607
            return False
608
608
        else:
613
613
        try:
614
614
            return self._lstat(path).st_mtime
615
615
        except OSError as e:
616
 
            (num, msg) = e
617
 
            if num == errno.ENOENT:
 
616
            if e.errno == errno.ENOENT:
618
617
                raise errors.NoSuchFile(path)
619
618
            raise
620
619
 
697
696
            try:
698
697
                return osutils.sha_file_by_name(abspath)
699
698
            except OSError as e:
700
 
                (num, msg) = e
701
 
                if num in (errno.EISDIR, errno.ENOENT):
 
699
                if e.errno in (errno.EISDIR, errno.ENOENT):
702
700
                    return None
703
701
                raise
704
702
 
841
839
            found_any = False
842
840
            seen_children = set()
843
841
            for item_path, value in self.index.iteritems():
 
842
                decoded_item_path = item_path.decode('utf-8')
844
843
                if self.mapping.is_special_file(item_path):
845
844
                    continue
846
 
                if not osutils.is_inside(encoded_path, item_path):
 
845
                if not osutils.is_inside(path, decoded_item_path):
847
846
                    continue
848
847
                found_any = True
849
 
                subpath = posixpath.relpath(item_path, encoded_path)
850
 
                if b'/' in subpath:
851
 
                    dirname = subpath.split(b'/', 1)[0]
 
848
                subpath = posixpath.relpath(decoded_item_path, path)
 
849
                if '/' in subpath:
 
850
                    dirname = subpath.split('/', 1)[0]
852
851
                    file_ie = self._get_dir_ie(posixpath.join(path, dirname), parent_id)
853
852
                else:
854
 
                    (parent, name) = posixpath.split(item_path)
 
853
                    (unused_parent, name) = posixpath.split(decoded_item_path)
855
854
                    file_ie = self._get_file_ie(
856
 
                            name.decode('utf-8'),
857
 
                            item_path.decode('utf-8'), value, parent_id)
 
855
                        name, decoded_item_path, value, parent_id)
858
856
                yield file_ie
859
857
            if not found_any and path != u'':
860
858
                raise errors.NoSuchFile(path)
1113
1111
                        parent_tree.get_file_revision(parent_path))
1114
1112
                    if parent_text_key not in maybe_file_parent_keys:
1115
1113
                        maybe_file_parent_keys.append(parent_text_key)
1116
 
            graph = self.branch.repository.get_file_graph()
 
1114
            # Now we have the parents of this content
 
1115
            from breezy.annotate import Annotator
 
1116
            from .annotate import AnnotateProvider
 
1117
            annotate_provider = AnnotateProvider(
 
1118
                self.branch.repository._file_change_scanner)
 
1119
            annotator = Annotator(annotate_provider)
 
1120
 
 
1121
            from breezy.graph import Graph
 
1122
            graph = Graph(annotate_provider)
1117
1123
            heads = graph.heads(maybe_file_parent_keys)
1118
1124
            file_parent_keys = []
1119
1125
            for key in maybe_file_parent_keys:
1120
1126
                if key in heads:
1121
1127
                    file_parent_keys.append(key)
1122
1128
 
1123
 
            # Now we have the parents of this content
1124
 
            from breezy.annotate import Annotator
1125
 
            from .annotate import AnnotateProvider
1126
 
            annotator = Annotator(AnnotateProvider(
1127
 
                self.branch.repository._file_change_scanner))
1128
1129
            text = self.get_file_text(path)
1129
1130
            this_key = (path, default_revision)
1130
1131
            annotator.add_special_text(this_key, file_parent_keys, text)
1163
1164
                    else:
1164
1165
                        # Let's at least try to use the working tree file:
1165
1166
                        try:
1166
 
                            st = self._lstat(self.abspath(entry.path))
 
1167
                            st = self._lstat(self.abspath(entry.path.decode('utf-8')))
1167
1168
                        except OSError:
1168
1169
                            # But if it doesn't exist, we'll make something up.
1169
1170
                            obj = self.store[entry.sha]