~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/graph.py

  • Committer: Martin Pool
  • Date: 2011-02-07 01:39:42 UTC
  • mto: This revision was merged to the branch mainline in revision 5650.
  • Revision ID: mbp@canonical.com-20110207013942-roj88kez6jir13tr
Add brief user documentation of command line splitting

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    revision,
24
24
    trace,
25
25
    )
 
26
from bzrlib.symbol_versioning import deprecated_function, deprecated_in
26
27
 
27
28
STEP_UNIQUE_SEARCHER_EVERY = 5
28
29
 
63
64
        ancestry = self.ancestry
64
65
        return dict((k, ancestry[k]) for k in keys if k in ancestry)
65
66
 
 
67
@deprecated_function(deprecated_in((1, 16, 0)))
 
68
def _StackedParentsProvider(*args, **kwargs):
 
69
    return StackedParentsProvider(*args, **kwargs)
66
70
 
67
71
class StackedParentsProvider(object):
68
72
    """A parents provider which stacks (or unions) multiple providers.
1533
1537
 
1534
1538
 
1535
1539
class AbstractSearchResult(object):
1536
 
    """The result of a search, describing a set of keys.
1537
 
    
1538
 
    Search results are typically used as the 'fetch_spec' parameter when
1539
 
    fetching revisions.
1540
 
 
1541
 
    :seealso: AbstractSearch
1542
 
    """
1543
1540
 
1544
1541
    def get_recipe(self):
1545
1542
        """Return a recipe that can be used to replay this search.
1578
1575
 
1579
1576
 
1580
1577
class AbstractSearch(object):
1581
 
    """A search that can be executed, producing a search result.
1582
 
 
1583
 
    :seealso: AbstractSearchResult
1584
 
    """
1585
 
 
1586
 
    def execute(self):
 
1578
 
 
1579
    def get_search_result(self):
1587
1580
        """Construct a network-ready search result from this search description.
1588
1581
 
1589
1582
        This may take some time to search repositories, etc.
1590
1583
 
1591
 
        :return: A search result (an object that implements
1592
 
            AbstractSearchResult's API).
 
1584
        :return: A search result.
1593
1585
        """
1594
 
        raise NotImplementedError(self.execute)
 
1586
        raise NotImplementedError(self.get_search_result)
1595
1587
 
1596
1588
 
1597
1589
class SearchResult(AbstractSearchResult):
1713
1705
 
1714
1706
    def __repr__(self):
1715
1707
        if len(self.heads) > 5:
1716
 
            heads_repr = repr(list(self.heads)[:5])[:-1]
1717
 
            heads_repr += ', <%d more>...]' % (len(self.heads) - 5,)
 
1708
            heads_repr = repr(list(self.heads)[:5] + ', ...]')
1718
1709
        else:
1719
1710
            heads_repr = repr(self.heads)
1720
1711
        return '<%s heads:%s repo:%r>' % (
1822
1813
        self.from_repo = from_repo
1823
1814
        self.find_ghosts = find_ghosts
1824
1815
 
1825
 
    def execute(self):
 
1816
    def get_search_result(self):
1826
1817
        return self.to_repo.search_missing_revision_ids(
1827
1818
            self.from_repo, find_ghosts=self.find_ghosts)
1828
1819
 
1862
1853
            self.__class__.__name__, self.from_repo, self.to_repo,
1863
1854
            self.find_ghosts, reqd_revs_repr, ifp_revs_repr)
1864
1855
 
1865
 
    def execute(self):
 
1856
    def get_search_result(self):
1866
1857
        return self.to_repo.search_missing_revision_ids(
1867
1858
            self.from_repo, revision_ids=self.required_ids,
1868
1859
            if_present_ids=self.if_present_ids, find_ghosts=self.find_ghosts)