~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/graph.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-05-20 13:28:35 UTC
  • mfrom: (5852.1.11 fetch-limit)
  • Revision ID: pqm@pqm.ubuntu.com-20110520132835-3rf01eu5mbkz3zos
(jelmer) Add limit argument to Branch.fetch(). (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1849
1849
    """Find all revisions missing in one repo for a some specific heads."""
1850
1850
 
1851
1851
    def __init__(self, to_repo, from_repo, required_ids, if_present_ids=None,
1852
 
            find_ghosts=False):
 
1852
            find_ghosts=False, limit=None):
1853
1853
        """Constructor.
1854
1854
 
1855
1855
        :param required_ids: revision IDs of heads that must be found, or else
1859
1859
        :param if_present_ids: revision IDs of heads that may be absent in the
1860
1860
            source repository.  If present, then their ancestry not already
1861
1861
            found in other will be included in the search result.
 
1862
        :param limit: maximum number of revisions to fetch
1862
1863
        """
1863
1864
        self.to_repo = to_repo
1864
1865
        self.from_repo = from_repo
1865
1866
        self.find_ghosts = find_ghosts
1866
1867
        self.required_ids = required_ids
1867
1868
        self.if_present_ids = if_present_ids
 
1869
        self.limit = limit
1868
1870
 
1869
1871
    def __repr__(self):
1870
1872
        if len(self.required_ids) > 5:
1876
1878
        else:
1877
1879
            ifp_revs_repr = repr(self.if_present_ids)
1878
1880
 
1879
 
        return "<%s from:%r to:%r find_ghosts:%r req'd:%r if-present:%r>" % (
1880
 
            self.__class__.__name__, self.from_repo, self.to_repo,
1881
 
            self.find_ghosts, reqd_revs_repr, ifp_revs_repr)
 
1881
        return ("<%s from:%r to:%r find_ghosts:%r req'd:%r if-present:%r"
 
1882
                "limit:%r>") % (
 
1883
                self.__class__.__name__, self.from_repo, self.to_repo,
 
1884
                self.find_ghosts, reqd_revs_repr, ifp_revs_repr,
 
1885
                self.limit)
1882
1886
 
1883
1887
    def execute(self):
1884
1888
        return self.to_repo.search_missing_revision_ids(
1885
1889
            self.from_repo, revision_ids=self.required_ids,
1886
 
            if_present_ids=self.if_present_ids, find_ghosts=self.find_ghosts)
 
1890
            if_present_ids=self.if_present_ids, find_ghosts=self.find_ghosts,
 
1891
            limit=self.limit)
1887
1892
 
1888
1893
 
1889
1894
def collapse_linear_regions(parent_map):