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

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-11-16 18:59:44 UTC
  • mfrom: (7143.15.15 more-cleanups)
  • Revision ID: breezy.the.bot@gmail.com-20181116185944-biefv1sub37qfybm
Sprinkle some PEP8iness.

Merged from https://code.launchpad.net/~jelmer/brz/more-cleanups/+merge/358611

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    tree_lookup_path,
23
23
    )
24
24
 
25
 
from ..errors import UnavailableRepresentation
 
25
from ..errors import (
 
26
    NoSuchRevision,
 
27
    UnavailableRepresentation,
 
28
    )
26
29
from ..graph import Graph
27
30
from ..revision import (
28
31
    NULL_REVISION,
59
62
        elif storage_kind == 'chunked':
60
63
            return self.store[self.blob_id].as_raw_chunks()
61
64
        raise UnavailableRepresentation(self.key, storage_kind,
62
 
                'fulltext')
 
65
                                        'fulltext')
63
66
 
64
67
 
65
68
class GitAbsentContentFactory(object):
93
96
        self.store = self.change_scanner.repository._git.object_store
94
97
 
95
98
    def _get_parents(self, path, text_revision):
96
 
        commit_id, mapping = self.change_scanner.repository.lookup_bzr_revision_id(
97
 
            text_revision)
 
99
        commit_id, mapping = (
 
100
            self.change_scanner.repository.lookup_bzr_revision_id(
 
101
                text_revision))
98
102
        text_parents = []
99
103
        for commit_parent in self.store[commit_id].parents:
100
104
            try:
101
 
                (path, text_parent) = self.change_scanner.find_last_change_revision(path.encode('utf-8'), commit_parent)
 
105
                (path, text_parent) = (
 
106
                    self.change_scanner.find_last_change_revision(
 
107
                        path.encode('utf-8'), commit_parent))
102
108
            except KeyError:
103
109
                continue
104
110
            if text_parent not in text_parents:
105
111
                text_parents.append(text_parent)
106
 
        return tuple([(path.decode('utf-8'),
107
 
            self.change_scanner.repository.lookup_foreign_revision_id(p)) for p
108
 
            in text_parents])
 
112
        return tuple([
 
113
            (path.decode('utf-8'),
 
114
                self.change_scanner.repository.lookup_foreign_revision_id(p))
 
115
            for p in text_parents])
109
116
 
110
117
    def get_parent_map(self, keys):
111
118
        ret = {}
127
134
        store = self.change_scanner.repository._git.object_store
128
135
        for (path, text_revision) in keys:
129
136
            try:
130
 
                commit_id, mapping = self.change_scanner.repository.lookup_bzr_revision_id(
131
 
                    text_revision)
132
 
            except errors.NoSuchRevision:
 
137
                commit_id, mapping = (
 
138
                    self.change_scanner.repository.lookup_bzr_revision_id(
 
139
                        text_revision))
 
140
            except NoSuchRevision:
133
141
                yield GitAbsentContentFactory(store, path, text_revision)
134
142
                continue
135
143
 
139
147
                yield GitAbsentContentFactory(store, path, text_revision)
140
148
                continue
141
149
            try:
142
 
                (mode, blob_sha) = tree_lookup_path(store.__getitem__, tree_id, path.encode('utf-8'))
 
150
                (mode, blob_sha) = tree_lookup_path(
 
151
                    store.__getitem__, tree_id, path.encode('utf-8'))
143
152
            except KeyError:
144
153
                yield GitAbsentContentFactory(store, path, text_revision)
145
154
            else:
146
 
                yield GitFulltextContentFactory(store, path, text_revision, blob_sha)
 
155
                yield GitFulltextContentFactory(
 
156
                    store, path, text_revision, blob_sha)