~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/pack_repo.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-08-14 05:49:27 UTC
  • mfrom: (4476.3.86 inventory-delta)
  • Revision ID: pqm@pqm.ubuntu.com-20090814054927-k0k18dn46ax4b91f
(andrew) Add inventory-delta streaming for cross-format fetch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
422
422
        self._writer.begin()
423
423
        # what state is the pack in? (open, finished, aborted)
424
424
        self._state = 'open'
 
425
        # no name until we finish writing the content
 
426
        self.name = None
425
427
 
426
428
    def abort(self):
427
429
        """Cancel creating this pack."""
448
450
            self.signature_index.key_count() or
449
451
            (self.chk_index is not None and self.chk_index.key_count()))
450
452
 
 
453
    def finish_content(self):
 
454
        if self.name is not None:
 
455
            return
 
456
        self._writer.end()
 
457
        if self._buffer[1]:
 
458
            self._write_data('', flush=True)
 
459
        self.name = self._hash.hexdigest()
 
460
 
451
461
    def finish(self, suspend=False):
452
462
        """Finish the new pack.
453
463
 
459
469
         - stores the index size tuple for the pack in the index_sizes
460
470
           attribute.
461
471
        """
462
 
        self._writer.end()
463
 
        if self._buffer[1]:
464
 
            self._write_data('', flush=True)
465
 
        self.name = self._hash.hexdigest()
 
472
        self.finish_content()
466
473
        if not suspend:
467
474
            self._check_references()
468
475
        # write indices
1567
1574
        # determine which packs need changing
1568
1575
        pack_operations = [[0, []]]
1569
1576
        for pack in self.all_packs():
1570
 
            if not hint or pack.name in hint:
 
1577
            if hint is None or pack.name in hint:
 
1578
                # Either no hint was provided (so we are packing everything),
 
1579
                # or this pack was included in the hint.
1571
1580
                pack_operations[-1][0] += pack.get_revision_count()
1572
1581
                pack_operations[-1][1].append(pack)
1573
1582
        self._execute_pack_operations(pack_operations, OptimisingPacker)
2093
2102
                # when autopack takes no steps, the names list is still
2094
2103
                # unsaved.
2095
2104
                return self._save_pack_names()
 
2105
        return []
2096
2106
 
2097
2107
    def _suspend_write_group(self):
2098
2108
        tokens = [pack.name for pack in self._resumed_packs]