Thanks for the MP, and for adding a test along with your changes. I
don't the fix is quite right yet though:
review needsfixing
On Tue, 2010-12-21 at 09:17 +0000, Leonid Borisenko wrote:
> Leonid Borisenko has proposed merging lp:~leonidborisenko/bzr-hg/hacking into lp:bzr-hg.
>
> Requested reviews:
> bzr-hg developers (bzr-hg)
> Related bugs:
> #692901 Crash with KeyError in incremental mirroring
> https://bugs.launchpad.net/bugs/692901
>
> differences between files attachment (review-diff.txt)
> === modified file 'fetch.py'
> --- fetch.py 2010-12-18 18:28:46 +0000
> +++ fetch.py 2010-12-21 09:17:08 +0000
> + def _unpack_texts(self, cg, mapping, filetext_map, first_imported_revid,
> + pb):
> i = 0
> # Texts
> while 1:
> @@ -361,7 +370,11 @@
> fileid = mapping.generate_file_id(f)
> chunkiter = mercurial.changegroup.chunkiter(cg)
> def get_text(node):
> - key = iter(filetext_map[fileid][node]).next()
> + if node in filetext_map[fileid]:
> + key = iter(filetext_map[fileid][node]).next()
> + else:
> + key = self._get_target_fulltext_key_from_revision_ancestry(
> + fileid, first_imported_revid)
This assumes there is some significance in the first revision that's
imported. This happens to be the case in your test case, but is not
necessarily true.
Perhaps we can pass csid to get_text and then use that to look up the
matching revision id and use that to find the proper full text?
> +
> + # Pull commited changeset to Bazaar branch.
> + #
> + # Prefer named function instead lambda to slightly more informative
> + # fail message.
> + def pull_to_bzr_repo_with_existing_text_metadata():
> + bzrtree.pull(hgbranch)
> +
> + # Not expected KeyError looked like:
> + #
> + # <...full traceback skipped...>
> + # File "/tmp/hg/fetch.py", line 208, in manifest_to_inventory_delta
> + # (fileid, ie.revision))
> + # KeyError: ('hg:f1', 'hg-v1:97562cfbcf3b26e7eacf17ca9b6f742f98bd0719')
> + self.assertThat(pull_to_bzr_repo_with_existing_text_metadata,
> + Not(raises(KeyError)))
I think we should simply just call bzrtree.pull(hgbranch) here. We don't
have a pattern of using testtools anywhere else in bzr-hg, and the error
message it prints in this case is very unhelpful (it eats the
backtrace).
Hi Leonid,
Thanks for the MP, and for adding a test along with your changes. I
don't the fix is quite right yet though:
review needsfixing
On Tue, 2010-12-21 at 09:17 +0000, Leonid Borisenko wrote: /bugs.launchpad .net/bugs/ 692901 revid, generate_ file_id( f) changegroup. chunkiter( cg) map[fileid] [node]) .next() map[fileid] : map[fileid] [node]) .next() target_ fulltext_ key_from_ revision_ ancestry( revid)
> Leonid Borisenko has proposed merging lp:~leonidborisenko/bzr-hg/hacking into lp:bzr-hg.
>
> Requested reviews:
> bzr-hg developers (bzr-hg)
> Related bugs:
> #692901 Crash with KeyError in incremental mirroring
> https:/
>
> differences between files attachment (review-diff.txt)
> === modified file 'fetch.py'
> --- fetch.py 2010-12-18 18:28:46 +0000
> +++ fetch.py 2010-12-21 09:17:08 +0000
> + def _unpack_texts(self, cg, mapping, filetext_map, first_imported_
> + pb):
> i = 0
> # Texts
> while 1:
> @@ -361,7 +370,11 @@
> fileid = mapping.
> chunkiter = mercurial.
> def get_text(node):
> - key = iter(filetext_
> + if node in filetext_
> + key = iter(filetext_
> + else:
> + key = self._get_
> + fileid, first_imported_
This assumes there is some significance in the first revision that's
imported. This happens to be the case in your test case, but is not
necessarily true.
Perhaps we can pass csid to get_text and then use that to look up the
matching revision id and use that to find the proper full text?
> + bzr_repo_ with_existing_ text_metadata( ): pull(hgbranch) to_inventory_ delta 97562cfbcf3b26e 7eacf17ca9b6f74 2f98bd0719' ) (pull_to_ bzr_repo_ with_existing_ text_metadata, KeyError) )) pull(hgbranch) here. We don't
> + # Pull commited changeset to Bazaar branch.
> + #
> + # Prefer named function instead lambda to slightly more informative
> + # fail message.
> + def pull_to_
> + bzrtree.
> +
> + # Not expected KeyError looked like:
> + #
> + # <...full traceback skipped...>
> + # File "/tmp/hg/fetch.py", line 208, in manifest_
> + # (fileid, ie.revision))
> + # KeyError: ('hg:f1', 'hg-v1:
> + self.assertThat
> + Not(raises(
I think we should simply just call bzrtree.
have a pattern of using testtools anywhere else in bzr-hg, and the error
message it prints in this case is very unhelpful (it eats the
backtrace).
Cheers,
Jelmer