Andrew Bennetts wrote:
> Review: Needs Fixing
> It's a shame that you add both "_find_present_inventory_ids" and "_find_present_inventories" to groupcompress_repo.py, but it's not trivial to factor out that duplication. Similarly, around line 950 of that file you have a duplication of the logic of find_parent_ids_of_revisions, but again reusing that code isn't trivial. Something to cleanup in the future I guess...
>
_find_present_inventory_ids, and _find_present_inventories are actually
exchangeable, it is just
self.from_repository._find_present_inventory_ids
rather than
self._find_present_inventories.
I'm glad you caught the duplication.
And for "_find_parent_ids_of_revisions()" it also is available as
self.from_repository....
Mostly because this is GroupCHKStreamSource which can assume that it has
a RepositoryCHK1 as the .from_repository.
Ultimately, we should probably move those functions to be on Repository,
and potentially make them public. I don't really like widening the
Repository api, but as it has a default implementation that works just
fine for all other implementations, it doesn't really cause a burden for
something like SVNRepository.
> In test_sprout_from_stacked_with_short_history in bzrlib/tests/per_repository_reference/test_fetch.py you start with a comment saying "Now copy this ...", which is a bit weird as the first thing in a test. Probably this comment hasn't been updated after you refactored the test? Anyway, please update it.
Done.
...
> for record in stream:
> records.append((record.key, record.get_bytes_as('fulltext')))
> records.sort()
> self.assertEqual(
> [(('a-id', 'A-id'), ''.join(content[:-2])), (('a-id', 'B-id'), ''.join(content[:-1])),
> (('a-id', 'C-id'), ''.join(content))],
> records)
>
> Which is more compact and doesn't have any need for conditionals in the test, and will probably give more informative failures.
Done.
>
> bzrlib/tests/per_repository_reference/test_initialize.py adds a test with no assert* calls. Is that intentional?
>
It exercises the code that was broken by doing things differently. (As
in you would get an exception.)
I can add arbitrary assertions, but the reason for the test was to have
a simple call to "initialize_on_transport_ex()" given all repository
formats, and remote requests, etc, etc.
I'll add some basic bits, just to make it look like a real test. I'll
even add one that tests we can initialize all formats over the smart server.
> In bzrlib/tests/test_pack_repository.py, test_resume_chk_bytes has a line of unreachable code after a raise statement.
>
> In bzrlib/tests/test_repository.py, is the typo in 'abcdefghijklmnopqrstuvwxzy123456789' meant to be a test to see how attentive your reviewer is? ;)
>
> Other than those, this seems fine to me though.
Fixed.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Andrew Bennetts wrote: present_ inventory_ ids" and "_find_ present_ inventories" to groupcompress_ repo.py, but it's not trivial to factor out that duplication. Similarly, around line 950 of that file you have a duplication of the logic of find_parent_ ids_of_ revisions, but again reusing that code isn't trivial. Something to cleanup in the future I guess...
> Review: Needs Fixing
> It's a shame that you add both "_find_
>
_find_present_ inventory_ ids, and _find_present_ inventories are actually repository. _find_present_ inventory_ ids present_ inventories.
exchangeable, it is just
self.from_
rather than
self._find_
I'm glad you caught the duplication.
And for "_find_ parent_ ids_of_ revisions( )" it also is available as repository. ...
self.from_
Mostly because this is GroupCHKStreamS ource which can assume that it has
a RepositoryCHK1 as the .from_repository.
Ultimately, we should probably move those functions to be on Repository,
and potentially make them public. I don't really like widening the
Repository api, but as it has a default implementation that works just
fine for all other implementations, it doesn't really cause a burden for
something like SVNRepository.
> In test_sprout_ from_stacked_ with_short_ history in bzrlib/ tests/per_ repository_ reference/ test_fetch. py you start with a comment saying "Now copy this ...", which is a bit weird as the first thing in a test. Probably this comment hasn't been updated after you refactored the test? Anyway, please update it.
Done.
...
> for record in stream: append( (record. key, record. get_bytes_ as('fulltext' ))) content[ :-2])), (('a-id', 'B-id'), ''.join( content[ :-1])),
> records.
> records.sort()
> self.assertEqual(
> [(('a-id', 'A-id'), ''.join(
> (('a-id', 'C-id'), ''.join(content))],
> records)
>
> Which is more compact and doesn't have any need for conditionals in the test, and will probably give more informative failures.
Done.
> tests/per_ repository_ reference/ test_initialize .py adds a test with no assert* calls. Is that intentional?
> bzrlib/
>
It exercises the code that was broken by doing things differently. (As on_transport_ ex()" given all repository
in you would get an exception.)
I can add arbitrary assertions, but the reason for the test was to have
a simple call to "initialize_
formats, and remote requests, etc, etc.
I'll add some basic bits, just to make it look like a real test. I'll
even add one that tests we can initialize all formats over the smart server.
> In bzrlib/ tests/test_ pack_repository .py, test_resume_ chk_bytes has a line of unreachable code after a raise statement. tests/test_ repository. py, is the typo in 'abcdefghijklmn opqrstuvwxzy123 456789' meant to be a test to see how attentive your reviewer is? ;)
>
> In bzrlib/
>
> Other than those, this seems fine to me though.
Fixed. enigmail. mozdev. org
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAko fsfMACgkQJdeBCY SNAAP7BgCfeZehp 6iRn0THWW1lDnOE zs1p PiZTtSrrDT6jebU kt
PxoAnjCXPs75oPL
=zVXm
-----END PGP SIGNATURE-----