Merge lp:~spiv/bzr/remove-dead-chk-code into lp:~bzr/bzr/trunk-old

Proposed by Andrew Bennetts
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merge reported by: Andrew Bennetts
Merged at revision: not available
Proposed branch: lp:~spiv/bzr/remove-dead-chk-code
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: 57 lines (has conflicts)
Text conflict in bzrlib/repository.py
To merge this branch: bzr merge lp:~spiv/bzr/remove-dead-chk-code
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+8522@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Andrew Bennetts (spiv) wrote :

There's a large code-path in StreamSource._get_inventory_stream that is totally
unused in current bzrlib. Unsurprisingly, it's also broken: there's no
_find_revision_outside_set method anymore. So this branch deletes it (and
replaces it with an assertion).

For good measure it also fixes a trivial bug in RemoteRepositoryFormat to make
sure that the .supports_chk attribute is accurate.

-Andrew.

Revision history for this message
John A Meinel (jameinel) wrote :

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

Andrew Bennetts wrote:
> Andrew Bennetts has proposed merging lp:~spiv/bzr/remove-dead-chk-code into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
>
> There's a large code-path in StreamSource._get_inventory_stream that is totally
> unused in current bzrlib. Unsurprisingly, it's also broken: there's no
> _find_revision_outside_set method anymore. So this branch deletes it (and
> replaces it with an assertion).
>
> For good measure it also fixes a trivial bug in RemoteRepositoryFormat to make
> sure that the .supports_chk attribute is accurate.
>
> -Andrew.
>
>
>

Actually, it isn't totally unused. It is used to copy data from a --dev7
format branch to a --2a format. Which happens to be broken as you say. :)

And I'm not positive, but I think this:

> +++ bzrlib/repository.py 2009-07-10 04:49:56 +0000
> @@ -4226,12 +4226,9 @@
>
> def _get_inventory_stream(self, revision_ids):
> from_format = self.from_repository._format
> - if (from_format.supports_chks and self.to_format.supports_chks
> - and (from_format._serializer == self.to_format._serializer)):
> - # Both sides support chks, and they use the same serializer, so it
> - # is safe to transmit the chk pages and inventory pages across
> - # as-is.
> - return self._get_chk_inventory_stream(revision_ids)
> + if (from_format.supports_chks and self.to_format.supports_chks):
> + raise AssertionError(
> + "This StreamSource should not be used for chk->chk fetches.")
> elif (not from_format.supports_chks):
> # Source repository doesn't support chks. So we can transmit the
> # inventories 'as-is' and either they are just accepted on the

^- actually should be "format.supports_chks or to_format.supports_chks".

Perhaps not, though.

  review approve
  merge approve

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

iEYEARECAAYFAkpXeiEACgkQJdeBCYSNAAN73ACfSAzYNc+52gN0ElTHVQs8llOE
pS0AniDM6pkVcfd36YJB9lqORPf+pmvm
=ytfn
-----END PGP SIGNATURE-----

review: Approve
Revision history for this message
John A Meinel (jameinel) wrote :

Didn't this land with a bunch of the other refactorings? I'm thinking we should mark this as rejected/superseded, etc.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/remote.py'
2=== modified file 'bzrlib/repository.py'
3--- bzrlib/repository.py 2009-08-30 23:51:10 +0000
4+++ bzrlib/repository.py 2009-08-31 04:37:17 +0000
5@@ -4545,6 +4545,7 @@
6
7 def _get_inventory_stream(self, revision_ids, missing=False):
8 from_format = self.from_repository._format
9+<<<<<<< TREE
10 if (from_format.supports_chks and self.to_format.supports_chks and
11 from_format.network_name() == self.to_format.network_name()):
12 raise AssertionError(
13@@ -4561,6 +4562,16 @@
14 # Essentially the same format.
15 return self._get_simple_inventory_stream(revision_ids,
16 missing=missing)
17+=======
18+ if (from_format.supports_chks and self.to_format.supports_chks):
19+ raise AssertionError(
20+ "This StreamSource should not be used for chk->chk fetches.")
21+ elif (not from_format.supports_chks):
22+ # Source repository doesn't support chks. So we can transmit the
23+ # inventories 'as-is' and either they are just accepted on the
24+ # target, or the Sink will properly convert it.
25+ return self._get_simple_inventory_stream(revision_ids)
26+>>>>>>> MERGE-SOURCE
27 else:
28 # Any time we switch serializations, we want to use an
29 # inventory-delta based approach.
30@@ -4577,6 +4588,7 @@
31 delta_closure = not self.delta_on_metadata()
32 yield ('inventories', from_weave.get_record_stream(
33 [(rev_id,) for rev_id in revision_ids],
34+<<<<<<< TREE
35 self.inventory_fetch_order(), delta_closure))
36
37 def _get_convertable_inventory_stream(self, revision_ids,
38@@ -4599,6 +4611,19 @@
39 effectively streams a complete inventory. Used for stuff like
40 filling in missing parents, etc.
41 """
42+=======
43+ self.inventory_fetch_order(),
44+ not self.delta_on_metadata()))
45+
46+ def _get_convertable_inventory_stream(self, revision_ids):
47+ # XXX: One of source or target is using chks, and they don't have
48+ # compatible serializations. The StreamSink code expects to be
49+ # able to convert on the target, so we need to put
50+ # bytes-on-the-wire that can be converted
51+ yield ('inventories', self._stream_invs_as_fulltexts(revision_ids))
52+
53+ def _stream_invs_as_fulltexts(self, revision_ids):
54+>>>>>>> MERGE-SOURCE
55 from_repo = self.from_repository
56 revision_keys = [(rev_id,) for rev_id in revision_ids]
57 parent_map = from_repo.inventories.get_parent_map(revision_keys)