Comment 3 for bug 412198

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 412198] Re: Packing a stacked branch removes parent inventories

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Collins wrote:
> John - that code uses None to mean 'copy all items'. Remember that Packer /had/ two use cases:
> - fetch by making a pack
> - packing
>
> When doing a pack, self._revision_keys is None, and all inventories are
> preserved (in knit-style pack repos). When fetching by making a pack, we
> want to copy only those revisions.
>
> This is essentially dead code now though, as we no longer fetch using
> packer, do we?
>

We no longer fetch using Packer, correct.
This code *is* used during pack operations (bzr pack and autopack)

I'll admit to not tracing to see for sure that _revision_keys was None,
and you could be right.

I can say that GCPacker does *not* work that way:
    def _copy_revision_texts(self):
        source_vf, target_vf = self._build_vfs('revision', True, False)
        if not self.revision_keys:
            # We are doing a full fetch, aka 'pack'
            self.revision_keys = source_vf.keys()

So self.revision_keys is always filled out.

We *can* change the inventory code to be:
    def _copy_inventory_texts(self):
        source_vf, target_vf = self._build_vfs('inventory', True, True)
        self._copy_stream(source_vf, target_vf, self.revision_keys,
                          'inventories', self._get_filtered_inv_stream, 2)

=>

    def _copy_inventory_texts(self):
        source_vf, target_vf = self._build_vfs('inventory', True, True)
        inv_keys = source_vf.keys()
        self._copy_stream(source_vf, target_vf, inv_keys,
                          'inventories', self._get_filtered_inv_stream, 2)

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkqCItgACgkQJdeBCYSNAAMOogCg0PpOfiFBRh5o7VERYVni1kYv
MXwAoMZaI0m0BZ2ocGkfszd3jUP9DByn
=Z2fe
-----END PGP SIGNATURE-----