Comment 5 for bug 718723

Also a crash with pull --overwrite

Non-stacked works:

$ bzr branch bzr+ssh://${BRANCH_PATH} ${LOCAL_TARGET}
Branched 750 revision(s).
$ cd ${LOCAL_TARGET}/
$ bzr pull --overwrite ../13619.patch
  <list of updates>
All changes applied successfully.
Now on revision 749.

Cleanup:

$ cd ..
$ rm -rf ${LOCAL_TARGET}/

With stacked - doesn't work:

$ bzr branch --stacked bzr+ssh://${BRANCH_PATH} ${LOCAL_TARGET}
Created new stacked branch referring to bzr+ssh://${BRANCH_PATH}/.
$ cd ${LOCAL_TARGET}/
$ bzr pull --overwrite /data/id/CmsRoot/tasks/patches/13619.patch
bzr: failed to report crash using apport:
     AssertionError()
bzr: ERROR: bzrlib.errors.BzrCheckError: Internal check failed: Cannot add revision(s) to repository: missing referenced chk root keys: [StaticTuple('sha1:1cf87f3b340e298218a852fee5ae97783670c8dd',)]

Traceback (most recent call last):
  File "${BZR_DISTR_PATH}/lib/python/bzrlib/commands.py", line 923, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "${BZR_DISTR_PATH}/lib/python/bzrlib/commands.py", line 1123, in run_bzr
    ret = run(*run_argv)
  File "${BZR_DISTR_PATH}/lib/python/bzrlib/commands.py", line 691, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "${BZR_DISTR_PATH}/lib/python/bzrlib/commands.py", line 710, in run
    return self._operation.run_simple(*args, **kwargs)
  File "${BZR_DISTR_PATH}/lib/python/bzrlib/cleanup.py", line 135, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "${BZR_DISTR_PATH}/lib/python/bzrlib/cleanup.py", line 165, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "${BZR_DISTR_PATH}/lib/python/bzrlib/builtins.py", line 985, in run
    mergeable.install_revisions(branch_to.repository)
  File "${BZR_DISTR_PATH}/lib/python/bzrlib/merge_directive.py", line 278, in install_revisions
    info.install_revisions(target_repo, stream_input=False)
  File "${BZR_DISTR_PATH}/lib/python/bzrlib/bundle/serializer/v4.py", line 471, in install_revisions
    return ri.install()
  File "${BZR_DISTR_PATH}/lib/python/bzrlib/bundle/serializer/v4.py", line 543, in install
    self._repository.commit_write_group()
  File "${BZR_DISTR_PATH}/lib/python/bzrlib/repository.py", line 1640, in commit_write_group
    result = self._commit_write_group()
  File "${BZR_DISTR_PATH}/lib/python/bzrlib/repofmt/pack_repo.py", line 2333, in _commit_write_group
    hint = self._pack_collection._commit_write_group()
  File "${BZR_DISTR_PATH}/lib/python/bzrlib/repofmt/pack_repo.py", line 2171, in _commit_write_group
    "Cannot add revision(s) to repository: " + problems_summary)
BzrCheckError: Internal check failed: Cannot add revision(s) to repository: missing referenced chk root keys: [StaticTuple('sha1:1cf87f3b340e298218a852fee5ae97783670c8dd',)]

bzr 2.3.0 on python 2.5.2 (Linux-2.6.24-22-generic-i686-with-debian-lenny-sid)
arguments: ['${BZR_DISTR_PATH}/bin/bzr', 'pull', '--overwrite', '/data/id/CmsRoot/tasks/patches/13619.patch']
encoding: 'ANSI_X3.4-1968', fsenc: 'ANSI_X3.4-1968', lang: None
plugins:
  bash_completion ${BZR_DISTR_PATH}/lib/python/bzrlib/plugins/bash_completion [2.3.0]
  bzrtools ${BZR_DISTR_PATH}/lib/python/bzrlib/plugins/bzrtools [2.3.0]
  explorer ${BZR_DISTR_PATH}/lib/python/bzrlib/plugins/explorer [1.1.2]
  extmerge ${BZR_DISTR_PATH}/lib/python/bzrlib/plugins/extmerge [unknown]
  launchpad ${BZR_DISTR_PATH}/lib/python/bzrlib/plugins/launchpad [2.3.0]
  netrc_credential_store ${BZR_DISTR_PATH}/lib/python/bzrlib/plugins/netrc_credential_store [2.3.0]
  news_merge ${BZR_DISTR_PATH}/lib/python/bzrlib/plugins/news_merge [2.3.0]
  qbzr ${BZR_DISTR_PATH}/lib/python/bzrlib/plugins/qbzr [0.20.0]

*** Bazaar has encountered an internal error. This probably indicates a
    bug in Bazaar. You can help us fix it by filing a bug report at
        https://bugs.launchpad.net/bzr/+filebug
    including this traceback and a description of the problem.