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

  • Committer: Jelmer Vernooij
  • Date: 2019-03-04 00:16:27 UTC
  • mfrom: (7293 work)
  • mto: This revision was merged to the branch mainline in revision 7318.
  • Revision ID: jelmer@jelmer.uk-20190304001627-v6u7o6pf97tukhek
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
            needed_keys = set()
95
95
            next_parent_map.update(self._vf.get_parent_map(parent_lookup))
96
96
            for key, parent_keys in viewitems(next_parent_map):
97
 
                if parent_keys is None: # No graph versionedfile
 
97
                if parent_keys is None:  # No graph versionedfile
98
98
                    parent_keys = ()
99
99
                    next_parent_map[key] = ()
100
100
                self._update_needed_children(key, parent_keys)
101
101
                needed_keys.update([key for key in parent_keys
102
 
                                         if key not in parent_map])
 
102
                                    if key not in parent_map])
103
103
            parent_map.update(next_parent_map)
104
 
            # _heads_provider does some graph caching, so it is only valid while
105
 
            # self._parent_map hasn't changed
 
104
            # _heads_provider does some graph caching, so it is only valid
 
105
            # while self._parent_map hasn't changed
106
106
            self._heads_provider = None
107
107
        return vf_keys_needed, ann_keys_needed
108
108
 
118
118
        keys, ann_keys = self._get_needed_keys(key)
119
119
        if pb is not None:
120
120
            pb.update('getting stream', 0, len(keys))
121
 
        stream  = self._vf.get_record_stream(keys, 'topological', True)
 
121
        stream = self._vf.get_record_stream(keys, 'topological', True)
122
122
        for idx, record in enumerate(stream):
123
123
            if pb is not None:
124
124
                pb.update('extracting', 0, len(keys))
148
148
        parent_lines = self._text_cache[parent_key]
149
149
        parent_annotations = self._annotations_cache[parent_key]
150
150
        # PatienceSequenceMatcher should probably be part of Policy
151
 
        matcher = patiencediff.PatienceSequenceMatcher(None,
152
 
            parent_lines, text)
 
151
        matcher = patiencediff.PatienceSequenceMatcher(
 
152
            None, parent_lines, text)
153
153
        matching_blocks = matcher.get_matching_blocks()
154
154
        return parent_annotations, matching_blocks
155
155
 
157
157
        """Reannotate this text relative to its first parent."""
158
158
        (parent_annotations,
159
159
         matching_blocks) = self._get_parent_annotations_and_matches(
160
 
                                key, lines, parent_key)
 
160
             key, lines, parent_key)
161
161
 
162
162
        for parent_idx, lines_idx, match_len in matching_blocks:
163
163
            # For all matching regions we copy across the parent annotations
169
169
        """Reannotate this text relative to a second (or more) parent."""
170
170
        (parent_annotations,
171
171
         matching_blocks) = self._get_parent_annotations_and_matches(
172
 
                                key, lines, parent_key)
 
172
             key, lines, parent_key)
173
173
 
174
174
        last_ann = None
175
175
        last_parent = None
262
262
            lines the text of "key" as a list of lines
263
263
        """
264
264
        with ui.ui_factory.nested_progress_bar() as pb:
265
 
            for text_key, text, num_lines in self._get_needed_texts(key, pb=pb):
 
265
            for text_key, text, num_lines in self._get_needed_texts(
 
266
                    key, pb=pb):
266
267
                self._annotate_one(text_key, text, num_lines)
267
268
        try:
268
269
            annotations = self._annotations_cache[key]
306
307
            else:
307
308
                the_heads = heads(annotation)
308
309
                if len(the_heads) == 1:
309
 
                    for head in the_heads: break # get the item out of the set
 
310
                    for head in the_heads:
 
311
                        break  # get the item out of the set
310
312
                else:
311
313
                    head = self._resolve_annotation_tie(the_heads, line,
312
314
                                                        custom_tiebreaker)