/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/graph.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import time
20
20
 
21
 
from bzrlib import (
 
21
from . import (
22
22
    debug,
23
23
    errors,
24
24
    osutils,
365
365
        while cur_tip not in known_revnos:
366
366
            unknown_searched[cur_tip] = num_steps
367
367
            num_steps += 1
368
 
            to_search = set([cur_tip])
 
368
            to_search = {cur_tip}
369
369
            to_search.update(searching_known_tips)
370
370
            parent_map = self.get_parent_map(to_search)
371
371
            parents = parent_map.get(cur_tip, None)
828
828
            # NULL_REVISION is only a head if it is the only entry
829
829
            candidate_heads.remove(revision.NULL_REVISION)
830
830
            if not candidate_heads:
831
 
                return set([revision.NULL_REVISION])
 
831
                return {revision.NULL_REVISION}
832
832
        if len(candidate_heads) < 2:
833
833
            return candidate_heads
834
834
        searchers = dict((c, self._make_breadth_first_searcher([c]))
877
877
                if ancestor in common_walker.seen:
878
878
                    # some searcher has encountered our known common nodes:
879
879
                    # just stop it
880
 
                    ancestor_set = set([ancestor])
 
880
                    ancestor_set = {ancestor}
881
881
                    for searcher in searchers.itervalues():
882
882
                        searcher.stop_searching_any(ancestor_set)
883
883
                else:
1047
1047
        An ancestor may sort after a descendant if the relationship is not
1048
1048
        visible in the supplied list of revisions.
1049
1049
        """
1050
 
        from bzrlib import tsort
 
1050
        from breezy import tsort
1051
1051
        sorter = tsort.TopoSorter(self.get_parent_map(revisions))
1052
1052
        return sorter.iter_topo_order()
1053
1053
 
1058
1058
        smallest number of parent lookups to determine the ancestral
1059
1059
        relationship between N revisions.
1060
1060
        """
1061
 
        return set([candidate_descendant]) == self.heads(
 
1061
        return {candidate_descendant} == self.heads(
1062
1062
            [candidate_ancestor, candidate_descendant])
1063
1063
 
1064
1064
    def is_between(self, revid, lower_bound_revid, upper_bound_revid):
1377
1377
            static - the search can be advanced and the search result will not
1378
1378
            be invalidated or altered.
1379
1379
        """
1380
 
        from bzrlib.vf_search import SearchResult
 
1380
        from breezy.vf_search import SearchResult
1381
1381
        (started_keys, excludes, included_keys) = self.get_state()
1382
1382
        return SearchResult(started_keys, excludes, len(included_keys),
1383
1383
            included_keys)
1695
1695
        """See Graph.heads()"""
1696
1696
        as_keys = [(i,) for i in ids]
1697
1697
        head_keys = self._graph.heads(as_keys)
1698
 
        return set([h[0] for h in head_keys])
 
1698
        return {h[0] for h in head_keys}
1699
1699
 
1700
1700
    def merge_sort(self, tip_revision):
1701
1701
        nodes = self._graph.merge_sort((tip_revision,))
1709
1709
 
1710
1710
_counters = [0,0,0,0,0,0,0]
1711
1711
try:
1712
 
    from bzrlib._known_graph_pyx import KnownGraph
1713
 
except ImportError, e:
 
1712
    from ._known_graph_pyx import KnownGraph
 
1713
except ImportError as e:
1714
1714
    osutils.failed_to_load_extension(e)
1715
 
    from bzrlib._known_graph_py import KnownGraph
 
1715
    from ._known_graph_py import KnownGraph