/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: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Implementation of Graph algorithms when we have already loaded everything.
18
18
"""
19
19
 
20
 
from __future__ import absolute_import
21
 
 
22
 
import collections
 
20
try:
 
21
    from collections.abc import deque
 
22
except ImportError:  # python < 3.7
 
23
    from collections import deque
23
24
from . import (
24
25
    errors,
25
26
    revision,
26
27
    )
27
 
from .sixish import (
28
 
    viewitems,
29
 
    viewvalues,
30
 
    )
31
28
 
32
29
 
33
30
class _KnownGraphNode(object):
85
82
          child_keys,
86
83
        """
87
84
        nodes = self._nodes
88
 
        for key, parent_keys in viewitems(parent_map):
 
85
        for key, parent_keys in parent_map.items():
89
86
            if key in nodes:
90
87
                node = nodes[key]
91
88
                node.parent_keys = parent_keys
101
98
                parent_node.child_keys.append(key)
102
99
 
103
100
    def _find_tails(self):
104
 
        return [node for node in viewvalues(self._nodes)
 
101
        return [node for node in self._nodes.values()
105
102
                if not node.parent_keys]
106
103
 
107
104
    def _find_tips(self):
108
 
        return [node for node in viewvalues(self._nodes)
 
105
        return [node for node in self._nodes.values()
109
106
                if not node.child_keys]
110
107
 
111
108
    def _find_gdfo(self):
193
190
        # We use a deque rather than a simple list stack, to go for BFD rather
194
191
        # than DFD. So that if a longer path is possible, we walk it before we
195
192
        # get to the final child
196
 
        pending = collections.deque([node])
 
193
        pending = deque([node])
197
194
        while pending:
198
195
            node = pending.popleft()
199
196
            next_gdfo = node.gdfo + 1
239
236
        seen = set()
240
237
        pending = []
241
238
        min_gdfo = None
242
 
        for node in viewvalues(candidate_nodes):
 
239
        for node in candidate_nodes.values():
243
240
            if node.parent_keys:
244
241
                pending.extend(node.parent_keys)
245
242
            if min_gdfo is None or node.gdfo < min_gdfo:
266
263
 
267
264
        All parents must occur before all children.
268
265
        """
269
 
        for node in viewvalues(self._nodes):
 
266
        for node in self._nodes.values():
270
267
            if node.gdfo is None:
271
268
                raise errors.GraphCycleError(self._nodes)
272
269
        pending = self._find_tails()
344
341
        """Compute the merge sorted graph output."""
345
342
        from breezy import tsort
346
343
        as_parent_map = dict((node.key, node.parent_keys)
347
 
                             for node in viewvalues(self._nodes)
 
344
                             for node in self._nodes.values()
348
345
                             if node.parent_keys is not None)
349
346
        # We intentionally always generate revnos and never force the
350
347
        # mainline_revisions