~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Vincent Ladeuil
  • Date: 2010-02-05 10:27:33 UTC
  • mto: (5008.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5009.
  • Revision ID: v.ladeuil+lp@free.fr-20100205102733-8wpjnqz6g4nvrbfu
All Conflict action method names start with 'action_' to avoid potential namespace collisions

Show diffs side-by-side

added added

removed removed

Lines of Context:
1240
1240
        """Check a single text from this repository."""
1241
1241
        if kind == 'inventories':
1242
1242
            rev_id = record.key[0]
1243
 
            inv = self.deserialise_inventory(rev_id,
 
1243
            inv = self._deserialise_inventory(rev_id,
1244
1244
                record.get_bytes_as('fulltext'))
1245
1245
            if last_object is not None:
1246
1246
                delta = inv._make_delta(last_object)
2388
2388
        """single-document based inventory iteration."""
2389
2389
        inv_xmls = self._iter_inventory_xmls(revision_ids, ordering)
2390
2390
        for text, revision_id in inv_xmls:
2391
 
            yield self.deserialise_inventory(revision_id, text)
 
2391
            yield self._deserialise_inventory(revision_id, text)
2392
2392
 
2393
2393
    def _iter_inventory_xmls(self, revision_ids, ordering):
2394
2394
        if ordering is None:
2426
2426
                        next_key = None
2427
2427
                        break
2428
2428
 
2429
 
    def deserialise_inventory(self, revision_id, xml):
 
2429
    def _deserialise_inventory(self, revision_id, xml):
2430
2430
        """Transform the xml into an inventory object.
2431
2431
 
2432
2432
        :param revision_id: The expected revision id of the inventory.
2440
2440
                result.revision_id, revision_id))
2441
2441
        return result
2442
2442
 
2443
 
    def serialise_inventory(self, inv):
 
2443
    def _serialise_inventory(self, inv):
2444
2444
        return self._serializer.write_inventory_to_string(inv)
2445
2445
 
2446
2446
    def _serialise_inventory_to_lines(self, inv):
2450
2450
        return self._serializer.format_num
2451
2451
 
2452
2452
    @needs_read_lock
2453
 
    def get_inventory_xml(self, revision_id):
2454
 
        """Get inventory XML as a file object."""
 
2453
    def _get_inventory_xml(self, revision_id):
 
2454
        """Get serialized inventory as a string."""
2455
2455
        texts = self._iter_inventory_xmls([revision_id], 'unordered')
2456
2456
        try:
2457
2457
            text, revision_id = texts.next()
2459
2459
            raise errors.HistoryMissing(self, 'inventory', revision_id)
2460
2460
        return text
2461
2461
 
2462
 
    @needs_read_lock
2463
 
    def get_inventory_sha1(self, revision_id):
2464
 
        """Return the sha1 hash of the inventory entry
2465
 
        """
2466
 
        return self.get_revision(revision_id).inventory_sha1
2467
 
 
2468
2462
    def get_rev_id_for_revno(self, revno, known_pair):
2469
2463
        """Return the revision id of a revno, given a later (revno, revid)
2470
2464
        pair in the same history.
4013
4007
        #
4014
4008
        # nb this is only active for local-local fetches; other things using
4015
4009
        # streaming.
4016
 
        trace.warning("Fetching between repositories with different formats\n"
4017
 
            "from %s to %s.\n"
4018
 
            "This may take some time. Upgrade the branches to the same format \n"
4019
 
            "for better results.\n"
4020
 
            % (self.source._format, self.target._format))
 
4010
        ui.ui_factory.warn_cross_format_fetch(self.source._format,
 
4011
            self.target._format)
4021
4012
        if (not self.source.supports_rich_root()
4022
4013
            and self.target.supports_rich_root()):
4023
4014
            self._converting_to_rich_root = True
4316
4307
                    self._extract_and_insert_inventories(
4317
4308
                        substream, src_serializer)
4318
4309
            elif substream_type == 'inventory-deltas':
 
4310
                ui.ui_factory.warn_cross_format_fetch(src_format,
 
4311
                    self.target_repo._format)
4319
4312
                self._extract_and_insert_inventory_deltas(
4320
4313
                    substream, src_serializer)
4321
4314
            elif substream_type == 'chk_bytes':
4626
4619
 
4627
4620
    def _get_convertable_inventory_stream(self, revision_ids,
4628
4621
                                          delta_versus_null=False):
4629
 
        # The source is using CHKs, but the target either doesn't or it has a
4630
 
        # different serializer.  The StreamSink code expects to be able to
 
4622
        # The two formats are sufficiently different that there is no fast
 
4623
        # path, so we need to send just inventorydeltas, which any
 
4624
        # sufficiently modern client can insert into any repository.
 
4625
        # The StreamSink code expects to be able to
4631
4626
        # convert on the target, so we need to put bytes-on-the-wire that can
4632
4627
        # be converted.  That means inventory deltas (if the remote is <1.19,
4633
4628
        # RemoteStreamSink will fallback to VFS to insert the deltas).