Still no joy reproducing the first error. I am suspecting delete/rename bugs with commit suffering the consequences of an inconsistent dirstate.
=== modified file 'bzrlib/tests/blackbox/test_commit.py'
--- bzrlib/tests/blackbox/test_commit.py 2007-12-10 16:39:00 +0000
+++ bzrlib/tests/blackbox/test_commit.py 2008-08-12 01:44:45 +0000
@@ -567,3 +567,143 @@
retcode=3)
self.assertContainsRe(err,
r'^bzr: ERROR: Cannot lock.*readonly transport')
+
+ def test_add_directory_and_rename_into_bug_256409(self):
+ # https://bugs.launchpad.net/bzr/+bug/256409
+ # corrupt deltas generated at commit...
+ tree = self.make_branch_and_tree('.')
+ rev1 = "rev1"
+ rev2 = "rev2"
+ basis_string = ('\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n')
+ new_string = ('\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n')
+ basis_inv = tree.branch.repository._serializer.read_inventory_from_string(basis_string)
+ new_inv = tree.branch.repository._serializer.read_inventory_from_string(new_string)
+ # create a basis tree
+ self.build_tree([
+ 'AUTHORS',
+ 'COPYING',
+ 'ChangeLog',
+ 'INSTALL',
+ 'NEWS',
+ 'README',
+ 'Makefile.am',
+ 'autogen.sh',
+ 'configure.in',
+ 'src/',
+ 'src/Makefile.am',
+ 'src/css-border.c',
+ 'src/css-border.h',
+ 'src/css-color.h',
+ 'src/css-gtk.c',
+ 'src/css-gtk.h',
+ 'src/css-rc-style.c',
+ 'src/css-rc-style.h',
+ 'src/css-style.c',
+ 'src/css-style.h',
+ 'src/css-theme.c',
+ 'src/css.h',
+ 'tests/',
+ 'tests/drawing.c',
+ 'theme/',
+ 'theme/Makefile.am',
+ 'theme/null/',
+ 'theme/null/Makefile.am',
+ 'theme/null/gtk-2.0/',
+ 'theme/null/gtk-2.0/Makefile.am',
+ 'theme/null/gtk-2.0/gtkrc',
+ ])
+ # set the inventory we want to commit
+ tree._write_inventory(basis_inv)
+ tree.commit('first post', rev_id=rev1)
+ # now a new dir and a rename
+ self.build_tree(['cbd/'])
+ self.build_tree_contents([
+ ('configure.in', 'new'),
+ ('cbd/css-border.c', 'new'),
+ ('cbd/css-border.h', 'new'),
+ ('cbd/css-color.h', 'new'),
+ ('cbd/css-gtk.c', 'new'),
+ ('cbd/css-gtk.h', 'new'),
+ ('cbd/css.h', 'new'),
+ ('Makefile.am', 'new'),
+ ('src/Makefile.am', 'new'),
+ ('theme/Makefile.am', 'new'),
+ ('theme/null/Makefile.am', 'new'),
+ ('theme/null/gtk-2.0/Makefile.am', 'new'),
+ ('tests/drawing.c', 'new')])
+ tree._write_inventory(new_inv)
+ tree = tree.bzrdir.open_workingtree()
+ tree.commit('make and move', rev_id=rev2)
+ self.run_bzr('check')
+ tree.lock_read()
+ t = tree.branch.repository.get_transaction()
+ r = tree.branch.repository
+ knit = r.weave_store.get_weave('cbd-20080704110353-r3riigod3h5b596c-1', t)
+ self.assertEqual(set([rev2]), set(knit.versions()))
+ # final smoking gun test
+ self.run_bzr('branch . foo')