/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-16 19:47:19 UTC
  • mfrom: (7178 work)
  • mto: This revision was merged to the branch mainline in revision 7179.
  • Revision ID: jelmer@jelmer.uk-20181116194719-m5ut2wfuze5x9s1p
Merge trunk.

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
 
                    raise ValueError('Parent key mismatch, existing node %s'
 
168
                    raise ValueError(
 
169
                        'Parent key mismatch, existing node %s'
169
170
                        ' has parents of %s not %s'
170
171
                        % (key, existing_parent_keys, parent_keys))
171
172
        else:
319
320
 
320
321
        result = []
321
322
        for prefix in sorted(prefix_tips):
322
 
            pending = sorted(prefix_tips[prefix], key=lambda n:n.key,
 
323
            pending = sorted(prefix_tips[prefix], key=lambda n: n.key,
323
324
                             reverse=True)
324
325
            while pending:
325
326
                node = pending.pop()
344
345
        from breezy import tsort
345
346
        as_parent_map = dict((node.key, node.parent_keys)
346
347
                             for node in viewvalues(self._nodes)
347
 
                              if node.parent_keys is not None)
 
348
                             if node.parent_keys is not None)
348
349
        # We intentionally always generate revnos and never force the
349
350
        # mainline_revisions
350
351
        # Strip the sequence_number that merge_sort generates
351
352
        return [_MergeSortNode(key, merge_depth, revno, end_of_merge)
352
353
                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
 
    
 
354
                in tsort.merge_sort(as_parent_map, tip_key,
 
355
                                    mainline_revisions=None,
 
356
                                    generate_revno=True)]
 
357
 
357
358
    def get_parent_keys(self, key):
358
359
        """Get the parents for a key
359
 
        
 
360
 
360
361
        Returns a list containg the parents keys. If the key is a ghost,
361
362
        None is returned. A KeyError will be raised if the key is not in
362
363
        the graph.
363
 
        
 
364
 
364
365
        :param keys: Key to check (eg revision_id)
365
366
        :return: A list of parents
366
367
        """
368
369
 
369
370
    def get_child_keys(self, key):
370
371
        """Get the children for a key
371
 
        
 
372
 
372
373
        Returns a list containg the children keys. A KeyError will be raised
373
374
        if the key is not in the graph.
374
 
        
 
375
 
375
376
        :param keys: Key to check (eg revision_id)
376
377
        :return: A list of children
377
378
        """