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

  • Committer: Jelmer Vernooij
  • Date: 2018-11-11 04:08:32 UTC
  • mto: (7143.16.20 even-more-cleanups)
  • mto: This revision was merged to the branch mainline in revision 7175.
  • Revision ID: jelmer@jelmer.uk-20181111040832-nsljjynzzwmznf3h
Run autopep8.

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
 
107
107
    def _find_tips(self):
108
108
        return [node for node in viewvalues(self._nodes)
109
 
                      if not node.child_keys]
 
109
                if not node.child_keys]
110
110
 
111
111
    def _find_gdfo(self):
112
112
        nodes = self._nodes
144
144
 
145
145
        If this fills in a ghost, then the gdfos of all children will be
146
146
        updated accordingly.
147
 
        
 
147
 
148
148
        :param key: The node being added. If this is a duplicate, this is a
149
149
            no-op.
150
150
        :param parent_keys: The parents of the given node.
163
163
                parent_keys = list(parent_keys)
164
164
                existing_parent_keys = list(node.parent_keys)
165
165
                if parent_keys == existing_parent_keys:
166
 
                    return # Identical content
 
166
                    return  # Identical content
167
167
                else:
168
168
                    raise ValueError('Parent key mismatch, existing node %s'
169
 
                        ' has parents of %s not %s'
170
 
                        % (key, existing_parent_keys, parent_keys))
 
169
                                     ' has parents of %s not %s'
 
170
                                     % (key, existing_parent_keys, parent_keys))
171
171
        else:
172
172
            node = _KnownGraphNode(key, parent_keys)
173
173
            nodes[key] = node
319
319
 
320
320
        result = []
321
321
        for prefix in sorted(prefix_tips):
322
 
            pending = sorted(prefix_tips[prefix], key=lambda n:n.key,
 
322
            pending = sorted(prefix_tips[prefix], key=lambda n: n.key,
323
323
                             reverse=True)
324
324
            while pending:
325
325
                node = pending.pop()
344
344
        from breezy import tsort
345
345
        as_parent_map = dict((node.key, node.parent_keys)
346
346
                             for node in viewvalues(self._nodes)
347
 
                              if node.parent_keys is not None)
 
347
                             if node.parent_keys is not None)
348
348
        # We intentionally always generate revnos and never force the
349
349
        # mainline_revisions
350
350
        # Strip the sequence_number that merge_sort generates
351
351
        return [_MergeSortNode(key, merge_depth, revno, end_of_merge)
352
352
                for _, key, merge_depth, revno, end_of_merge
353
 
                 in tsort.merge_sort(as_parent_map, tip_key,
354
 
                                     mainline_revisions=None,
355
 
                                     generate_revno=True)]
356
 
    
 
353
                in tsort.merge_sort(as_parent_map, tip_key,
 
354
                                    mainline_revisions=None,
 
355
                                    generate_revno=True)]
 
356
 
357
357
    def get_parent_keys(self, key):
358
358
        """Get the parents for a key
359
 
        
 
359
 
360
360
        Returns a list containg the parents keys. If the key is a ghost,
361
361
        None is returned. A KeyError will be raised if the key is not in
362
362
        the graph.
363
 
        
 
363
 
364
364
        :param keys: Key to check (eg revision_id)
365
365
        :return: A list of parents
366
366
        """
368
368
 
369
369
    def get_child_keys(self, key):
370
370
        """Get the children for a key
371
 
        
 
371
 
372
372
        Returns a list containg the children keys. A KeyError will be raised
373
373
        if the key is not in the graph.
374
 
        
 
374
 
375
375
        :param keys: Key to check (eg revision_id)
376
376
        :return: A list of children
377
377
        """