/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Martin Pool
  • Date: 2010-02-09 19:04:02 UTC
  • mfrom: (5010 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5019.
  • Revision ID: mbp@canonical.com-20100209190402-2xbzrchmb4dfi2j7
Resolve conflicts with trunk

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)
2384
2384
        """single-document based inventory iteration."""
2385
2385
        inv_xmls = self._iter_inventory_xmls(revision_ids, ordering)
2386
2386
        for text, revision_id in inv_xmls:
2387
 
            yield self.deserialise_inventory(revision_id, text)
 
2387
            yield self._deserialise_inventory(revision_id, text)
2388
2388
 
2389
2389
    def _iter_inventory_xmls(self, revision_ids, ordering):
2390
2390
        if ordering is None:
2422
2422
                        next_key = None
2423
2423
                        break
2424
2424
 
2425
 
    def deserialise_inventory(self, revision_id, xml):
 
2425
    def _deserialise_inventory(self, revision_id, xml):
2426
2426
        """Transform the xml into an inventory object.
2427
2427
 
2428
2428
        :param revision_id: The expected revision id of the inventory.
2436
2436
                result.revision_id, revision_id))
2437
2437
        return result
2438
2438
 
2439
 
    def serialise_inventory(self, inv):
 
2439
    def _serialise_inventory(self, inv):
2440
2440
        return self._serializer.write_inventory_to_string(inv)
2441
2441
 
2442
2442
    def _serialise_inventory_to_lines(self, inv):
2446
2446
        return self._serializer.format_num
2447
2447
 
2448
2448
    @needs_read_lock
2449
 
    def get_inventory_xml(self, revision_id):
2450
 
        """Get inventory XML as a file object."""
 
2449
    def _get_inventory_xml(self, revision_id):
 
2450
        """Get serialized inventory as a string."""
2451
2451
        texts = self._iter_inventory_xmls([revision_id], 'unordered')
2452
2452
        try:
2453
2453
            text, revision_id = texts.next()
2455
2455
            raise errors.HistoryMissing(self, 'inventory', revision_id)
2456
2456
        return text
2457
2457
 
2458
 
    @needs_read_lock
2459
 
    def get_inventory_sha1(self, revision_id):
2460
 
        """Return the sha1 hash of the inventory entry
2461
 
        """
2462
 
        return self.get_revision(revision_id).inventory_sha1
2463
 
 
2464
2458
    def get_rev_id_for_revno(self, revno, known_pair):
2465
2459
        """Return the revision id of a revno, given a later (revno, revid)
2466
2460
        pair in the same history.
4008
4002
        #
4009
4003
        # nb this is only active for local-local fetches; other things using
4010
4004
        # streaming.
4011
 
        trace.warning("Fetching between repositories with different formats\n"
4012
 
            "from %s to %s.\n"
4013
 
            "This may take some time. Upgrade the branches to the same format \n"
4014
 
            "for better results.\n"
4015
 
            % (self.source._format, self.target._format))
 
4005
        ui.ui_factory.warn_cross_format_fetch(self.source._format,
 
4006
            self.target._format)
4016
4007
        if (not self.source.supports_rich_root()
4017
4008
            and self.target.supports_rich_root()):
4018
4009
            self._converting_to_rich_root = True
4307
4298
                    self._extract_and_insert_inventories(
4308
4299
                        substream, src_serializer)
4309
4300
            elif substream_type == 'inventory-deltas':
 
4301
                ui.ui_factory.warn_cross_format_fetch(src_format,
 
4302
                    self.target_repo._format)
4310
4303
                self._extract_and_insert_inventory_deltas(
4311
4304
                    substream, src_serializer)
4312
4305
            elif substream_type == 'chk_bytes':
4617
4610
 
4618
4611
    def _get_convertable_inventory_stream(self, revision_ids,
4619
4612
                                          delta_versus_null=False):
4620
 
        # The source is using CHKs, but the target either doesn't or it has a
4621
 
        # different serializer.  The StreamSink code expects to be able to
 
4613
        # The two formats are sufficiently different that there is no fast
 
4614
        # path, so we need to send just inventorydeltas, which any
 
4615
        # sufficiently modern client can insert into any repository.
 
4616
        # The StreamSink code expects to be able to
4622
4617
        # convert on the target, so we need to put bytes-on-the-wire that can
4623
4618
        # be converted.  That means inventory deltas (if the remote is <1.19,
4624
4619
        # RemoteStreamSink will fallback to VFS to insert the deltas).