~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/vf_repository.py

  • Committer: John Arbash Meinel
  • Date: 2011-05-26 08:05:45 UTC
  • mfrom: (5916 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5917.
  • Revision ID: john@arbash-meinel.com-20110526080545-5tprxfczyj4bfk0o
Merge bzr.dev 5916 and make sure the right patch is applied.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
from bzrlib.lazy_import import lazy_import
21
21
lazy_import(globals(), """
 
22
import itertools
 
23
 
22
24
from bzrlib import (
23
25
    check,
24
26
    debug,
1425
1427
            the revision key from each parsed line will be looked up in the
1426
1428
            revision_keys filter.
1427
1429
        :return: a dictionary mapping altered file-ids to an iterable of
1428
 
        revision_ids. Each altered file-ids has the exact revision_ids that
1429
 
        altered it listed explicitly.
 
1430
            revision_ids. Each altered file-ids has the exact revision_ids that
 
1431
            altered it listed explicitly.
1430
1432
        """
1431
1433
        seen = set(self._serializer._find_text_key_references(
1432
1434
                line_iterator).iterkeys())
1461
1463
        :param _inv_weave: The inventory weave from this repository or None.
1462
1464
            If None, the inventory weave will be opened automatically.
1463
1465
        :return: a dictionary mapping altered file-ids to an iterable of
1464
 
        revision_ids. Each altered file-ids has the exact revision_ids that
1465
 
        altered it listed explicitly.
 
1466
            revision_ids. Each altered file-ids has the exact revision_ids that
 
1467
            altered it listed explicitly.
1466
1468
        """
1467
1469
        selected_keys = set((revid,) for revid in revision_ids)
1468
1470
        w = _inv_weave or self.inventories
2552
2554
    @needs_read_lock
2553
2555
    def search_missing_revision_ids(self,
2554
2556
            revision_id=symbol_versioning.DEPRECATED_PARAMETER,
2555
 
            find_ghosts=True, revision_ids=None, if_present_ids=None):
 
2557
            find_ghosts=True, revision_ids=None, if_present_ids=None,
 
2558
            limit=None):
2556
2559
        """Return the revision ids that source has that target does not.
2557
2560
 
2558
2561
        :param revision_id: only return revision ids included by this
2582
2585
        # stop searching at found target revisions.
2583
2586
        if not find_ghosts and (revision_ids is not None or if_present_ids is
2584
2587
                not None):
2585
 
            return self._walk_to_common_revisions(revision_ids,
 
2588
            result = self._walk_to_common_revisions(revision_ids,
2586
2589
                    if_present_ids=if_present_ids)
2587
 
        # generic, possibly worst case, slow code path.
2588
 
        target_ids = set(self.target.all_revision_ids())
2589
 
        source_ids = self._present_source_revisions_for(
2590
 
            revision_ids, if_present_ids)
2591
 
        result_set = set(source_ids).difference(target_ids)
 
2590
            if limit is None:
 
2591
                return result
 
2592
            result_set = result.get_keys()
 
2593
        else:
 
2594
            # generic, possibly worst case, slow code path.
 
2595
            target_ids = set(self.target.all_revision_ids())
 
2596
            source_ids = self._present_source_revisions_for(
 
2597
                revision_ids, if_present_ids)
 
2598
            result_set = set(source_ids).difference(target_ids)
 
2599
        if limit is not None:
 
2600
            topo_ordered = self.source.get_graph().iter_topo_order(result_set)
 
2601
            result_set = set(itertools.islice(topo_ordered, limit))
2592
2602
        return self.source.revision_ids_to_search_result(result_set)
2593
2603
 
2594
2604
    def _present_source_revisions_for(self, revision_ids, if_present_ids=None):